Developer and Text Tools

Switching LLM Providers Without Rewriting Every Request

How chat request bodies differ between OpenAI, Anthropic and Gemini, what gets lost in translation, and how to convert a request safely before you migrate.

Saizul Amin
Saizul Amin3 Nov 2026 · 4 min read
Switching LLM Providers Without Rewriting Every Request

Most teams do not plan to use more than one model provider. Then a price changes, a new model beats the old one on their task, or a customer asks for a different cloud, and suddenly every request body in the codebase has to speak a second dialect. The three big chat APIs look alike from a distance: a list of messages, some settings, maybe a few tools. Up close they disagree on nearly every field name and on several rules that cause hard-to-read errors.

Where the formats really differ

The system prompt is the first surprise. OpenAI treats it as a message with the role system (or developer). Anthropic wants it in a separate top-level field and rejects a system role inside the messages list. Gemini calls it systemInstruction and wraps the text in parts.

Turn order is the second. OpenAI is relaxed about two user messages in a row. Anthropic expects user and assistant turns to alternate, and the first turn must come from the user. Gemini calls the assistant model and also prefers alternating turns.

Tool calling is where most migration bugs live. In OpenAI, an assistant message carries a tool_calls array whose arguments are a JSON string, and each result comes back as its own message with role tool and a tool_call_id. In Anthropic, a call is a tool_use block inside the assistant turn with arguments as a real object, and the result is a tool_result block inside the next user turn. Gemini uses functionCall and functionResponse parts and matches results to calls by function name, because it has no call ids at all.

Settings that do not line up

Temperature runs from 0 to 2 for OpenAI and Gemini but only 0 to 1 for Anthropic, so a creative setting of 1.3 has to be capped. Anthropic requires max_tokens on every request; forget it and the call fails. top_k exists for Anthropic and Gemini but not for OpenAI, while seed, presence and frequency penalties exist for OpenAI and Gemini but not for Anthropic. Stop sequences have different caps. Reasoning controls differ in kind: OpenAI takes an effort level, while Claude and Gemini take a token budget for thinking.

Structured output is another gap. OpenAI has a json_schema response format, Gemini has responseSchema, and with Anthropic the dependable route is a tool whose input schema is the shape you want, forced with tool_choice. Gemini also accepts only a subset of JSON Schema in function parameters, so keywords such as additionalProperties or $ref need to come out.

A safer way to migrate

Start with real requests, not the documentation examples. Log a few of the bodies your app actually sends, including a long conversation with tool calls and one with an image, because those are the cases that break.

Convert each one with the LLM API Request Format Converter. Paste the body, let it detect the source, choose the target and type the model you plan to use. The tool turns the request into a neutral list of turns and writes it in the target format, then lists every compromise it made: a capped temperature, a dropped seed, a schema keyword removed for Gemini, a placeholder user turn added because Anthropic needs one first.

Read those notes as a checklist. Some are harmless, like a user id field with nowhere to go. Others change behaviour, like losing a seed you rely on for repeatable tests, and need a code change rather than a format change.

Then test with the curl view. It reads your key from an environment variable, so the key never touches the page, and you can compare the new provider's answer with the old one on the same conversation.

Keep a neutral layer in your code

Converting by hand once is fine for a spike. For production, the lesson of the converter is to keep your own neutral message format in the app and write small adapters for each provider at the edge. The mapping rules you see in the tool's notes are the ones those adapters must implement: id handling, turn merging, parameter ranges and the fields that simply have no partner.

What a converter cannot do

It cannot make two models behave the same. Prompts tuned for one provider often need edits for another, especially around tool descriptions and output length. It also cannot convert provider extras such as hosted web search, code execution, file references or cache markers. Use the conversion to get a working request quickly, then spend your time on evaluating the answers, which is where migrations succeed or fail.

Completely freeNo cost, no sign-up
Files stay privateEverything runs in your browser
Easy in your languageAvailable in many languages