Docs menu

Reference

Chat completions

POST /v1/chat/completions — the OpenAI-compatible request and response, plus the fields Seldon adds.

HTTP
POST https://api.seldon-ai.com/v1/chat/completions
Authorization: Bearer sk-seldon-...
Content-Type: application/json

The request and response follow the OpenAI Chat Completions format. Fields Seldon doesn't use are passed through to the provider unchanged. This page lists what Seldon validates or adds.

Request body

Standard fields

FieldTypeNotes
modelstringRequired. A model ID, auto, or a function alias seldon/function/FUNCTION_ID.
messagesarrayRequired. Text and image_url parts; audio and video where the model supports them.
streambooleanServer-sent events. Not combinable with json_schema.
tools, tool_choicearray, string or objectPassed through. Requires a model that supports tools.
response_formatobjectjson_object, or json_schema, which Seldon validates.
userstringEnd-user attribution, truncated to 256 characters.
reasoning_effortstringnone, minimal, low, medium, high, xhigh or max.
reasoningobjecteffort, enabled, exclude and max_tokens.
include_reasoningbooleanMust not contradict reasoning.exclude.

Other standard parameters, such as temperature, max_tokens, top_p and stop, are passed through.

Seldon fields

FieldTypeNotes
modelsarray of stringsFallback models, tried after model.
providerobjectProvider filters, ordering, price caps and data policy. See Models and routing.
cacheobjectOpt-in response caching: mode, ttl_s, similarity_threshold, no_store. See Response caching.
presetstringslug or slug:version. Presets are coming soon.

With the OpenAI SDKs, send Seldon fields through extra_body.

Response

A standard chat.completion object. Seldon merges into usage without renaming standard fields:

FieldTypeNotes
usage.prompt_tokens, usage.completion_tokens, usage.total_tokensintegerCounted across every attempt when structured-output enforcement retries.
usage.computed_coststringCost in USD as a decimal string. "0" on a cache hit. Not included in streams.
usage.seldon_cacheobjectOn a miss: total_input_tokens, uncached_input_tokens, cached_read_tokens, cache_write_tokens, cache_hit_ratio. On a response-cache hit: hit, tier, avoided_cost and, for semantic hits, similarity.

Function calls add a top-level seldon object with function_id, revision_id, fallback_used and execution_id. See Call from your app.

Streaming

stream: true returns text/event-stream. Provider chunks are relayed unchanged and the stream ends with data: [DONE]. A mid-stream failure sends data: {"error": {"code": "...", "message": "..."}} before [DONE].

Errors

Errors return {"error": "...", "message": "...", "correlation_id": "..."} with an HTTP status. 400 responses may include reason, an upstream cause shared by every provider that rejected the request. See Errors.

Headers

See Headers for Idempotency-Key, attribution, session and response headers.

Chat completions | Seldon