Skip to content

Menu

LLM API Parameters Cheat Sheet: Claude Messages API vs OpenAI Responses API

Checked against Claude API and OpenAI API Claude API version header 2026-10-21; OpenAI Responses API docs as read on 2026-11-28 on 28 November 2026. Each section links to the official docs it was checked against.

This sheet puts the request fields of the Anthropic Messages API and the OpenAI Responses API next to each other, for developers who call both or are porting code between them. It follows platform.claude.com (API version 2026-10-21) and developers.openai.com as they read on 28 November 2026. We had no API keys in the test shell, so every row is from the docs and marked untested.

When to use what

The two APIs look alike but differ in a few places that cause most porting bugs. Claude takes the system prompt in a top-level system field and requires max_tokens; OpenAI's Responses API takes instructions and an optional max_output_tokens. Tool definitions use input_schema on Claude and parameters on OpenAI, and the tool result goes back as a tool_result content block on Claude versus a function_call_output item on OpenAI.

Sampling is the newest trap. Claude API version 2026-10-21 removed temperature, top_p and top_k: sending any of them, even at the default, returns a 400. OpenAI's Responses reference still lists temperature (0 to 2, default 1) and top_p. If you share one request builder between providers, strip those fields for Claude.

For cost, both providers charge half price for batch jobs, and both cache repeated prompt prefixes. Claude caching is opt-in with cache_control, up to 4 breakpoints and a 5-minute or 1-hour lifetime. OpenAI caches automatically from 1,024 tokens on GPT-5.6 and later, with a 30-minute default. Our prompt caching post explains the idea, the cache breakpoint planner helps you place Claude breakpoints, and the OpenAI batch JSONL builder writes batch input files. For prices, see our LLM API pricing comparison and the providers' own pages; this sheet does not rank models.

OpenAI's list is at https://developers.openai.com/api/docs/models. Model IDs change often; copy them from the provider's page, not from blog posts.

POST https://api.anthropic.com/v1/messages

Claude: create a message; send x-api-key and anthropic-version: 2026-10-21 headers

From the docs, not run by us
POST https://api.openai.com/v1/responses

OpenAI: create a response with the Responses API; Chat Completions at /v1/chat/completions is still supported

From the docs, not run by us
claude-opus-5-5 / claude-sonnet-5-5 / claude-haiku-5-5 / claude-fable-5-2

Current Claude API model IDs as listed on the models overview page

From the docs, not run by us
gpt-6.2-astra / gpt-6.2-sol / gpt-6-luna

Model IDs OpenAI's models page suggests starting with

From the docs, not run by us
anthropic-version: 2026-10-21

Claude API version header; SDKs set it for you based on their major version

From the docs, not run by us

OpenAI fields are from the Responses create reference: https://developers.openai.com/api/reference/resources/responses/methods/create

"max_tokens": 1024

Claude: required ceiling on output tokens; set 0 to only warm the prompt cache

Try it: Token CounterFrom the docs, not run by us
"max_output_tokens": 1024

OpenAI: optional ceiling on output tokens, reasoning tokens included

Try it: Token CounterFrom the docs, not run by us
"system": "You are a terse reviewer."

Claude: system prompt as a top-level string or array of text blocks, not a message

From the docs, not run by us
"instructions": "You are a terse reviewer."

OpenAI Responses: the system or developer instructions for this response

From the docs, not run by us
"temperature": 0.2

OpenAI: sampling temperature from 0 to 2, default 1; change this or top_p, not both. Claude 2026-10-21 rejects it

From the docs, not run by us
"stop_sequences": ["###"]

Claude: stop when a custom string appears; the response stop_reason is then stop_sequence

From the docs, not run by us
"stream": true

Both: stream the reply as server-sent events instead of one JSON body

From the docs, not run by us

OpenAI's events are documented at https://developers.openai.com/api/docs/guides/streaming-responses

message_start, content_block_start, content_block_delta, content_block_stop, message_delta, message_stop

Claude SSE event names in the order a normal reply produces them

From the docs, not run by us
ping / error

Claude: keep-alive and error events can arrive mid-stream; handle both

