Skip to content
AI Skills Central

Type to search Agent Skills, workflows, tutorials, tools and the glossary.

Cheat sheet

LLM API parameters cheat sheet

Temperature, top_p, max tokens, stop, seed, logprobs, JSON output and reasoning effort, with exact names for OpenAI, Claude and Gemini, checked on the API docs.

By Checked Intermediate
Bookmark

Bookmarks are kept in your free account, so you can find this page again on any device.

Sign in to bookmark
On this page

LLM API parameters with their exact names in OpenAI’s Responses and Chat Completions APIs, Claude’s Messages API and Gemini’s generateContent, checked on 21 November 2026. Current reasoning models drop the sampling knobs: Claude rejects them, OpenAI’s newest models do not support them and recent Gemini models ignore them. Set the output limit, output format and reasoning effort instead.

Which parameter to reach for

You want Set this Not this
Shorter or capped answers The max output tokens parameter, plus a length instruction in the prompt A lower temperature
Valid JSON every time The structured output schema (see below) JSON mode or “reply in JSON” alone
Faster, cheaper answers from a reasoning model Lower reasoning effort or thinking level temperature: 0
More consistent answers on an older or non-reasoning model temperature or top_p, not both (OpenAI’s advice) Both at once
Output that ends at a marker Stop sequences Trimming the text afterwards
Repeatable runs for tests seed where it exists, and a fixed eval set Expecting identical output (OpenAI says determinism is not guaranteed)

Parameter names by provider

Parameter OpenAI Responses OpenAI Chat Completions Claude Messages Gemini generationConfig
Temperature temperature temperature Removed in API version 2026-10-21 temperature
Nucleus sampling top_p top_p Removed in 2026-10-21 topP
Top-k Not available Not available Removed in 2026-10-21 topK
Output limit max_output_tokens max_completion_tokens (max_tokens is deprecated) max_tokens (required) maxOutputTokens
Stop sequences Not available stop stop_sequences stopSequences
Seed Not available seed (beta) Not available seed
Frequency and presence penalty Not available frequency_penalty, presence_penalty Not available frequencyPenalty, presencePenalty
Log probabilities top_logprobs plus include: ["message.output_text.logprobs"] logprobs, top_logprobs Not available responseLogprobs, logprobs
Several answers per request Not available n Not available candidateCount
Structured output text.format with type: "json_schema" response_format with type: "json_schema" output_config.format with type: "json_schema" responseMimeType: "application/json" plus responseJsonSchema
Reasoning depth reasoning.effort reasoning_effort output_config.effort and thinking thinkingConfig.thinkingLevel or thinkingBudget
Answer length style text.verbosity verbosity Not available Not available

“Not available” means the parameter is not in that endpoint’s request body in the API reference on the verification date.

Ranges and defaults

Parameter Range Default Source note
OpenAI temperature 0 to 2 1 Responses and Chat Completions
OpenAI top_p 0 to 1 1 0.1 means only the top 10% probability mass
OpenAI max_output_tokens Minimum 16 None stated Counts visible output and reasoning tokens
OpenAI max_completion_tokens None stated None stated Counts visible output and reasoning tokens
OpenAI stop 1 to 4 sequences None Not supported with o3 and o4-mini; the stop text is not returned
OpenAI frequency_penalty, presence_penalty -2 to 2 0 Chat Completions only
OpenAI n 1 to 128 1 Newer models reject an explicit n, even n=1
OpenAI top_logprobs 0 to 20 None Chat Completions needs logprobs: true
OpenAI reasoning.effort / reasoning_effort none, minimal, low, medium, high, xhigh, max medium Not every model supports every value
OpenAI verbosity low, medium, high medium
Claude max_tokens Minimum 0; maximum varies by model Required 0 warms the prompt cache without generating
Claude thinking.budget_tokens At least 1,024 and below max_tokens None Only with thinking: {type: "enabled"}; thinking tokens count toward max_tokens
Claude output_config.effort low, medium, high, xhigh, max None stated
Gemini temperature 0.0 to 2.0 Varies by model (Model.temperature) Ignored on Gemini 3.6 Flash and newer
Gemini topP, topK None stated Varies by model Ignored on Gemini 3.6 Flash and newer
Gemini maxOutputTokens None stated Varies by model (Model.output_token_limit)
Gemini stopSequences Up to 5 None The stop text is not returned
Gemini candidateCount None stated 1
Gemini seed Integer Random if unset
Gemini logprobs 0 to 20 None Only with responseLogprobs: true
Gemini thinkingLevel MINIMAL, LOW, MEDIUM, HIGH, XHIGH Depends on the model Gemini 3 or later; earlier models return an error

