M
MafLabs
Developer Tool 100% Client-Side

LLM API Request Converter: OpenAI, Claude and Gemini

Convert payloads across LLM formats with lossy schema mismatch detection. Zero telemetry, entirely in your browser.

Inspection: 0 Lossy 0 Schema Maps
No warnings. Payload transforms losslessly.
INPUT PAYLOAD JSON
287 chars • 14 lines Valid JSON
TARGET OUTPUT Claude 3.5
Code Export:
0 chars • 0 lines Ready to execute

Snippet Preview

Copy this ready-to-run template into your terminal or application:

Multi-Model Protocol Layer

Modern generative AI applications rarely depend on a single model vendor. As teams benchmark latency, quality, and cost across providers, switching from OpenAI's Chat Completions API to Anthropic's Messages API or Google's Gemini REST API often reveals subtle schema incompatibilities. The LLM API Request Converter provides a client-side AST engine that parses requests into a neutral representation and emits clean payloads matching the official specification for each provider.

How to Convert API Payloads

  1. Paste your Source JSON: Paste an OpenAI chat/completions, Anthropic /v1/messages, or Google Gemini generateContent payload into the left editor.
  2. Select Target Format: Choose your target provider from the dropdown. The engine detects the input dialect automatically or accepts manual selection.
  3. Review Warnings & Export: Inspect any lossy warnings (such as unsupported frequency penalties or role merges) and export converted JSON or copy cURL, Node.js fetch, or Python code.

Format Differences At A Glance

OpenAI Chat Format

/v1/chat/completions

Encapsulates all roles (system, developer, user, assistant, tool) inside a single ordered messages array. Function tools are declared with parameters.

Anthropic Claude

/v1/messages

Requires max_tokens as a mandatory integer. System instructions must live in a top-level string system parameter, not in the messages list. Alternating turn constraints are strictly enforced.

Google Gemini

generateContent

Uses contents where turns contain parts: [{ text: "..." }] and roles are user or model. System prompts live under systemInstruction, and hyper-parameters are under generationConfig.

Common Lossy Mappings & Gotchas

Frequently Asked Questions

How do I switch from OpenAI to Claude in code?

Extract any system messages from your messages array into Anthropic's top-level system parameter, ensure max_tokens is explicitly specified, format multi-modal content parts with image source objects, and point your client endpoint to /v1/messages.

What differs between OpenAI, Claude, and Gemini formats?

The major differences include role naming (assistant vs model), system prompt placement (messages array vs root field vs systemInstruction), function/tool declarations (parameters vs input_schema vs functionDeclarations), and multi-turn turn alternating rules.

Why is the model name not blindly translated?

Models feature distinct context windows, capabilities, and pricing. When converting from GPT-4o, the tool sets industry equivalents like claude-3-5-sonnet-20241022 or gemini-1.5-pro, but keeps the field editable so you maintain complete control.

Is my request or API key uploaded to any server?

Never. Parsing, AST transformation, and diff analysis execute in-memory inside your local web browser engine. You can inspect your browser's Network tab or run this utility offline with zero network requests dispatched.

Can I convert tool/function calling schemas?

Yes. Toggle to the 'Tools only' tab or include tools within your input payload. The converter maps JSON Schema objects to Claude's tool array or Gemini's function declarations seamlessly.

Related Free Tools Built by MafLabs