Utilities
Convert OpenAI to Anthropic format (and to Gemini)
OpenAI’s Chat Completions, Anthropic’s Messages API and Gemini’s generateContent describe the same conversation in different shapes: the system prompt, roles, images, tools and tool results all move. Paste a request in one of 4 formats and get it in another, with every field that doesn’t map listed. It runs in your browser.
Converted in your browser. Nothing you paste is sent anywhere, so API keys and data stay on your device.
Converted OpenAI Chat Completions to Anthropic Messages. (Source detected automatically.) 1 warning.
Changed, dropped or worth checking (1)
- Anthropic has deprecated sampling settings: models released after Claude Opus 4.6 reject
temperatureother than 1.0,top_pbelow 0.99, and anytop_k. Remove them for current models.temperature
Good to know (1)
- Model IDs differ between providers, so
gpt-6-astrawas replaced withMODEL_ID. Replace it with a model ID from Anthropic.model
POST https://api.anthropic.com/v1/messages
{
"model": "MODEL_ID",
"max_tokens": 800,
"system": "You are a support assistant for a bike shop. Check stock before you answer.",
"messages": [
{
"role": "user",
"content": [
{
"type": "text",
"text": "What part is this, and do you have it in stock?"
},
{
"type": "image",
"source": {
"type": "base64",
"media_type": "image/png",
"data": "iVBORw0KGgo="
}
}
]
},
{
"role": "assistant",
"content": [
{
"type": "tool_use",
"id": "call_abc123",
"name": "check_stock",
"input": {
"part": "rear derailleur"
}
}
]
},
{
"role": "user",
"content": [
{
"type": "tool_result",
"tool_use_id": "call_abc123",
"content": "{\"in_stock\":true,\"quantity\":4}"
}
]
}
],
"tools": [
{
"name": "check_stock",
"description": "Look up how many of a part the shop has in stock.",
"input_schema": {
"type": "object",
"properties": {
"part": {
"type": "string"
}
},
"required": [
"part"
],
"additionalProperties": false
},
"strict": true
}
],
"temperature": 0.2
}Steps
How do I convert OpenAI messages to Anthropic format?
- Paste a request body, or just its messages, input or contents array.
- Leave “From” on automatic detection, or pick the source format.
- Choose the target format in “To”.
- Read the notes, fixing anything under “Needs your attention”, then copy or download the converted request.
Method
Where does the system prompt go in each API?
OpenAI, Anthropic and Google all model a chat as a list of turns, but they disagree on almost every detail: where the system prompt lives, what the roles are called, how images are encoded and how a tool call and its result are written. The converter reads your request into one neutral conversation, then writes that conversation out in the target format, so every direction uses the same rules. The system prompt is the first thing to move: OpenAI puts it in the message list as a system or developer message, Anthropic in a top-level system field and Gemini in systemInstruction.
How do tool calls convert between OpenAI, Anthropic and Gemini?
OpenAI’s Chat Completions puts the system prompt in the message list and sends tool arguments as a string of JSON; Anthropic and Gemini want a separate system field and an arguments object. OpenAI gives each tool result its own tool message, while Anthropic and Gemini put results inside a user turn. Anthropic needs every result for a set of parallel calls in the very next user message, with the tool_result blocks before any text, so the converter merges and reorders turns. Images move from one data: URL to separate media type and base64 fields. For the full background, read OpenAI vs Anthropic vs Gemini message format.
What changes when converting to Gemini?
A Gemini functionResponse needs the function’s name, which an OpenAI tool message doesn’t carry, so the converter looks it up from the matching call. Its response must be an object: JSON objects pass through, and anything else is wrapped as {"result": …}, as in Google’s own example. Tool schemas go in parametersJsonSchema, because the older parameters field takes only an OpenAPI subset: in our test on 12 October 2026 the API rejected an additionalProperties key there, which OpenAI’s strict schemas always include. For calls Gemini didn’t make, the converter adds the skip_thought_signature_validator placeholder that Google documents.
What changes when converting to Anthropic?
Anthropic requires max_tokens; if your source has no limit, 4,096 is written and flagged so you can set your own. Tool IDs must match ^[a-zA-Z0-9_-]+$, so other characters are replaced, the same way in the call and its result. Forcing a tool (any or tool) returns a 400 error on Claude Opus 5.5, Sonnet 5.5, Fable 5.1 and Mythos 5.1, so that mapping comes with a warning.
What doesn’t convert?
It converts requests, not replies, and it doesn’t translate model IDs: a model from another provider becomes MODEL_ID for you to fill in from the list of model IDs for each API. Reasoning blocks, file uploads, audio and built-in tools are left out with a note. If a tool call’s arguments aren’t valid JSON, they become {} with an error, and JSON repair can fix them first.
Should I convert requests or use an OpenAI-compatible endpoint?
Convert for production. OpenAI-compatible APIs let you point the OpenAI SDK at another provider, which is quick for trying a model, but Anthropic says its compatibility layer is mainly for testing and comparing models and isn’t production-ready for most uses; it ignores strict on tools and response_format, and doesn’t support prompt caching. The native format gives you every feature.
How we checked it
Every mapping was checked on 12 October 2026 against OpenAI’s published OpenAPI specification, Anthropic’s Messages API reference and Google’s v1beta discovery document. Sample outputs passed the request types in the official openai and Anthropic TypeScript SDKs, and Gemini outputs were sent to the API without a key: Google parses the body before it checks the key, so an authentication error rather than a 400 shows every field name was accepted. That test also showed a trap in Google’s own guide: its newer responseFormat.text.mimeType rejects the "application/json" the guide shows (it wants APPLICATION_JSON), so the converter writes the long-standing responseMimeType and responseJsonSchema pair instead.
Examples
How does the same chat look in OpenAI, Anthropic and Gemini format?
One system prompt and one user message, converted from OpenAI Chat Completions by this tool when the page was built. The model ID becomes MODEL_ID for Anthropic, because IDs don’t carry across providers, and Anthropic’s required max_tokens is added. Gemini takes the model in the URL, not the body.
{
"model": "gpt-5.5",
"messages": [
{
"role": "system",
"content": "Answer in one sentence."
},
{
"role": "user",
"content": "What is a token?"
}
]
}{
"model": "MODEL_ID",
"max_tokens": 4096,
"system": "Answer in one sentence.",
"messages": [
{
"role": "user",
"content": "What is a token?"
}
]
}{
"systemInstruction": {
"parts": [
{
"text": "Answer in one sentence."
}
]
},
"contents": [
{
"role": "user",
"parts": [
{
"text": "What is a token?"
}
]
}
]
}| Piece | OpenAI Chat Completions | OpenAI Responses | Anthropic Messages | Gemini generateContent |
|---|---|---|---|---|
| System prompt | developer or system message | instructions | system | systemInstruction |
| Turns | messages | input items | messages | contents (roles user, model) |
| Image, inline | image_url with a data: URL | input_image with a data: URL | image block, source.type: base64 | inlineData part |
| Image, by URL | image_url with the URL | input_image with the URL | image block, source.type: url | fileData part with fileUri |
| Tool definition | tools[].function.parameters | tools[].parameters | tools[].input_schema | functionDeclarations[].parametersJsonSchema |
| Tool call | tool_calls, arguments as a string | function_call item | tool_use block, input object | functionCall part, args object |
| Tool result | tool message | function_call_output item | tool_result block in a user turn | functionResponse part in a user turn |
| Force a tool call | tool_choice: "required" | tool_choice: "required" | tool_choice: {"type": "any"} | functionCallingConfig.mode: "ANY" |
| JSON schema output | response_format.json_schema | text.format | output_config.format | responseMimeType + responseJsonSchema |
| Output limit | max_completion_tokens | max_output_tokens | max_tokens (required) | generationConfig.maxOutputTokens |
| Stop sequences | stop (up to 4) | None | stop_sequences | stopSequences (up to 5) |
| Field | What happens |
|---|---|
Anthropic cache_control | Removed with a warning: OpenAI and Gemini set up prompt caching differently. |
Gemini safetySettings, cachedContent | Removed with a warning: the other APIs have nothing to map them to. |
OpenAI logprobs, seed, penalties, n | Carried to Gemini, which has all four; listed as dropped for Anthropic. |
logit_bias | Dropped: it uses token IDs from OpenAI’s tokenizer. |
Reasoning (thinking, reasoning_effort, thought parts) | Dropped: signed reasoning can’t be replayed to another provider, and effort levels don’t line up. |
previous_response_id | Flagged as an error: the earlier turns live on OpenAI’s servers, not in the request. |
| Files, audio, PDFs, built-in tools | Dropped with a warning; attach them again in the target API’s own format. |
FAQ
Frequently asked questions
How do I convert OpenAI messages to Anthropic format?
Move every system or developer message into the top-level system field, add the required max_tokens, and rename each tool’s parameters to input_schema. Turn tool_calls into tool_use blocks with the arguments parsed into an object, and put every tool message into one user turn as tool_result blocks, before any text. Split data: image URLs into media type and base64. The converter above does all of this for you.
What doesn’t convert between OpenAI, Anthropic and Gemini?
Anything provider-specific: Anthropic cache_control breakpoints, Gemini safetySettings and cachedContent, OpenAI logit_bias and stored conversations (previous_response_id), reasoning blocks and signatures, file IDs, audio and built-in tools such as web search. The converter lists each one it finds, with the path in your input, so nothing disappears without you knowing.
Why does the Gemini output contain skip_thought_signature_validator?
Gemini 3 rejects a function call in the history unless it carries the thought signature Gemini attached when it made the call. Calls converted from OpenAI or Anthropic never had one, so Google documents this placeholder value for calls another model made. The converter puts it on the first function call in each model turn, which is where Gemini expects a signature for parallel calls.
Why does Anthropic reject the temperature after I convert?
Anthropic has deprecated its sampling settings. Its API reference says models released after Claude Opus 4.6 reject a temperature other than 1.0, a top_p below 0.99 and any top_k. The converter still writes them, capped to Anthropic’s 0 to 1 range, because older Claude models accept them, and warns you. Remove them for current models.
Can I call Claude with the OpenAI SDK?
Yes, for testing. Anthropic offers an OpenAI SDK compatibility layer: set the base URL to https://api.anthropic.com/v1/, use a Claude API key and a Claude model name. Anthropic says it is mainly for testing and comparing models, not a long-term production solution, and several features are ignored, including strict tool schemas, response_format and prompt caching. For production, convert to the Messages API.
Should I convert requests or use an OpenAI-compatible endpoint?
Both providers offer OpenAI-compatible endpoints: Anthropic’s at https://api.anthropic.com/v1/ and Google’s at https://generativelanguage.googleapis.com/v1beta/openai/. They’re quick for trying a model, but Anthropic describes its layer as mainly for testing and comparing models, and it ignores strict on tools. Native formats give you every feature, which is why converting is worth doing for production code.
Is my request sent anywhere?
No. The conversion is plain JavaScript running in your browser; nothing you paste, including API keys or customer data inside the messages, is uploaded or stored. You can use the page offline once it has loaded. The converter never calls any provider’s API: it only rewrites the JSON.
Related
Related tools
- JSON RepairFix broken JSON from LLM output.
- Prompt BuilderBuild prompts with variables and a live token count.
- Model ID ReferenceCopy current API model IDs for Claude, GPT, Gemini and more.
- JSONL Validator and CSV to JSONLCheck fine-tuning JSONL files and convert CSV to JSONL.
- AI Token CounterCount tokens for GPT, Claude, Gemini, DeepSeek, Qwen and more.
- API Key CheckerCheck whether an API key works, without storing it.