Adaptive Thinking and Tiered Model Routing
First-generation LLM routing was one-dimensional: send simple prompts to a small model, send hard prompts to a flagship model, or guess a static budget_tokens cap for reasoning. By late 2026—with Anthropic’s Claude Haiku 5.5 and Claude Fable 5.2 supporting Adaptive Thinking plus output_config.effort, and Google’s Gemini 4 Neon exposing four explicit thinking depths—production routing has become a two-dimensional policy: model tier × reasoning effort.
Output pricing now spans 80x from Claude Haiku 5.5’s short-prompt tier ($0.50/MTok for prompts ≤ 100,000 input tokens) to Claude Fable 5.2 ($40.00/MTok)—and 16x once Haiku 5.5 crosses into its long-prompt tier ($2.50/MTok for > 100,000 input tokens). Because internal reasoning tokens generated during adaptive thinking bill as output tokens, an unbounded retry loop or an accidental jump past 100K input tokens can quickly distort monthly spend.
From Static budget_tokens to Adaptive Thinking
Hardcoding a fixed budget_tokens value always forced a bad trade-off: too low truncates hard debugging mid-thought; too high burns seconds on trivial formatting. Newer model families replace rigid budgets with per-turn adaptive reasoning guided by an effort dial, though constraints differ sharply across models:
- Anthropic Claude 5.5 / 5.2 (Thinking Guide, Effort Guide): Pass
thinking: { type: "adaptive" }and guide depth viaoutput_config.effort(low,medium,high,xhigh,max). Disable rules vary by model:claude-opus-5-5andclaude-fable-5-2: adaptive thinking is always on; passingdisabledreturns HTTP400.claude-sonnet-5-5: also rejectsdisabled; supportsbetween_toolsatlow,medium, andhigh.claude-haiku-5-5: acceptsdisabledonly athighand below.
- Google Gemini 4 Neon (Google Cloud Model Guide): Direct API calls expose a 1,048,576 shared input+output context window and four thinking levels—note that
GenerateContentexpects uppercase enum values inthinkingConfig.thinkingLevel, whereas theInteractionsAPI expects lowercase values (inside the Antigravity workspace, Neon’s published limit is 512K). - DeepSeek-V4.1-Flash: Multi-step web search and page reading trigger only when deep thinking is enabled and search tools are explicitly declared (see DeepSeek Web Tools Guide and DeepSeek Application API Suite and V4.1-Flash).
Late-2026 Tier and Pricing Matrix
All four Anthropic 5.5/5.2 models provide a 1M-token context window and up to 128K output tokens (Haiku 5.5, Fable 5.2, Official Pricing):
| Tier | Representative Models | Standard API Price (Input / Output per MTok) | Default Thinking Behavior | Best-Fit Workloads |
|---|---|---|---|---|
| L0 Fast (Short Prompt) | claude-haiku-5-5 (≤ 100,000 input tokens) |
$0.10 / $0.50 | Default medium (skips thinking on simple turns) |
Classification, extraction, pre-routing, light edits |
| L0 Fast (Long Prompt) | claude-haiku-5-5 (> 100,000 input tokens) |
$0.50 / $2.50 | Same; threshold includes cache reads/writes and applies to the full request | Long-context triage and bulk extraction |
| L1 Balanced Daily Driver | claude-sonnet-5-5 / gemini-4-neon |
Sonnet 5.5: $2.00 / $10.00 | Default high |
Everyday coding, PR reviews, standard multi-step agents |
| L2 Deep Reasoning | claude-opus-5-5 |
$4.00 / $20.00 | Default medium (rejects disabled) |
Long-running refactors, cross-file diagnosis |
| L3 Heavy Fallback | claude-fable-5-2 / Gemini 4 Carbon |
Fable 5.2: $8.00 / $40.00 | Fable 5.2 default high (rejects disabled) |
Escalations after L1/L2 fail, security and architecture reviews |
Watch Haiku 5.5’s 100,000-token threshold closely: cache reads and writes count toward it, and crossing the line bumps both input and output rates 5x for the entire request. Pair tiering with the Batch API (50% discount) for asynchronous jobs and prefix-stable Prompt Caching (see AI Context Management Guide).
Two-Dimensional Routing: Unified Verification and Circuit Breaking
Replace brittle LLM routers with deterministic policy selection, unified verification, and explicit circuit breaking (see Optimizing for Cost and Intelligence):
Every tier—including L2 and L3—passes through the same deterministic verification gate. Actual pass and escalation rates vary heavily by workload; measure them on your own team’s eval suite rather than assuming fixed percentages.
TypeScript Circuit-Breaking Escalation Router
This policy router separates Anthropic’s full effort enum from the locally permitted subset, validates attempt and profile at runtime, and returns an explicit termination outcome once the ladder, budget, or deadline is exhausted:
export type TaskProfile =
| "extract_or_classify"
| "standard_coding"
| "complex_debugging"
| "security_or_architecture";
/** Full Anthropic effort enum */
export type ClaudeEffort = "low" | "medium" | "high" | "xhigh" | "max";
/** Locally permitted subset (blocks automatic escalation to max) */
export type AllowedEffort = Exclude<ClaudeEffort, "max">;
export interface RouteDecision {
model: string;
effort: AllowedEffort;
maxTokens: number;
}
export interface BudgetContext {
spentUsd: number;
maxBudgetUsd: number;
deadlineMs: number;
nowMs?: number;
}
export type RouteOutcome =
| { ok: true; decision: RouteDecision }
| {
ok: false;
reason: "ladder_exhausted" | "budget_exceeded" | "deadline_exceeded";
};
const ROUTE_TABLE: Record<TaskProfile, readonly RouteDecision[]> = {
extract_or_classify: [
{ model: "claude-haiku-5-5", effort: "low", maxTokens: 1024 },
{ model: "claude-haiku-5-5", effort: "medium", maxTokens: 2048 },
],
standard_coding: [
{ model: "claude-sonnet-5-5", effort: "medium", maxTokens: 8192 },
{ model: "claude-sonnet-5-5", effort: "high", maxTokens: 16384 },
],
complex_debugging: [
{ model: "claude-opus-5-5", effort: "medium", maxTokens: 16384 },
{ model: "claude-fable-5-2", effort: "high", maxTokens: 32768 },
],
security_or_architecture: [
{ model: "claude-fable-5-2", effort: "high", maxTokens: 32768 },
],
};
export function selectRoute(
profile: TaskProfile,
attempt: number,
budget: BudgetContext,
): RouteOutcome {
if (!Number.isInteger(attempt) || attempt < 0) {
throw new RangeError(`attempt must be a non-negative integer, got ${attempt}`);
}
if (!Object.prototype.hasOwnProperty.call(ROUTE_TABLE, profile)) {
throw new RangeError(`unknown task profile: ${String(profile)}`);
}
const now = budget.nowMs ?? Date.now();
if (now >= budget.deadlineMs) {
return { ok: false, reason: "deadline_exceeded" };
}
if (budget.spentUsd >= budget.maxBudgetUsd) {
return { ok: false, reason: "budget_exceeded" };
}
const ladder = ROUTE_TABLE[profile];
if (attempt >= ladder.length) {
return { ok: false, reason: "ladder_exhausted" };
}
return { ok: true, decision: ladder[attempt] };
}
export function buildClaudeRequestBody(
decision: RouteDecision,
userPrompt: string,
) {
return {
model: decision.model,
max_tokens: decision.maxTokens,
thinking: { type: "adaptive" as const },
output_config: { effort: decision.effort },
messages: [{ role: "user" as const, content: userPrompt }],
};
}When routing across Anthropic and Google Gemini 4, place vendor translation inside dedicated provider adapters rather than just adding a provider label, since output_config.effort and Gemini’s thinkingConfig.thinkingLevel (uppercase on GenerateContent, lowercase on Interactions) differ in both structure and valid values.
Billing and Observability Guardrails
- Do not double-bill thinking tokens: In the Claude Messages API, read
usage.output_tokens_details.thinking_tokensfor observability dashboards (see LLM Observability Guide), but remember those tokens are already included insideusage.output_tokens—never sum them for cost accounting. - Never blindly pass
disabledacross tiers: Sonnet 5.5, Opus 5.5, and Fable 5.2 rejectthinking: { type: "disabled" }; drop to Haiku 5.5 (wheredisabledis supported athighand below) or reduceeffort. - Monitor the 100K prompt boundary: Uncompacted conversation history or bloated system prompts pushing Haiku 5.5 past 100,000 tokens (including cache reads/writes) jump both input and output prices 5x.
- Trim context noise before upgrading tiers: Many failures that appear to need a heavier model are caused by noisy logs burying the real error—cleaning the context window is faster and cheaper than escalating.