Anthropic (Claude) to OpenAI API Converter
Paste an Anthropic Messages API request or response and get the equivalent OpenAI Chat Completions JSON — system, tool_use, tool_result, stop_reason and usage remapped field by field. Runs entirely in your browser: no key, no upload, no signup.
How it works
The converter is a deterministic restructuring of a published schema — there is no model call. It reads your Anthropic Messages payload, applies a fixed set of mapping rules transcribed from the official Anthropic and OpenAI API references, and emits the equivalent OpenAI Chat Completions body. Every rule is a static table entry, so the same input always produces the same output, and the result is testable. Two directions are supported: a whole request body, and a whole response body.
Request: Anthropic → OpenAI
- System prompt. Anthropic's top-level
system(a string or an array oftextblocks) becomes a leading{role:"system"}message, because OpenAI has no top-level system field. - Messages & content blocks. Roles pass through. A
textblock collapses to a string (or atextcontent part when mixed with images); animageblock becomes animage_urlpart (base64 sources becomedata:URLs). - Tool calls. An assistant
tool_useblock becomes atool_callsentry. Anthropic'sinputis a JSON object; OpenAI'sargumentsis a JSON string, so the converter runsJSON.stringify(input). - Tool results. A user
tool_resultblock becomes its own{role:"tool", tool_call_id, content}message, placed after the assistant message that made the matching call so the turn order stays valid. - Tools & tool_choice.
tools[].input_schemabecomesfunction.parameters(copied verbatim);{type:auto}→"auto",{type:any}→"required",{type:tool,name}→{type:function,function:{name}}. - Scalars.
max_tokensis carried over (rename tomax_completion_tokensfor o-series / GPT-5 targets via the toggle);stop_sequences→stop;temperature,top_pandstreampass through.
Response: Anthropic → OpenAI
- The message is wrapped as
{id, object:"chat.completion", model, choices:[{index:0, message, finish_reason}], usage}. - stop_reason → finish_reason:
end_turn→stop,max_tokens→length,stop_sequence→stop,tool_use→tool_calls,refusal→content_filter, andpause_turn→stop(flagged approximate). - usage:
input_tokens→prompt_tokens,output_tokens→completion_tokens, andtotal_tokens = input_tokens + output_tokens(OpenAI reports the total; Anthropic does not).
As a credibility check, two worked conversions ship as fixtures and are reconciled against the references on every load, and the response direction carries an independent arithmetic invariant — total_tokens must equal prompt_tokens + completion_tokens, recomputed on a separate code path. Anthropic-only features that have no faithful OpenAI target (thinking, cache_control, service_tier) are listed in the notes rather than silently dropped.
Worked examples
Frequently asked questions
Sources & references
- Anthropic API Reference — Messages (request & response fields)
- Anthropic — Tool use (input_schema, tool_use, tool_result, tool_choice)
- OpenAI API Reference — Chat Completions (messages, tools, finish_reason, usage)
The mapping rules were last cross-checked against the official references on 2026-07-11. This page is reviewed whenever either provider ships a breaking request- or response-schema change.
Related tools
Comments & feedback
Spotted a bug or want an improvement? Tell us — our team reviews every comment, and good ideas get built. Comments are public and anonymous.
Found a field that maps wrong, or want another provider added?
Email me at [email protected] — most fixes ship within 24 hours.