AI text shortcodes

AI shortcodes put text written by a language model into your posts. Use them in any post template, in the meta title and description, and inside other places. Each shortcode is one request to the AI provider, billed by the provider on your own API key.

Basics

One shortcode for every provider

[ai_generate] accepts an AI engine name and calls the right provider. Switching from GPT to Claude or to an OpenRouter model is a matter of changing one word.

[ai_generate]

The universal text shortcode. Works with OpenAI, Anthropic, Google, xAI, OpenRouter and your custom endpoints.

[ai_generate engine="anthropic-claude-sonnet-4-6" prompt="Rewrite this article in plain English, keep the HTML structure: %post_content%"]
prompt (required)
The instruction.
engine
The AI engine name. Without it, the Default AI model is used.
max_tokens
Maximum length of the answer in tokens.
temperature
Randomness. Default: 1. Lower values give more predictable text, higher values more creative text.

[openai_gpt]

OpenAI GPT models with your OpenAI key.

[openai_gpt model="gpt-4o" prompt="Translate the following article to German and return HTML: %post_content%"]
prompt (required)
The instruction.
model
The OpenAI model name, for example gpt-5.5, gpt-5.4-mini, gpt-4o. Default: gpt-4o-mini. GPT-5 and newer models are called through the OpenAI Responses API with a low reasoning effort suited to writing.
max_tokens, temperature, top_p, presence_penalty, frequency_penalty
Optional generation parameters. top_p is an alternative to temperature (nucleus sampling): 0.1 means only the top 10% most likely tokens are considered. The penalties (-2.0 to 2.0) discourage repeating words and topics. Change either temperature or top_p, not both.

[claude]

Anthropic Claude models with your Anthropic key.

[claude model="claude-sonnet-4-6" prompt="Translate the following article to Spanish and return HTML: %post_content%"]
prompt (required)
The instruction.
model
The Claude model name, for example claude-opus-4-7, claude-sonnet-4-6 or claude-haiku-4-5. Default: claude-sonnet-4-20250514.
max_tokens
Maximum length of the answer. Default: 4096.
temperature, top_p, top_k
Optional. top_k limits sampling to the K most likely tokens and removes unlikely “long tail” answers.

[gemini]

Google Gemini models with your Google AI key.

[gemini prompt="Write a recipe article for '%post_title%'. Use only p, ul, li and em tags."]
prompt (required)
The instruction.
model
The Gemini model name, for example gemini-3.5-flash or gemini-3.1-pro-preview. Default: gemini-2.5-pro.
max_tokens
Maximum length of the answer. Without it, the plugin uses a large limit suited to the model.
temperature, top_p, top_k
Optional generation parameters.

[xai]

xAI Grok models with your xAI key.

[xai model="grok-4.3" prompt="Write a short, punchy news summary of this article: %post_content_notags%"]
prompt (required)
The instruction.
model
The Grok model name. Default: grok-4-latest.
max_tokens, temperature, top_p
Optional generation parameters.

[or_text]

Any text model available on OpenRouter: OpenAI, Anthropic, Google, Meta Llama, Mistral, DeepSeek, Qwen and hundreds more, with one OpenRouter key.

[or_text model="mistralai/mistral-large" prompt="Rewrite this text in a sarcastic style, keep its HTML structure: %post_content%"]
prompt (required)
The instruction.
model
The OpenRouter model ID, for example anthropic/claude-sonnet-4.6, openai/gpt-4o, deepseek/deepseek-v4-pro or meta-llama/llama-3.1-8b-instruct:free.
Other parameters
Any parameter of the OpenRouter API is passed through: max_tokens, temperature, top_p, top_k, presence_penalty, frequency_penalty, repetition_penalty, min_p, top_a, seed (repeatable results for identical input), depending on what the model supports.

[custom_ai]

A model of your own custom AI endpoint: DeepSeek, Mistral, a local server or any OpenAI-compatible API.

[custom_ai id="deepseek" model="deepseek-chat" prompt="Summarize this article in three sentences: %post_content_notags%"]
id (required)
The Endpoint ID from the Accounts page.
prompt (required)
The instruction.
model
The model name. Optional if the endpoint has a default model.
Other parameters
Passed to the endpoint as they are, for example max_tokens or temperature.

[gpt_article]

Writes a long, coherent article in several sections. Language models produce limited text per answer; [gpt_article] works around this with a chain of prompts: it asks the model for a list of section titles first, then writes each section, giving the model the article written so far, so the parts connect naturally.

[gpt_article topic="%post_title%" engine="openai-gpt-4o" sections="5" directives="Format the text for a WordPress post using only p, em, blockquote, ul and li tags. Mention known facts and little-known secrets."]
topic (required)
The subject of the article, for example %post_title% or Life in Prague.
engine
The AI engine name. Default: openai-gpt-4o.
sections
Number of sections. Default: 4. More sections, longer article. With 1, the article is written in one request without a section list.
sectionN
Extra instructions for section N only, added to directives: section2="Add one quote."
structure
Your outline instead of the model’s choice: structure="Section 1: Introduction; Section 5: FAQ".
directives
Formatting and content rules for every section. A sensible default (paragraph tags only) is used when you leave it out.
language
Language of the article. Default: English. Example: language="Spanish".
heading
The heading tag placed before every section. Default: h2. Use heading="" for no headings.
max_tokens
Maximum tokens per section. Default: 4096.
temperature
Creativity. Default: 1.

How structure and directives work together

The section titles are generated from the topic and the structure, for example “make the first section an introduction and the last one a FAQ”. Each section is then written with both structure and directives in its prompt, so the article follows your outline and your formatting rules.

A 5-section article means 6 requests: one for the outline and one per section. The Delay of the feed is applied between sections, which helps with providers that limit requests per minute.

Combining shortcodes

Use the Template processing order to feed the result of one template into another. Write the article first, then a title for it:

Post content: [gpt_article topic="%post_title%" sections="4"]
Post title:   [ai_generate prompt="Write a catchy title (no quotes, no colons) for this article: %post_content_notags[300]%"]

For short tasks inside other text, the %gpt_prompt[...]% placeholder is often handier than a shortcode.