Gemini to Anthropic API Converter
Paste a Google Gemini generateContent request or response and get the equivalent Anthropic Messages JSON — systemInstruction, functionCall, finishReason and usageMetadatamapped field by field into Claude's system / messages / content-block shape. Runs entirely in your browser: no key, no upload, no signup.
How it works
The converter is a deterministic transformation of a published schema — there is no model call. It reads your Gemini generateContent payload, applies a fixed set of rules transcribed from the official Google and Anthropic API references, and emits the equivalent Anthropic Messages JSON. Every rule is a static mapping, so the same input always produces the same output, and three worked examples are reconciled field-by-field on every load.
Requests are rebuilt turn by turn:
- System prompt. The top-level
systemInstruction.parts[].textis hoisted into Anthropic's top-levelsystemstring. Unlike OpenAI, Claude keeps the system prompt outside the messages array. - contents → messages. Order is preserved.
role:"model"becomesassistant;userstaysuser. Every message'scontentis an array of blocks: a text part becomes{type:"text"}and aninlineDatapart becomes{type:"image",source:{type:"base64"}}. - functionCall → tool_use. A model
functionCall{name,args}becomes an assistant{type:"tool_use",id,name,input}block. Theargsobject stays a JSON object ininput— Claude does not stringify arguments. Gemini calls carry no id, so a stabletoolu_0,toolu_1… is synthesized in order. - functionResponse → tool_result. A user-turn
functionResponse{name,response}becomes a{type:"tool_result",tool_use_id,content}block inside a user message, linked back to the matching synthesizedtool_useid. - tools & toolConfig.
tools[].functionDeclarations[]becomestools[]withparametersmoved toinput_schema(upper-caseTypeenums likeSTRINGare lower-cased to JSON Schema).functionCallingConfig.mode:AUTO→{type:"auto"},ANY→{type:"any"}(or{type:"tool",name}for one allowed function),NONE→{type:"none"}. - generationConfig.
maxOutputTokens→max_tokens(injected from the fallback box when absent, because Anthropic requires it),temperature→temperature(clamped to 1.0, Anthropic's maximum),topP→top_p,topK→top_k(1:1 — Claude supports top-k, unlike OpenAI), andstopSequences→stop_sequences.
Responses wrap candidates[0] into a Messages object: {type:"message",role:"assistant",content,stop_reason,stop_sequence,usage}. Part text becomes {type:"text"} blocks, functionCall parts become tool_use blocks, and finishReason maps to stop_reason (STOP→end_turn, MAX_TOKENS→max_tokens; forced tool_use when a tool_use block is present; SAFETY/RECITATION→end_turn, flagged). usageMetadata maps to usage — promptTokenCount→input_tokens, candidatesTokenCount→output_tokens. Fields with no clean target — totalTokenCount, responseSchema, safetySettings, extra candidates, cachedContent — are listed in the notes panel, never silently dropped.
Worked examples
Frequently asked questions
Sources & references
- Google Gemini API — generateContent reference
- Google Gemini API — function calling (functionCall, functionResponse, functionCallingConfig)
- Anthropic API Reference — Messages
- Anthropic — Tool use (tool_use, tool_result, tool_choice)
The mapping rules were last cross-checked against the official Gemini and Anthropic references on 2026-07-12. This page is reviewed whenever either provider ships a breaking request- or response-schema change.
Related tools
Comments & feedback
Spotted a bug or want an improvement? Tell us — our team reviews every comment, and good ideas get built. Comments are public and anonymous.
Found a field that maps wrong, or want another provider pair added?
Email me at [email protected] — most fixes ship within 24 hours.