Prompts
Prompt builder with variables, live preview and token count
Build a structured prompt from a role, task, context, rules and examples, fill its {{variables}}, and copy it as plain text or as the exact OpenAI, Claude or Gemini API request, with a live token count and cost. Free, no sign-up, and it runs in your browser.
Who the model is and who it’s helping. Goes at the top of the system prompt.
Documents, data or background the task needs. Goes first in the user message.
What you want done. Goes last, after the context.
Rules, limits and things to avoid. Say why when it matters.
Length, structure, tone, or the JSON shape you need back.
$2 input · $10 output per 1M tokens · prices updated 2026-10-12
Anthropic hasn’t published this model’s tokenizer, so the range is OpenAI’s o200k_base count × 0.5 to × 2. The token counter can get the exact figure with your own key. Counts the prompt text; each API adds a few tokens per message for formatting.
Output tokens are billed too, usually at a higher rate.
{
"model": "claude-sonnet-5-5",
"max_tokens": 1024,
"system": "You are a friendly support agent for Taskly, a task-tracking app for small teams.\n\n<constraints>\n- Use only facts from the article. If it doesn’t answer the question, say so and offer to pass the message to a person.\n- Keep the reply under 120 words.\n- Don’t promise refunds or delivery dates.\n</constraints>\n\n<output_format>\nPlain text, no Markdown. Start with a one-sentence answer, then up to three numbered steps if the customer needs to do something.\n</output_format>\n\n<examples>\n<example>\n<input>\nHow do I add someone to my team?\n</input>\n<output>\nYou can invite teammates from Settings.\n1. Open Settings, then Members.\n2. Select Invite and enter their email address.\n3. They’ll get an email with a link to join.\n</output>\n</example>\n</examples>",
"messages": [
{
"role": "user",
"content": "<context>\nHelp centre article:\nExporting tasks: Open the project, select the three-dot menu and choose Export. Pick CSV or JSON. Exports include task titles, assignees, due dates and status. Comments and attachments are not exported.\n</context>\n\n<task>\nAnswer the customer’s message using only the help centre article.\n\nCustomer message:\nCan I get all my tasks out as a spreadsheet? I need the comments too.\n</task>"
}
]
}Steps
How to use the prompt builder
- Fill in the sections you need. Only the task is essential; empty sections are left out.
- Mark anything that changes between calls as a variable, such as {{customer_message}}, then fill it in the Variables box.
- Add a few input and output examples if you need a specific format, and choose whether they go inside the prompt or as earlier conversation turns.
- Pick a model to see the prompt’s token count and the cost of one call, including the reply length you expect.
- Choose a format (plain text, OpenAI, Claude or Gemini) and copy the prompt, the JSON request body or a Python, TypeScript or curl snippet.
Method
How it works
A good prompt is mostly a matter of putting the right things in the right place. The builder gives each part its own box and assembles them in an order drawn from the providers’ own prompting guides, checked on 2026-10-12. It doesn’t use a model to write or “improve” anything: what you see is exactly what you typed, arranged and labelled.
How the prompt is assembled
With a system prompt switched on, the role comes first, followed by your constraints, the output format and any examples. OpenAI’s prompt engineering guide suggests the same order for a developer message: identity, then instructions, then examples. The user message holds the context first and the task last. That follows Anthropic’s long-context advice to put documents and data near the top and the question at the end, which it says can improve response quality by up to 30 percent in tests with complex, multi-document inputs. With the system prompt off, everything goes into one user message, still with the task last.
Sections are marked with XML tags by default, such as <context> and <output_format>. Anthropic recommends XML tags so Claude can tell instructions, context, examples and inputs apart, and asks for consistent, descriptive tag names. OpenAI says Markdown headings and XML tags both help mark sections, so you can switch to Markdown headings or plain labels.
Variables
Anything written as {{name}} becomes a variable with its own box. Names start with a letter or underscore and can contain letters, digits, underscores and hyphens. Values are inserted in a single pass, so a value that itself contains {{…}} is left as written rather than expanded again. A variable you haven’t filled stays visible as a placeholder, and the preview warns you before you copy it.
Examples: in the prompt or as turns
Examples are one of the most reliable ways to fix a format, and Anthropic suggests 3 to 5 varied ones in <example> tags. You can also send them as earlier conversation turns: a user message with the example input, then an assistant message (a model turn in Gemini) with the output you want. The final message is always from the user. That matters for Claude: from the Claude 4.6 models onwards, a request ending in a partial assistant message (a prefill) returns an error.
Each provider’s request format
The same prompt is shaped differently for each API. OpenAI recommends the Responses API for new projects, where the system prompt is the top-level instructions field; Chat Completions is still supported and takes it as a developer message, which replaces system from o1 onwards. Anthropic’s Messages API has a top-level system and requires max_tokens. Gemini’s generateContent takes systemInstruction and contents, whose roles are user and model. Google now recommends its newer Interactions API for new work but says generateContent remains fully supported. The message format guide covers images and tool calls too, and the model ID reference lists the IDs the snippets use.
Token count and cost
The token count runs in your browser with the chosen model’s own tokenizer where one is public: OpenAI’s encodings and open-weight models’ tokenizer files. Claude and Gemini tokenizers aren’t published, so for those the builder shows a range from OpenAI’s count, the same method as the context window checker; the token counter can fetch the exact figure with your own key. The cost per call adds your expected reply at the model’s output price, using the same prices as the cost calculator. The count covers the prompt text; each API adds a few tokens of formatting per message. If the role, rules and examples stay the same on every call, they sit at the start of the request, which is where prompt caching needs them to be.
Examples
Worked examples
Where each section goes
| Section | OpenAI | Anthropic | Gemini |
|---|---|---|---|
| Role, constraints, output format | instructions (Responses) or a developer message (Chat) | top-level system | systemInstruction |
| Examples, in the prompt | end of the instructions | end of system | end of systemInstruction |
| Examples, as turns | user and assistant items before the last message | user and assistant turns | user and model turns |
| Context, then task | last user message | last user message | last user turn |
The example template as a Claude Messages API request
The support-reply template that loads with the builder, with its three variables filled and XML labels. The role, rules, format and example form the system field; the article and the customer’s question form the single user message, question last.
{
"model": "claude-fable-5-1",
"max_tokens": 1024,
"system": "You are a friendly support agent for Taskly, a task-tracking app for small teams.\n\n<constraints>\n- Use only facts from the article. If it doesn’t answer the question, say so and offer to pass the message to a person.\n- Keep the reply under 120 words.\n- Don’t promise refunds or delivery dates.\n</constraints>\n\n<output_format>\nPlain text, no Markdown. Start with a one-sentence answer, then up to three numbered steps if the customer needs to do something.\n</output_format>\n\n<examples>\n<example>\n<input>\nHow do I add someone to my team?\n</input>\n<output>\nYou can invite teammates from Settings.\n1. Open Settings, then Members.\n2. Select Invite and enter their email address.\n3. They’ll get an email with a link to join.\n</output>\n</example>\n</examples>",
"messages": [
{
"role": "user",
"content": "<context>\nHelp centre article:\nExporting tasks: Open the project, select the three-dot menu and choose Export. Pick CSV or JSON. Exports include task titles, assignees, due dates and status. Comments and attachments are not exported.\n</context>\n\n<task>\nAnswer the customer’s message using only the help centre article.\n\nCustomer message:\nCan I get all my tasks out as a spreadsheet? I need the comments too.\n</task>"
}
]
}FAQ
Frequently asked questions
Is this an AI prompt generator?
Not in the sense of a model writing the prompt for you. It is a structured builder: you write the role, task, context, rules and examples, and it lays them out the way OpenAI’s and Anthropic’s prompting guides recommend, fills your variables and produces the exact API request. No model is called and nothing leaves your browser.
What is a prompt template?
A prompt template is a reusable prompt with named placeholders, or variables, such as {{customer_message}}, for the parts that change on every call. The builder finds each one, gives it a box to fill, and inserts the value in one pass. In your own code you would do the same with a template string or function argument; OpenAI recommends keeping production prompts in application code.
Should I use XML tags or Markdown headings?
Either works if you use it consistently. Anthropic recommends XML tags such as <context> and <instructions> so Claude can tell instructions, data and examples apart. OpenAI’s guide says Markdown headings and lists help mark sections, and XML tags help show where a document starts and ends. XML is the safer default when the context itself contains Markdown.
Where does the system prompt go in each API?
OpenAI’s Responses API takes it as top-level instructions; in Chat Completions it is a developer message, which replaces the system message from o1 onwards. Anthropic’s Messages API has a top-level system field and no system role in messages. Gemini’s generateContent takes systemInstruction, which accepts text only.
How many few-shot examples should I add?
Anthropic suggests 3 to 5 relevant, varied examples wrapped in <example> tags. For reasoning models, OpenAI suggests trying without examples first and adding them only if the output misses. Every example is resent and billed on every call, so watch the token count as you add them.
How accurate is the token count?
For OpenAI models and open-weight models with a published tokenizer, the count is exact for the prompt text. Anthropic and Google haven’t published tokenizers for current Claude and Gemini models, so the builder shows a range based on OpenAI’s count. Each API also adds a few tokens per message for formatting, which the count leaves out.
Is my prompt saved or sent anywhere?
No. The builder runs entirely in your browser and makes no network requests with your text. If you tick “Remember this template”, the template is kept in your browser’s local storage on this device only; untick it to delete it. Nothing goes in the page address either.
Related
Related tools
- Prompt DiffCompare two prompt versions side by side.
- AI Token CounterCount tokens for GPT, Claude, Gemini, DeepSeek, Qwen and more.
- LLM API Cost CalculatorEstimate per-request, daily and monthly API costs.
- Prompt Caching CalculatorEstimate savings from prompt caching.
- Model ID ReferenceCopy current API model IDs for Claude, GPT, Gemini and more.
- Context Window CheckerSee whether your text fits each model’s context window.
Read