Create a response (OpenAI Responses API, passthrough)
https://api.stav.ai/v1/responsesOpenAI Responses API. Faithful passthrough to the provider's own
Responses API for routed-commercial OpenAI and xAI models —
drop-in for the official OpenAI SDK: set
base_url="https://api.stav.ai/v1" and api_key=sk_stav_live_...,
then call client.responses.create(...).
This is the only surface for Responses-API-only models: OpenAI's
codex family (openai/gpt-5.3-codex, codex-*, o*-pro) and xAI's
multi-agent models (xai/grok-4.20-multi-agent-0309), which cannot
be served on /v1/chat/completions. Dual-surface models (gpt-5, o-series)
are also accepted here so their reasoning features (reasoning,
encrypted reasoning, built-in tools) are fully expressed.
For an OpenAI model the request body is forwarded verbatim (with the Stav model slug mapped to the provider model id) and the response / SSE stream is returned untouched.
Every other catalogue model is also accepted, and is translated onto Stav's chat dispatch path — so sovereign and open-weight models work on this surface too. Three differences apply on the translated path:
- Server-side conversation state is not supported.
store: trueandprevious_response_idare refused by name; send the full input each turn. (Stav keeps no hidden conversation state — every turn is visible in the audit log.) - Hosted tools the target provider cannot execute —
web_searchand friends — are dropped and named in theX-Stav-Dropped-Paramsresponse header. This is a capability limit of that provider's chat API, not a policy decision: a model's own native tools are accepted along with the model wherever the provider can run them. - Images and PDFs are sent inline. An
input_imageitem carriesimage_url(an HTTPS URL or adata:image/...;base64,...URI); aninput_fileitem carries the PDF asfile_data(data:application/pdf;base64,...), and Stav sends it in the shape the Inference Provider reads. A model whose endpoint cannot take a PDF is refused withmodel_capability_error(capability: pdf_input) before anything is sent. A text file (text/*,application/json,application/xml,application/yamland similar, as adata:URI) is read as text, so every model takes it; other document types (Word, Excel, PowerPoint) are refused by name: convert them to PDF. Afile_id(a file in one provider's own store) and a file URL are refused by name: send the bytes.
Where it may run: provider
The provider object narrows this one request: runs_in (alias
region), min_sovereignty_level, only, ignore, max_price and
quantizations, as in ProviderPreferences. It is taken off the body
and never forwarded, on either path. The X-Stav-Runs-In and
X-Stav-Min-Sovereignty-Level headers set the same rules for clients
that cannot add body fields, and one word after the model name
(auto:eu, auto:L3) does for an app with only a model box. Sent
together, all must hold.
Your workspace policy applies here too
Requests for OpenAI and xAI models are forwarded to the provider's own
Responses API. They go through the same checks as every other surface:
the model must be in your workspace's catalogue, and when your key
policy sets a compute region, zero data retention or no training on
inputs, a provider endpoint must meet it. If none does, the request
is refused with 403 endpoint_not_admissible and never forwarded.
Prompt retention — store defaults to false on Stav
OpenAI's own Responses API defaults store to true, retaining your
prompt and completion on OpenAI's infrastructure. Stav inverts that
default. A request that does not mention store is forwarded with
store: false, so nothing is retained upstream.
The consequence is deliberate and worth stating plainly:
GET /v1/responses/{response_id} and
GET /v1/responses/{response_id}/input_items require opting in
with store: true. A workspace whose policy requires zero data
retention cannot opt in: store: true is refused with
403 store_not_permitted. Retrieval is a real feature and it is yours to
turn on — it is simply not on by default, because the default should
not quietly park customer content in a jurisdiction you did not
choose.
Otherwise, setting store explicitly — either value — is forwarded
unchanged.
On the translated (non-OpenAI) path store: true is refused by name,
because Stav keeps no server-side conversation state of its own.
What this surface does and does not do
For an explicitly named OpenAI model this is a verbatim proxy:
there is no endpoint-level failover, because there is one upstream.
model: auto and model: "@workspace/router" are honoured here and
route exactly as they do on /v1/chat/completions; your workspace's
sovereignty floor is enforced on both paths.
Per-key rate limits apply; one inference-log row is written per call.
Header-parametere
X-Stav-Runs-InstringWhere this request may run, as a header:
eu,eea, one ISO 3166 alpha-2 country code, or a comma-separated list of codes (NO, SE). The same values and the same meaning as theprovider.runs_inbody field, for clients that can set fixed headers but not body fields (an SDK'sdefault_headers). It filters the Provider Endpoints that may serve and every failover; when none passes, the request is refused (403 endpoint_not_admissible) and nothing is sent.It only ever narrows. Sent together with
provider.runs_in, both must hold:X-Stav-Runs-In: eeawith"runs_in": "NO"runs in Norway;X-Stav-Runs-In: euwith"runs_in": "NO"or"US"has no country in common and is400 invalid_value. It never widens your workspace policy. A value Stav cannot read, an empty one, or two header lines with different values is400 invalid_valuewithparamX-Stav-Runs-In; the same value sent twice counts once. The request log shows the region with its source.GET /v1/modelslists only models with an endpoint inside it, and a Router orautoonly when at least one of its candidates has one (without a key,autois not listed under the header);GET /v1/models/{model_id}/endpointslists only those endpoints, andGET /v1/models/{model_id}gives their limits and price./v1/messages/count_tokensreads it too: when the provider's own counter is outside it, the count is a local estimate and the prompt is never sent. The response headerX-Stav-Token-Count(andstav_token_countin the body) saysexact,estimate(the model's own tokenizer, run by Stav) orapproximate(no tokenizer for the model: characters / 4). Reading or cancelling a stored response (GET /v1/responses/{id},/input_items,/cancel) held by an endpoint outside it is refused with403 endpoint_not_admissible;DELETEis not refused, so data held outside the region can always be erased.X-Stav-Min-Sovereignty-LevelstringThe lowest sovereignty level that may serve this request:
L1,L2,L3orL4, in any letter case.L3admits L3 and L4. The same meaning as theprovider.min_sovereignty_levelbody field, for clients that can set fixed headers but not body fields. It filters the Provider Endpoints that may serve and every failover. An endpoint with no level does not pass. When none passes, the request is refused and nothing is sent.It only ever narrows: the highest of your workspace's floor, the Router's, this header, the body field and a level in the model name (
auto:L3) holds. An empty value, any other value, or two header lines with different values is400 invalid_valuewithparamX-Stav-Min-Sovereignty-Level.A level is a grade, not a place. To keep a request in the EU, send
X-Stav-Runs-In: eutoo. Today only your own Stav Tunnel node is atL4.The model listings,
/v1/messages/count_tokensand stored responses follow it as they followX-Stav-Runs-In.X-Stav-TagsstringName=value pairs for a Decision Router:
tier=free, feature=summarise. At most 16 pairs and 1,024 characters. A name is 1 to 32 ofa-z,0-9,_or-, read in lower case. A value is 1 to 64 printable ASCII characters, with no,or=, compared exactly. A name given twice is an error.Read only by a Decision Router with an X-Stav-Tags request fact. There, a header that breaks these rules answers
400 invalid_caller_labels. Every other Router ignores it. A caller can send any value, so use X-Stav-Tags to sort traffic, never as a control. Not forwarded to an Inference Provider. See Route requests by case.X-Stav-Run-IdstringOptional. Names a run: the requests of one agent task, so Stav can notice an agent that runs away. 1 to 128 printable ASCII characters (space to
~), sent once. Without it, Stav groups requests by the session the routing already uses (session_id,X-Session-Id,prompt_cache_key, else the start of the conversation).Scoped to your workspace and API key: two workspaces sending the same value are two runs. Never sent to an Inference Provider. A malformed value is refused with
400 invalid_run_idwhile Stav tracks runs, and ignored otherwise. It never changes routing.
Forespørselsinnhold
modelstringpåkrevdThe same forms as on
/v1/chat/completions, a rule after the name included (auto:eu).inputstring | array of objectsString or array of input items (OpenAI Responses shape).
streambooleanstorebooleanRetain the prompt and completion upstream so the response can be fetched later by id. Defaults to
falseon Stav — OpenAI's own default istrue. Required forGET /v1/responses/{response_id}and itsinput_items.
Svarheadere
| Header | Betydning |
|---|---|
X-Stav-Request-Id | Unique request identifier, identical to the completion |
X-Stav-Reasoning-Effort | Present when the request carried a reasoning control
( |
X-Stav-Reasoning-Chosen-By | Who chose the reasoning level the provider received: |
X-Stav-Upstream-Surface | The provider API that served the request: |
Feil
| Status | Når |
|---|---|
| 400 | Invalid request — malformed JSON, missing required fields, or invalid parameter values. |
| 401 | Missing or invalid API key. |
| 403 | The API key lacks the required scope, or a Decision Router matched a case that blocks the request ( |
| 404 | Model id is not in the catalogue, or the caller's key doesn't have access to it. |
| 429 | Per-key or per-IP rate limit exceeded. |
| 502 | An upstream provider (Anthropic, OpenAI, etc.) returned an error. |
| 503 | Upstream OpenAI credential not configured on this deployment. |
Alle feilkoder, hva de betyr og hva du gjør: Feil.