v2

latestOpenAPI 3.1.02026-08-05267431678.1 KB
openai-compat

Text Completions

OpenAI-compatible text completions endpoint.

Thin shell over :func:services.inference.adapters.openai_text.run_text_completion. The adapter handles project routing, dispatch (LLM passthrough vs Pioneer-task), SSE rendering, persistence, and error mapping. The router keeps only HTTP-shaped concerns: route declaration, auth, rate limiting.

Args: body: Validated :class:TextCompletionRequest. 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:TextCompletionResponse for non-streaming, or a :class:StreamingResponse of text_completion SSE events terminated by data: [DONE] when body.stream is true.

post/v1/completions

Request body

modelstring required
promptstring required
temperaturenumber nullable
max_tokensinteger nullable
echoboolean
logprobsinteger nullable
streamboolean nullable
extra_bodyobject nullable
reasoningobject nullable

Opt-in reasoning / extended-thinking controls. Accepts the OpenRouter-normalized shape (enabled, max_tokens, effort, exclude); effort and max_tokens are mutually exclusive. Pioneer extensions for Claude routes: mode (manual/adaptive) and display (summarized/omitted). Pioneer canonicalizes this and renders each provider's native field at the wire boundary.

storeboolean
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

Text completion. Returns application/json (TextCompletionResponse) by default, or text/event-stream of TextCompletionStreamChunk events terminated by data: [DONE] when stream=true.

idstring
objectstring
createdinteger
modelstring required