v2

latestOpenAPI 3.1.02026-08-05267431678.1 KB
anthropic-compat

Messages

Anthropic-compatible messages endpoint.

Thin shell over :func:services.inference.adapters.anthropic_messages.run_messages. The adapter handles content-block translation, LLM-passthrough vs Pioneer-task dispatch, SSE rendering, persistence, and error mapping. The router keeps only HTTP-shaped concerns: route declaration, auth, rate limiting.

Args: body: Validated :class:AnthropicMessagesRequest. request: FastAPI request (forwarded so the adapter can read API-key billing context out of request.state for streaming responses). auth: Authenticated request context.

Returns: :class:AnthropicMessagesResponse for non-streaming, or a :class:StreamingResponse of Anthropic SSE events when body.stream is true.

post/v1/messages

Request body

modelstring required
max_tokensinteger
temperaturenumber nullable
top_pnumber nullable
top_kinteger nullable
streamboolean
storeboolean
cache_controlobject nullable
toolsobject[] nullable
tool_choiceobject nullable
stop_sequencesstring[] nullable
speed'standard' | 'fast' nullable

Anthropic inference speed mode. "fast" opts into high output-tokens-per-second inference on supported models (e.g. the latest Opus). Pioneer forwards this only to the native Anthropic upstream (with the required fast-mode beta header); Bedrock and OpenRouter routes ignore it.

thinkingobject nullable

Opt-in Anthropic-style extended-thinking controls. Pioneer does not enable thinking by default; send the Anthropic-native object: {'type': 'enabled', 'budget_tokens': N, 'display'?: 'summarized'|'omitted'} for manual mode, {'type': 'adaptive', 'effort'?: tier, 'display'?: ...} for adaptive mode (required on Opus 4.7+ / Mythos, recommended on Opus 4.6 / Sonnet 4.6), or {'type': 'disabled'} to turn thinking off on models that have it on by default. Pioneer canonicalizes this into InferenceRequest.reasoning at the adapter boundary so the request routes correctly whether the upstream is Anthropic native, Bedrock, or OpenRouter (which advertises the normalized reasoning field rather than thinking). On models that require adaptive mode, Pioneer auto-upgrades manual configs (mapping budget_tokens to the nearest effort tier) rather than letting the upstream return a 400.

task_typestring nullable

Deprecated. Legacy task hint. The unified schema disambiguates the task automatically. Submitting this field emits Deprecation: true and Sunset: <RFC 7231 date> headers.

include_confidenceboolean
include_spansboolean
effort'low' | 'medium' | 'high' | 'xhigh' | 'max'

Per-request routing-effort tier, ascending in cost and quality.

A router-agnostic label the caller sends as the effort param (or as a model suffix). Each router type maps these tiers to its own concrete policy via its :class:RouterProfile.

modelsstring[] nullable

Per-request candidate-model subset the router may select between. Overrides the router's stored candidate set for this request only; ignored for non-router models.

Response

Non-streaming Anthropic Messages response. When the request sets stream=true the server emits an Anthropic-shaped SSE event stream over text/event-stream instead; that stream shape is documented in the Anthropic Messages API reference.

idstring required
typestring
rolestring
contentobject[] required
modelstring required
stop_reasonstring nullable
stop_sequencestring nullable
pioneer_inference_idstring nullable
pioneer_routed_modelstring nullable
pioneer_savingsobject nullable