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."
}
OpenAI
  • system role inline in messages
  • tool_calls on assistant
  • role:'tool' for results
  • image_url content blocks
Anthropic
  • system at top level
  • content blocks: text/image/tool_use/tool_result
  • tool_result inside user message
  • base64 or url image source
Gemini
  • systemInstruction.parts
  • role 'model' for assistant
  • functionCall / functionResponse parts
  • inlineData for base64 images
Mistral
  • 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. 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. 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. 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. 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.

Frequently Asked Questions

Which message formats does it support?
OpenAI Chat Completions, Anthropic Messages, Google Gemini generateContent, and Mistral chat. Conversions are bidirectional, so any source maps to any target via a shared internal representation.
How are tool calls handled?
OpenAI tool_calls and tool messages, Anthropic tool_use and tool_result blocks, and Gemini functionCall and functionResponse parts all map to a unified tool-use representation, then re-emit in whichever shape the target format expects.
What about images and other content blocks?
Image content is preserved as URL or base64 references. Conversion notes flag cases where a target format expects a different media wrapper, such as Anthropic source.type vs Gemini inlineData.
Does it send my data to a server?
No. JSON parsing, normalization, and re-emission all happen client-side in your browser. Your request bodies never leave the page.
Can I round-trip a payload?
Yes. Convert OpenAI to Anthropic, swap with the toggle, and convert back. Lossless for text and tool calls; image source kinds may need manual review when crossing inline-data boundaries.