Last reviewed: 2026-08-06
Direct answer
Do not pass one generic reasoning value unchanged when a coding agent switches model families. Define a provider-neutral policy, resolve the exact model and API surface, and translate that policy through a capability record that has been tested for that model. If the record is missing or a requested control is unsupported, stop before sending the request. Silent parameter removal makes a successful response look portable even when the model actually ran with different reasoning, latency, or cost behavior.
CometAPI documents an OpenAI-compatible SDK setup and access to models from multiple providers. That gives a coding agent a consistent transport surface, but it does not establish semantic equivalence between provider controls. OpenAI documents a reasoning effort control in its Responses API. Anthropic distinguishes adaptive thinking from manual thinking budgets and changes support by model generation. Google exposes thinking through thought steps, optional summaries, signatures, and usage fields. A compatibility layer must preserve those differences instead of hiding them.
Start with an internal policy that describes operator intent rather than a provider payload:
profile: balanced
summary_policy: optional
tool_reasoning_required: true
final_answer_reserve: 3000
unsupported_control: reject
The profile name is your contract. It is not a promise that every provider will use the same number of reasoning tokens. The adapter should map balanced to a verified native control for the selected model, keep enough output space for the final answer, and attach an adapter revision to the run. Quality, latency, tool behavior, and reported usage then determine whether the mapping remains approved.
Who this is for
This guide is for developers and platform engineers who route coding-agent tasks through CometAPI while allowing more than one model family. It is especially relevant when a workflow can change models through configuration, fallback routing, an evaluation result, or a production incident.
It also applies to teams that operate long tool loops. In those systems, reasoning configuration can affect response shape, output headroom, prompt caching, and how thinking appears around tool calls. The goal is not to expose private reasoning text or force providers into one artificial schema. The goal is to give operators one stable intent contract while retaining the provider-specific rules needed for correct requests and reliable parsing.
Key takeaways
- Normalize intent, not parameter names. A generic
balancedprofile should compile differently for effort-based, budget-based, and dynamic-thinking models. - Key every capability record by exact model identity and API surface. A family name alone is too broad when support changes between model generations.
- Fail closed on an unknown control. Do not remove an unsupported field and retry unless an approved policy explicitly permits a lower-reasoning mode.
- Reserve room for the final answer. A reasoning budget and an overall output limit are related constraints, not two independent ceilings.
- Treat summaries and signatures as response-contract fields. A missing optional summary is not automatically an error, while an opaque signature should not be rewritten or exposed in ordinary logs.
- Recompile after fallback. Never send a payload rendered for one model family directly to another family.
- Measure observed behavior. Record latency, output units, reasoning units when reported, tool-call counts, cache status, and the adapter revision used for the request.
Sources checked
- The CometAPI quickstart establishes the shared SDK pattern, CometAPI base configuration, and multi-provider model access used as the gateway surface in this guide.
- The OpenAI reasoning models guide explains that reasoning models use internal reasoning tokens, recommends the Responses API for reasoning workloads, and demonstrates a request with reasoning effort.
- The Anthropic extended thinking documentation
documents adaptive and manual thinking,
budget_tokensconstraints, model-version compatibility, interleaved tool behavior, usage reporting, and cache effects. - The Gemini thinking documentation documents thought steps, encrypted signatures, optional summaries, streaming thought events, and reported thought-token usage.
These sources support the provider-specific facts in this article. The normalized profiles, rejection policy, canary design, and logging schema below are implementation recommendations built on those facts.
Contract details to verify
Build a capability registry rather than a collection of conditionals scattered through the agent. Each row should identify the model, endpoint contract, native control mode, accepted values, summary behavior, tool-loop behavior, usage fields, and the date and adapter revision that passed preflight.
An illustrative row looks like this:
model_alias: review-primary
model_family: anthropic
endpoint_contract: messages
reasoning_mode: adaptive
manual_budget_supported: false
summary_behavior: content-block-or-absent
tool_interleaving: verify
adapter_revision: r7
verified_on: 2026-08-06
The values are deployment data, not universal defaults. Verify these details for every approved route:
- CometAPI route: Confirm that the exact model is available through the intended CometAPI API surface and that the request fields used by your adapter are accepted. The public quickstart proves the common SDK and gateway setup, not every provider-specific reasoning field.
- OpenAI route: Confirm the Responses API path and the reasoning effort values accepted by the selected model. OpenAI’s refetched guide demonstrates the effort control and explains that internal reasoning tokens precede the final response.
- Anthropic route: Confirm whether the model uses adaptive thinking or supports manual
thinking.type: enabled. The refetched documentation says manual mode is deprecated on Claude 4.6 models and rejected with a 400 response on Claude 4.7 and later. For models that support manual mode,budget_tokenshas a minimum of 1,024 and normally must remain belowmax_tokens, leaving room for final output. The interleaved-thinking exception must be represented explicitly rather than assumed. - Gemini route: Confirm the API surface and thinking controls for the selected model. The Interactions API represents thoughts as dedicated steps. A thought summary can be empty or absent, while the signature represents opaque reasoning state. Parsers must therefore accept a signature-only thought step.
- Fallback route: Confirm that every fallback has its own adapter row. A fallback is not approved merely because it accepts the same prompt.
A concrete operator workflow should cover both success and error paths.
Happy path
- Classify the task, such as a read-only repository review, and select the internal
balancedprofile. - Resolve the exact CometAPI model and load its capability row.
- Compile only the supported native controls. Validate output headroom and any tool-loop requirements before network execution.
- Run a small canary fixture against that same model and API surface. The fixture should require a final answer with a known structure and should not modify a repository.
- Accept the route only when the response parses, the final answer is present, tool behavior matches the fixture, and measured latency and usage remain inside the profile’s approved range.
- Execute the real task and record the adapter revision with sanitized telemetry.
Error path
- If capability lookup fails, stop with
reasoning_contract_unknown; do not guess a native field. - If the provider returns a 400 response for a reasoning control, classify it as
reasoning_contract_rejectedand do not retry the same payload. - Refresh the capability row. For the documented Anthropic manual-thinking rejection, move to adaptive thinking only when that mode is approved for the selected model. Otherwise select a tested fallback or stop the run.
- Recompile the canonical profile for any fallback model, then repeat the canary. Do not reuse the rejected payload.
- If a Gemini thought step has no summary, continue parsing when the response otherwise matches the documented shape. Preserve required opaque state in the protocol path, but keep it out of ordinary logs.
A sanitized completion event can retain operational evidence without storing prompts, source code, tool arguments, raw thought summaries, or opaque signatures:
event: model_call_complete
run_id: run-42
model_alias: review-primary
model_family: provider-a
profile_requested: balanced
control_kind: native
adapter_revision: r7
summary_policy: optional
tool_call_count: 0
input_units: 2400
output_units: 620
reasoning_units: null
latency_ms: 4800
http_status: 200
fallback_used: false
error_class: null
request_body: '[REDACTED]'
response_body: '[REDACTED]'
Provider usage schemas differ, so store the normalized fields alongside a documented mapping to the raw usage fields. Use null when a field is unavailable rather than inventing a zero. Keep the model identifier, capability revision, cache result, fallback reason, and error class. Exclude request headers, authentication material, repository contents, raw reasoning content, and thought signatures.
Failure modes
Transport compatibility mistaken for reasoning compatibility. A shared SDK call succeeds, but an unsupported reasoning field is ignored or rejected. The prevention is a per-model capability row plus a canary that verifies observable behavior, not just an HTTP success code.
Manual thinking sent to an incompatible Claude model. Anthropic documents that thinking.type: enabled is deprecated for Claude 4.6 and rejected for Claude 4.7 and later. A stale adapter can therefore turn a routine model upgrade into a 400 response. Pin the capability revision and require a fresh preflight when model identity changes.
The reasoning budget starves the final answer. In supported Anthropic manual mode, thinking tokens count toward the overall output limit and budget_tokens normally must remain below max_tokens. Validate a final-answer reserve before the request is sent. Do not treat the manual budget as a separate pool.
Cache churn after a control change. Anthropic documents that changing budget_tokens between requests invalidates prompt-cache breakpoints in manual mode. Hold the approved setting stable during a cached conversation or make the expected cache miss visible in cost and latency checks.
A parser requires a thought summary. Gemini documentation says summaries may be empty or absent even though a thought signature is present. Treat summary visibility as optional unless the selected contract explicitly guarantees it.
Opaque reasoning state reaches logs. Thought signatures, summaries, prompts, repository text, and tool arguments do not belong in general telemetry. Log presence, counts, normalized usage, and adapter metadata instead of content.
Fallback reuses the original payload. A provider-specific request can fail again or run with unintended defaults on another family. Compile the internal profile from scratch for the fallback and rerun the fixture before continuing.
Tool behavior changes with reasoning mode. Anthropic documents model-specific interleaved-thinking behavior, and Gemini places thought steps alongside calls and outputs. A text-only canary will not detect those differences. Add a separate fixture for any route allowed to invoke tools.
FAQ
Does OpenAI compatibility make reasoning controls portable?
No. CometAPI’s quickstart establishes a common SDK and gateway configuration. The provider documents show materially different reasoning contracts. Treat the gateway as the transport layer and your capability adapter as the semantic layer.
Can one number represent low, medium, and high reasoning everywhere?
Not reliably. OpenAI exposes effort, supported Anthropic models may use adaptive thinking or a manual token target, and Gemini exposes its own thinking behavior and response steps. A profile should express intent and acceptance thresholds, then map to settings validated for each model.
Should a coding agent require a visible reasoning summary?
Usually not. Gemini documentation says a thought summary may be absent, and Anthropic describes summarized thinking blocks within its own response contract. Make summaries optional unless a specific workflow and model contract require them. Judge the run by the final answer, tool results, tests, and operational limits.
What should happen after an unsupported-control error?
Stop the unchanged retry loop. Record a sanitized error class, refresh the model capability record, compile an approved alternative, and rerun the canary. If no approved mapping exists, stop or escalate rather than silently lowering reasoning.
How should teams compare profiles across providers?
Use stable coding fixtures and compare task success, final-answer completeness, tool-call correctness, latency, and reported usage. Do not compare private reasoning text or expect identical prose. The operational question is whether each route satisfies the same task contract within its approved limits.
Reader next step
Create one capability row for each model your coding agent can select, then implement unknown, rejected, and fallback branches before adding more profiles. Use the CometAPI request-fixture workflow
to build the canary, and extend it with tool-call contract tests
before enabling tools or automatic fallback.
Start with a read-only coding fixture, one approved primary model, and one approved fallback. Record the adapter revision and sanitized metrics for both. Once those routes pass the same task contract, Start with CometAPI and add models one capability row at a time.