Model-specific prompt formatter
A prompt that works well on one model is rarely formatted the way another model expects. Claude leans on XML tags and a strong system role; GPT-4 wants a clean system and user separation; Gemini does best with an explicit instruction prefix; and open Llama models need chat-template tokens when called directly. This formatter takes one base prompt and produces the provider-preferred version for each, so you stop hand-converting between four conventions.
How it works
You write a single plain prompt. The tool then wraps it in each target model’s documented structure without touching your wording. For GPT-4 it splits your text into a system message (the instructions) and a user message (the task). For Claude it builds a system block and wraps the task content in XML tags the model reads well. For Gemini it adds an instruction prefix and a clear task section. For Llama it inserts the chat-template tokens that mark each turn. Every version is shown ready to paste into the matching playground or API call.
What each model’s preferred format looks like
GPT-4 (OpenAI messages API):
The API takes an array of {role, content} objects. Instructions belong in the system role — models like GPT-4 follow a strong system message reliably. The user turn contains the actual task content.
[
{ "role": "system", "content": "You are a precise editor..." },
{ "role": "user", "content": "Edit the following paragraph for clarity:..." }
]
Claude (Anthropic API):
Claude responds well to < > XML-style tags that separate distinct sections of a prompt. A system parameter holds general instructions, and the user turn wraps content in named tags.
system: You are a precise editor. Focus on clarity and brevity.
user: <document>
[paste text here]
</document>
Edit the document above for clarity.
Gemini (Google Generative AI): Gemini works well with an explicit instruction prefix at the top of the prompt, followed by a clearly labeled task section.
INSTRUCTION: You are a precise editor. Focus on clarity and brevity.
TASK: Edit the following paragraph for clarity:
[paste text here]
Llama (direct inference): Open Llama chat models expect special role tokens wrapping each turn. These are added by the tokenizer when using a hosted API, but must be added manually when calling the model directly.
[INST] <<SYS>>
You are a precise editor.
<</SYS>>
Edit the following paragraph for clarity: [paste text here] [/INST]
When formatting differences actually change results
Formatting matters most for longer, structured prompts where the model must juggle instructions, reference material, and a task. A short single-sentence prompt behaves similarly across models regardless of wrapping. But when your prompt includes a long document to analyze, multiple constraints, or a specific output schema, the structure signals to the model what is context versus instruction versus task — and models vary in how reliably they pick that up without explicit structure.
Tips
- XML tags help Claude most when your prompt mixes instructions with longer reference content — they prevent the two from blurring.
- Llama tokens matter only on direct inference calls. Hosted chat UIs add them automatically, so the plain or GPT-style version works there.
- Keep your base prompt structureless — write instructions then task in plain prose and let the formatter add the scaffolding. Adding your own structural markup before formatting can conflict with the output.
- Compare outputs side by side on the same task to see which model’s response best matches your quality bar.