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

Konverterare för chattformat

AI & Agents

Konvertera chatttranskriptioner mellan OpenAI messages[], Anthropic system+messages, Gemini contents[] och vanlig Markdown. Roller mappas troget, tool-anrop bevaras där det är möjligt och allt som inte kan mappas flaggas — det slängs aldrig i tysthet. Körs helt i webbläsaren.

Utdata
Klistra in en transkription för att konvertera den.

(Dokumentation på engelska)

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.
Källkod14 språk

100% på klientsidan · dina data lämnar aldrig din webbläsare. Hittade du detta användbart? Dela det med en kollega.