Skip to content
cosmodev ~/tools/chat-format-converter

Chat Format Converter

AI & Agents

Convert chat transcripts between OpenAI messages[], Anthropic system+messages, Gemini contents[], and plain Markdown. Roles map faithfully, tool calls are preserved where possible, and anything unmappable is flagged — never dropped silently. Runs entirely in your browser.

Output
Paste a transcript to convert it.

What it does

The Chat Format Converter turns one chat transcript into another provider’s shape: OpenAI messages[], Anthropic messages[] with a top-level system, Gemini contents[] (where the assistant is model), or a plain Markdown transcript. Paste a transcript, pick the source and target formats, and get the equivalent payload ready for the other API. Everything runs 100% client-side — nothing you paste is ever sent to a server, so it is safe for real logs and payloads.

Conversion goes through a shared internal message list, so roles map faithfully (system becomes Anthropic’s top-level system and Gemini’s systemInstruction; Gemini’s model becomes assistant) and tool calls, tool results, and their correlation ids are preserved across formats. Fields a target format cannot represent (tool calls in Markdown, per-message names in Anthropic/Gemini) are flagged as warnings instead of being dropped silently, and an OpenAI → OpenAI round trip is lossless.

How to use it

  1. Paste your transcript into the Transcript box (or hit Sample to load a demo conversation).
  2. Pick the source format under From and the target under To — or press the swap button between them to reverse the direction.
  3. Read the converted transcript in Output; press Copy output to copy it.
  4. Check Warnings (shown only when present) for anything that could not be mapped, such as tool calls on the way to Markdown.
  5. Copy share link encodes the transcript and both formats in the URL, so a link reproduces the exact conversion.

Examples

OpenAI → Anthropic (system moves to the top level)

Input:

{
  "messages": [
    { "role": "system", "content": "You are terse." },
    { "role": "user", "content": "Hi" },
    { "role": "assistant", "content": "Hello." }
  ]
}

Output:

{
  "system": "You are terse.",
  "messages": [
    { "role": "user", "content": "Hi" },
    { "role": "assistant", "content": "Hello." }
  ]
}

OpenAI → Gemini (assistant becomes model, system becomes systemInstruction)

Output:

{
  "systemInstruction": { "parts": [{ "text": "You are terse." }] },
  "contents": [
    { "role": "user", "parts": [{ "text": "Hi" }] },
    { "role": "model", "parts": [{ "text": "Hello." }] }
  ]
}

OpenAI → Markdown (a tool-using turn — tool calls are flagged, not lost)

An assistant message carrying tool_calls converts to **assistant**: / **tool**: blocks and reports message 0: tool calls are not representable in Markdown and were dropped so you know exactly what did not survive the trip.

Good to know

  • Tool plumbing survives JSON formats: OpenAI tool_calls ↔ Anthropic tool_use/tool_result blocks ↔ Gemini functionCall/functionResponse parts, with ids (or Gemini names) kept as the correlation key.
  • Lossless same-format round trip: converting OpenAI → OpenAI parses into the internal shape and back without changing string-content messages.
  • Shareable: the transcript and both formats are encoded in the URL (?t=…&from=…&to=…).
  • Private: all parsing happens locally — safe for real logs, prompts, and credentials.
  • Related tools: Token Estimator, LLM Cost Calculator, JSON Formatter.
Source code14 languages

100% client-side · your data never leaves your browser. Found this useful? Share it with a teammate.