What reasoning models change

Provider What happens to sampling parameters What to set instead
Claude API version 2026-10-21 returns a 400 error for temperature, top_p or top_k, even at default values. On 2023-06-01, Claude 4.7 and later models return a 400 error for non-default values. Remove them; requests then sample with the defaults (temperature 1.0). Use output_config.effort and the prompt.
Claude Manual thinking (type: "enabled" with budget_tokens) returns a 400 error on some newer models, such as Claude Sonnet 5. thinking: {type: "adaptive"} and output_config.effort
OpenAI For GPT-6.2 Astra and Sol, the docs list temperature, top_p, logprobs and top_logprobs as unsupported. reasoning.effort (start at medium; use low where you used none or minimal)
Gemini temperature, topP and topK are silently ignored on Gemini 3.6 Flash and newer. thinkingConfig.thinkingLevel

The Claude change is the one that breaks code: the Python SDK 2.0.0 and TypeScript SDK 1.0.0 send 2026-10-21 by default and no longer have the three parameters.

Structured output switches

// OpenAI Responses API
{ "text": { "format": { "type": "json_schema", "name": "ticket", "schema": { "type": "object" }, "strict": true } } }

// OpenAI Chat Completions
{ "response_format": { "type": "json_schema", "json_schema": { "name": "ticket", "schema": { "type": "object" }, "strict": true } } }

// Claude Messages API
{ "output_config": { "format": { "type": "json_schema", "schema": { "type": "object" } } } }

// Gemini generateContent
{ "generationConfig": { "responseMimeType": "application/json", "responseJsonSchema": { "type": "object" } } }

Replace { "type": "object" } with your full schema. OpenAI still accepts { "type": "json_object" } (JSON mode), which only promises valid JSON, not your schema; the reference recommends json_schema for models that support it.

Common mistakes

Mistake Fix
Sending temperature: 0 to Claude after upgrading the SDK Remove temperature, top_p and top_k; steer with the prompt and output_config.effort
Assuming Gemini honoured your temperature On Gemini 3.6 Flash and newer it is ignored without an error; use thinkingLevel
Setting both temperature and top_p Change one; OpenAI recommends altering one but not both
Using max_tokens on OpenAI reasoning models Use max_completion_tokens (Chat Completions) or max_output_tokens (Responses)
An output cap that leaves no room for the answer OpenAI and Claude output limits include reasoning or thinking tokens; raise the cap or lower effort
Relying on seed for identical output OpenAI calls it best effort; watch system_fingerprint, and test with an eval set
Sending n=1 to a newer OpenAI model Omit n; newer models reject it even at 1
stop on o3 or o4-mini Not supported there; end the output with a format instead

Check what a model accepts

Send one minimal request with only the model, the input and the output limit, then add parameters one at a time, so a 400 error points at the one you just added. Gemini ignores some fields silently, so read the model’s defaults with GET /v1beta/models/{model} (temperature, topP, topK, outputTokenLimit).

Why output limits and effort move your bill: the LLM cost levers cheat sheet. Schemas in depth: the structured outputs tutorial.

Check your understanding

LLM API parameters quiz

Parameter names across OpenAI, Claude and Gemini, output limits, stop sequences, seed, structured output and what reasoning models change.

8 questions · pass mark 70%

Question 1 of 80 answered
  1. You need valid JSON matching your schema on every call. What should you set?

Checked against

  • Temperature

    A sampling setting that controls randomness: lower values favour the most likely tokens, higher values spread probability more evenly.

    Glossary

  • Top-p

    A sampling setting that restricts the model to the smallest set of likely tokens whose probabilities add up to p, then samples from that set.

    Glossary

  • Reasoning effort

    An API setting that controls how much a reasoning model thinks before answering, trading cost and latency against accuracy.

    Glossary

  • Get reliable JSON from an LLM with structured outputs

    Describe the output as a schema, let the provider enforce it, validate it with Pydantic AI or the AI SDK, and handle failures.

    TutorialBeginner30 min

  • LLM cost levers cheat sheet

    The main ways to cut model spend, ordered by effort, with what each saves, what it risks and how to check quality held. Checked against provider docs.

    Cheat sheetIntermediate

Back to top