Responses & streams
Realtime and async responses, flex processing, server-sent events, and streaming IDs under /v1/responses and /v1/streams.
Responses & streams
Inference on sference is modeled as a response resource: you create it, observe status, and read structured output (text, optional reasoning, errors). A response can be realtime (blocking, returns when inference finishes) or async (background: true, polled or streamed to completion). When you need incremental delivery, pair responses with streams and the events API.
Where to read schemas
Open API Reference in the sidebar → Inference → Inference API for POST/GET /v1/responses and /v1/responses/events. Everything is generated from the same OpenAPI document as production.
Mental model
POST /v1/responses: enqueue work (model,input[], optional sampling knobs, metadata).GET /v1/responses/{id}: pollstatus,output, anderroruntil the job reaches a terminal state.GET /v1/responses/events: cursor through SSE-style event history when you want a feed instead of polling the full document every time.- Streams (via the Python SDK / CLI): allocate a stream id to group related responses and fan out chunks independently of the JSON document.
If you are coming from the OpenAI Responses API, the verbs should feel familiar; sference adds async windows and European residency guarantees on the infrastructure side.
When to use streams
Use streams when:
- UX demands partial tokens or progressive rendering.
- Downstream systems already speak chunked HTTP or SSE.
- You want to decouple transport from the final aggregated response record.
For massive static backfills, prefer Batch inference; it is cheaper, simpler to retry, and easier to reconcile in compliance exports.
Processing modes
- realtime: sync
/v1/chat/completions,/v1/messages, or blockingPOST /v1/responses(no window field). Deadline = now; the connection waits for the result. - flex:
/v1/chat/completionsorPOST /v1/responseswithservice_tier: "flex": discounted tokens in exchange for lower scheduling priority. (/v1/messageshas noservice_tierfield and always runs realtime.) Flex requests may queue significantly longer than realtime (up to 30 minutes), so raise client timeouts; a flex request that cannot complete in time fails with 408 (OpenAI SDKs retry automatically). Flex is enabled per account; contact us to turn it on. - async (24h): background responses (
background: true, optionallymetadata.completion_window: "24h", the only window value), SDK/CLI streams, and batches (windowon create). Queued work scheduled to complete within the window.
All three modes share the same models, endpoints, and request shapes; only scheduling priority and price differ. Responses echo the tier actually served in service_tier.
Next steps
Batch inference
Enqueue thousands of rows on the 24h window: POST /v1/batches, poll status, download JSONL results.
Anthropic Messages API
POST /v1/messages on sference: an Anthropic Messages-compatible endpoint for open models. Auth, streaming SSE, tool use, extended thinking, vision, usage, and the exact compatibility surface.