From the docs, not run by us
response.created, response.output_text.delta, response.completed

OpenAI Responses SSE events for start, each text chunk and the end

From the docs, not run by us
client.messages.stream(...)

Claude SDK helper that sets stream and builds the final message from the events

From the docs, not run by us

OpenAI function calling: https://developers.openai.com/api/docs/guides/function-calling

{"name": "get_weather", "description": "...", "input_schema": {"type": "object", ...}}

Claude tool definition in the tools array

Try it: function-calling-builderFrom the docs, not run by us
{"type": "function", "name": "get_weather", "parameters": {...}, "strict": true}

OpenAI function tool definition; strict enforces the schema

Try it: function-calling-builderFrom the docs, not run by us
{"type": "tool_result", "tool_use_id": "...", "content": "..."}

Claude: send a tool's output back in the next user message, matched by tool_use_id

From the docs, not run by us
{"type": "function_call_output", "call_id": "...", "output": "..."}

OpenAI: send a function's output back as an input item, matched by call_id

From the docs, not run by us
"tool_choice": {"type": "auto" | "any" | "tool" | "none"}

Claude: let the model choose, force some tool, force a named tool, or forbid tools

From the docs, not run by us
"disable_parallel_tool_use": true

Claude: inside tool_choice, limit the model to one tool call per turn

From the docs, not run by us
"parallel_tool_calls": false

OpenAI: turn off parallel function calls (default true)

From the docs, not run by us

OpenAI guide: https://developers.openai.com/api/docs/guides/structured-outputs

"output_config": {"format": {"type": "json_schema", "schema": {...}}}

Claude: make the text reply follow a JSON Schema

Try it: structured-output-designerFrom the docs, not run by us
"strict": true (on a Claude tool)

Claude: guarantee tool names and inputs match the schema

From the docs, not run by us
"text": {"format": {"type": "json_schema", "strict": true, "schema": {...}}}

OpenAI Responses: structured output with schema enforcement

Try it: Structured Output Schema CheckerFrom the docs, not run by us
"response_format": {"type": "json_schema", ...}

OpenAI Chat Completions spelling of the same feature

From the docs, not run by us

OpenAI guide: https://developers.openai.com/api/docs/guides/prompt-caching

"cache_control": {"type": "ephemeral"}

Claude: top level for automatic caching, or on a block to set a breakpoint; 5-minute lifetime by default

Try it: Prompt Cache Breakpoint PlannerFrom the docs, not run by us
"cache_control": {"type": "ephemeral", "ttl": "1h"}

Claude: one-hour cache lifetime; writes cost 2x base input instead of 1.25x

Try it: Prompt Cache Breakpoint PlannerFrom the docs, not run by us
up to 4 breakpoints, 512-token minimum on current models

Claude limits; shorter prefixes are silently not cached, so check cache_creation_input_tokens

From the docs, not run by us
usage.cache_read_input_tokens / usage.cache_creation_input_tokens

Claude usage fields that show cache reads and writes for the request

From the docs, not run by us
"prompt_cache_options": {"ttl": "12h"}

OpenAI GPT-5.6 and later: keep the cache at least 12 hours (writes 2.5x); default is "30m"

From the docs, not run by us
"prompt_cache_key": "tenant-42"

OpenAI: separate cache accounting per customer; not needed for routing on GPT-5.6 and later

From the docs, not run by us
"prompt_cache_retention": "24h"

OpenAI models before GPT-5.6: extended retention instead of in_memory

From the docs, not run by us

OpenAI Batch guide: https://developers.openai.com/api/docs/guides/batch. Both batch APIs cost 50% of the standard rate.

POST https://api.anthropic.com/v1/messages/batches

Claude: submit up to 100,000 requests or 256 MB; results within 24 hours, most within an hour

From the docs, not run by us
GET /v1/messages/batches/{id}/results

Claude: download results once the batch has ended

From the docs, not run by us
{"custom_id": "request-1", "method": "POST", "url": "/v1/responses", "body": {...}}

OpenAI: one line of the batch input JSONL; custom_id must be unique

Try it: OpenAI Batch JSONL BuilderFrom the docs, not run by us
purpose="batch"

