Models
Create chat completion
Send messages to a model and get a completion, or stream it as SSE chunks. Ordered fallback with `models[]`, `sort`, presets and an opt-in response cache.
Examples verified against code, not live (TI-78). The models plane takes an sk-ocean- key ($PLUNGE_MODEL_KEY); an ozk_ key answers 401 invalid_api_key. Errors carry error.code in the body, never an X-Error-Code header.
Authorizations
Authorization: Bearer sk-ocean-…. sk-ocean- inference key (money plane, forwarded downstream)Body
application/jsonMoney plane, sk-ocean- auth. Transparent proxy to inference-gateway — any OpenAI-compatible field is passed through untouched; the fields below are the ones Phase 2 routing adds on top.
Available options: price, latency, throughput
Default: false
Response
Completion (model = the slug that actually served it, not necessarily the one requested). stream:true returns text/event-stream instead — see the developer guide for the streaming caveat.
application/jsontext/event-stream
Response headers
miss or hit when the opt-in response cache is on.The body failed validation; error.code is in the body (no X-Error-Code on the models plane).
Error code: invalid_request_errorfrom code
Missing/invalid sk-ocean- key
application/json
byok_required — this provider needs your own connected key on this plan
Error code: insufficient_balancefrom code
application/json
model_not_allowed (routing candidates excluded by an allow-list) or content_blocked (prompt matched a guardrail regex)
application/json
preset_not_found — @preset/<slug> does not exist or is inactive
application/json
rate_limit_exceeded (per-key/per-provider) or spend_cap_exceeded (guardrail cap reached)
Error code: insufficient_quotafrom code
application/json
money_plane_unavailable — INFERENCE_GATEWAY_SERVICE not bound on this tier
application/json
Stream events
| Event | Description |
|---|---|
chat.completion.chunk | One delta of the completion in choices[0].delta. |
[DONE] | End of the stream. |
data: {"object":"chat.completion.chunk","choices":[{"index":0,"delta":{"content":"hi"},"finish_reason":null}]}data: [DONE]