Skip to main content

APIs

Extended thinking

Reasoning models think before they answer. You enable it through the Anthropic-style thinking parameter on the Messages API; the gateway normalizes it to a single effort dial and translates it to whatever provider your model runs on — so the same request gets reasoning out of Claude, GPT, Gemini or Bedrock.

Enable reasoning

Enable reasoning with the thinking parameter. On the response, reasoning arrives as thinking content blocks (before the text blocks), and the reasoning token count is reported in usage.output_tokens_details.

example.ts
import { anthropic } from "./client"; const message = await anthropic.messages.create({ model: "claude-sonnet-5", max_tokens: 4096, // Classic extended thinking with a fixed token budget: thinking: { type: "enabled", budget_tokens: 8192 }, messages: [{ role: "user", content: "Prove there are infinitely many primes." }], }); for (const block of message.content) { if (block.type === "thinking") console.log("[reasoning]", block.thinking); if (block.type === "text") console.log(block.text); }

Newer Claude models also accept the adaptive shape — thinking: { type: "adaptive" } paired with output_config: { effort: "low" | "medium" | "high" } — instead of a fixed budget.

How it converts per provider

The endpoint never talks to a model directly — it hands your Anthropic request to the resolved provider, which translates the reasoning request on the way in and the reasoning output on the way back. Anthropic's two request shapes are first normalized to a single effort dial: adaptive uses output_config.effort (default medium), while enabled buckets budget_tokens into an effort level:

FieldTypeDescription
budget_tokens < 4096→ lowSmallest reasoning effort on the translated providers.
4096 – 16383→ mediumMid reasoning effort.
budget_tokens ≥ 16384→ highHighest reasoning effort on the translated dial.
type: "disabled" / absent→ offNo reasoning is requested from the provider.
ProviderRequest: thinking → upstreamResponse: reasoning → thinking blocks
Anthropic (Claude, direct)Passed through verbatim — thinking, budget_tokens, output_config, signature and redacted_thinking are all preserved.Native thinking / redacted_thinking blocks with real signatures, verbatim.
OpenAI · Azure OpenAIeffort → reasoning.effort on the Responses API (only effort is set, never a summary request).The reasoning item's summary_text → a thinking block (empty signature); streamed via reasoning_summary_text deltas.
Gemini (API & Vertex)effort → thinkingConfig (thinkingLevel on Gemini 3, else a numeric thinkingBudget of 1024/8192/24576).Gemini thought parts → thinking blocks (empty signature).
AWS Bedrock (incl. Claude-on-Bedrock)effort → Converse thinking: adaptive + output_config.effort on recent Claude (Opus 4.6/4.7/4.8, Sonnet 4.6/5, Fable 5), else a fixed budget_tokens.Reasoning output is NOT surfaced back as thinking blocks on this path (see below).

warning · Translation caveats worth knowing

  • Signatures are Anthropic-only. Every non-Claude path synthesizes signature: "" (empty). Do not rely on a valid signature unless the model runs on the native anthropic provider.
  • budget_tokens is lossy off Anthropic. It is bucketed to low/medium/high, then re-expanded to the provider's own budget — the exact number is not preserved (e.g. 5000 → medium → Gemini/Bedrock 8192).
  • History thinking is dropped. thinking / redacted_thinking blocks you replay in assistant history are stripped on the translated paths; only the native Anthropic path keeps them for multi-turn reasoning continuity.
  • OpenAI reasoning may have no text. The translation requests effort but not a summary, so if the model emits no reasoning summary you get the token count without a thinking block.
  • Bedrock reasoning output is not surfaced. The budget is applied upstream (it affects answer quality and cost), but Converse reasoning blocks are not translated back into thinking blocks, and thinking_tokens reports 0 on this path.
  • Gemini rejects xhigh / max effort with a 400; Anthropic and Bedrock accept them.

tip · Need full thinking fidelity?

For real signatures, redacted_thinking, multi-turn thinking continuity and prompt caching, route to a model on the native anthropic provider — that path is a verbatim passthrough.