OpenAI: upload the JSONL through the Files API with this purpose; keep it under 200 MB

From the docs, not run by us
POST /v1/batches {"input_file_id": "file-abc123", "endpoint": "/v1/responses", "completion_window": "24h"}

OpenAI: start the batch; 24h is the completion window

From the docs, not run by us

OpenAI headers: https://developers.openai.com/api/docs/guides/rate-limits

retry-after

Claude: seconds to wait before retrying a 429; the spend-cap 429 never includes it

Try it: rate-limit-calculatorFrom the docs, not run by us
anthropic-ratelimit-requests-remaining / -reset

Claude: requests left in the window and when it refills (RFC 3339 time)

From the docs, not run by us
anthropic-ratelimit-input-tokens-remaining / anthropic-ratelimit-output-tokens-remaining

Claude: input and output tokens left, rounded to the nearest thousand

From the docs, not run by us
x-ratelimit-remaining-requests / x-ratelimit-remaining-tokens

OpenAI: requests and tokens left before you hit the limit

From the docs, not run by us
x-ratelimit-reset-requests / x-ratelimit-reset-tokens

OpenAI: time until the limit resets, as a duration like 1s or 6m0s

From the docs, not run by us

Worked example: Port one tool-calling request from OpenAI to Claude

Say your OpenAI code sends this to /v1/responses:

{"model": "gpt-6.2-sol",
 "instructions": "Answer with the tool when you can.",
 "input": "Weather in Lisbon?",
 "temperature": 0.2,
 "tools": [{"type": "function", "name": "get_weather",
            "parameters": {"type": "object", "properties": {"location": {"type": "string"}}, "required": ["location"]}}]}

The Claude version for /v1/messages with anthropic-version: 2026-10-21 changes five things:

{"model": "claude-sonnet-5-5",
 "max_tokens": 1024,
 "system": "Answer with the tool when you can.",
 "messages": [{"role": "user", "content": "Weather in Lisbon?"}],
 "tools": [{"name": "get_weather",
            "input_schema": {"type": "object", "properties": {"location": {"type": "string"}}, "required": ["location"]}}]}

instructions became system. The input string became a messages array. max_tokens was added because Claude requires it. The tool lost its type wrapper and parameters became input_schema. And temperature is gone, because this API version answers it with a 400. When Claude decides to call the tool, the reply has a tool_use block with an id; you run the function and send back a user message containing a tool_result block whose tool_use_id matches. On OpenAI the same step is a function_call_output item keyed by call_id. We did not run these requests, so check the reply shapes against the docs linked in each section.

Common mistakes

  • Keeping temperature or top_p in a shared request builder after moving to Claude API version 2026-10-21.

    Strip temperature, top_p and top_k for Claude requests; they return a 400 on every model in that version, even at default values.

  • Leaving out max_tokens on Claude because OpenAI treats the output cap as optional.

    Always send max_tokens to the Messages API. Size it with the model's max output in mind, and remember thinking tokens count toward it.

  • Marking a short prompt with cache_control and assuming it is cached.

    Below the model's minimum (512 tokens on current Claude models), the request runs uncached with no error. Check that cache_creation_input_tokens or cache_read_input_tokens is above zero.

  • Copying OpenAI's parameters key into a Claude tool, or Claude's input_schema into an OpenAI function.

    Claude tools use input_schema; OpenAI function tools use type: "function" plus parameters. A builder like our function-calling tool can emit both.

  • Retrying a 429 immediately in a tight loop.

    Wait at least the retry-after seconds on Claude, or read x-ratelimit-reset-* on OpenAI. On Claude's spend-cap 429 there is no retry-after, and retries keep failing until access resumes.

  • Hard-coding a model ID from an old tutorial.

    Copy IDs from the provider's models page and keep them in config. Both providers retire older models on published dates.

Sources

How we research: where our facts come from, how often we re-check them, and why no one can pay for a review or a verdict.

What changed in AI dev tools, once a month

Renames, shutdowns, pricing changes and new MCP setups, each with a source.

Subscribe
Reviews and commentsShow

Comments

Sign in to leave a comment.

Loading comments…