Chat Format Converter
Chat Format Converter
Translate chat-completion JSON between OpenAI, Anthropic, Gemini, and Mistral with role and tool-use remapping.
{
"messages": [
{
"role": "user",
"content": [
{
"type": "text",
"text": "What's the weather in Paris?"
}
]
},
{
"role": "assistant",
"content": [
{
"type": "tool_use",
"id": "call_1",
"name": "get_weather",
"input": {
"city": "Paris"
}
}
]
},
{
"role": "user",
"content": [
{
"type": "tool_result",
"tool_use_id": "call_1",
"content": "18C, partly cloudy"
}
]
},
{
"role": "assistant",
"content": [
{
"type": "text",
"text": "It's 18 degrees and partly cloudy in Paris."
}
]
}
],
"system": "You are a helpful assistant."
}- • system role inline in messages
- • tool_calls on assistant
- • role:'tool' for results
- • image_url content blocks
- • system at top level
- • content blocks: text/image/tool_use/tool_result
- • tool_result inside user message
- • base64 or url image source
- • systemInstruction.parts
- • role 'model' for assistant
- • functionCall / functionResponse parts
- • inlineData for base64 images
- • OpenAI-compatible shape
- • tool_calls on assistant
- • role:'tool' messages
- • name field on tool messages
What This Tool Does
Chat Format Converter is built for deterministic developer and agent workflows.
Convert chat-completion JSON between OpenAI, Anthropic, Gemini, and Mistral with role and tool-use remapping plus image-content handling notes.
Use How to Use for execution steps and FAQ for constraints, policies, and edge cases.
Last updated:
This tool is provided as-is for convenience. Output should be verified before use in any production or critical context.
Agent Invocation
Best Path For Builders
Browser workflow
Runs instantly in the browser with private local processing and copy/export-ready output.
Browser Workflow
This tool is optimized for instant in-browser execution with local data handling. Run it here and copy/export the output directly.
/chat-format-converter/
For automation planning, fetch the canonical contract at /api/tool/chat-format-converter.json.
How to Use Chat Format Converter
- 1
Pick source and target formats
Set the From and To dropdowns to the formats you are translating between. The converter handles OpenAI Chat Completions, Anthropic Messages, Google Gemini, and Mistral in any direction.
- 2
Paste a request body
Drop your existing JSON request — including system prompts, tool calls, tool results, and image content — into the input pane. Load sample fills a representative example for the selected source format.
- 3
Read the converted output
The output pane shows the equivalent request shaped for the target provider. Tool calls become tool_use blocks for Anthropic or functionCall parts for Gemini; tool results route to the format each provider expects.
- 4
Check the conversion notes
Notes call out cases like Anthropic embedding tool_result inside a user message, Gemini using role 'model' for assistant, or images downgraded to URL-only references. Apply these notes when adapting your client code.