Create a chat completion
POST https://weights.fyi/run/v1/chat/completions
Authorization: Bearer <token> scope: submit
[X-Request-Id: <uuid>]
{"model": "<model>", "messages": [...], "stream": true, ...}- Available since
- 2026-10-10 implementation review: the endpoint API is built; runtime availability follows the model catalog. No LLM chat model is available on this service yet.
- Answer time
- the model's own: a first token after 0.91 s on one stream (median, measured 2026-10-05), plus a pause while the model moves to new hardware.
OpenAI's chat-completions call, sent through your workspace's endpoint for the model to capacity every caller of that model shares, so any OpenAI client works with https://weights.fyi/run/v1 as its base address. With "stream": true the answer arrives as server-sent events ending with data: [DONE]; the last chunk always carries usage. Fields are checked and normalized, never passed through blindly: the Request table says what happens to each.
Only a call already admitted waits. When the model moves to new hardware during your call, the connection stays open (a stream gets a : keepalive comment every 300 s), we send your conversation again, and the answer goes on from the last word you received; the last chunk carries x-weights-recovered: 1, usage counts both readings, and the text is not what the first hardware would have written, even with a seed. A new call is not held: a stopped endpoint answers 503 model_not_ready and starts, and a model that is starting, moving or paused answers 429 overloaded with reason: capacity_unavailable. Wait Retry-After seconds and send again. The drop-in base https://weights.fyi/run/v1/proxy creates the endpoint and skips the 503, but answers the same 429 while nothing is ready.
Request
| Name | Where | Required | Meaning |
|---|---|---|---|
Authorization | header | yes | Bearer and a token with submit. |
X-Request-Id | header | no | A UUID to follow the call by; answered back in the header of the same name. One is made when you send none. |
X-Weights-Auto-Endpoint | header | no | true creates your endpoint for the model when you have none, as the /v1/proxy base always does; without it the call answers 404 endpoint_not_found. |
X-Weights-Wait-Cold | header | no | true starts a stopped endpoint without the 503: the call is admitted when capacity is ready, else refused with the 429 above. |
model | body | yes | The model's id, or one of its aliases, from GET /v1/models. |
messages | body | yes | The conversation, OpenAI's shape. |
stream, stream_options | body | no | true for server-sent events; stream_options takes include_usage and continuous_usage_stats. A model that answers whole responses only refuses it: 400 invalid_request, reason: stream_unsupported. |
max_tokens, max_completion_tokens | body | no | Either bounds the answer, a whole number from 1. After a move the answer goes on with what is left. On /v1/proxy a null reads as not sent, and a call that names neither gets a default bound that fits the context. |
temperature, top_p, stop, response_format | body | no | As OpenAI defines them, checked by type. |
reasoning_effort | body | no | low, medium, high, xhigh or max, at the top level or inside chat_template_kwargs. It is mapped onto the words the model's own template accepts (the next tier up when yours is missing, else its highest); default or null is left out so the model applies its own. Any other value: 400, reason: invalid_field. Where a reasoning model's workers have not declared the field it is left out; elsewhere it is an extension like those below. |
seed | body | no | An extension like those below. To a model served with a speculative draft, which cannot honour it, it is left out. |
cache_salt | body | no | Always dropped, at the top level or under extra_body: the service partitions the prompt cache per workspace itself. |
tools, tool_choice, parallel_tool_calls, min_tokens, chat_template_kwargs, top_k, min_p, presence_penalty, frequency_penalty, repetition_penalty | body | no | Extensions. A model served by enrolled workers, yours or the platform's, takes one only where every published worker declared it by name; tools alone admits neither tool_choice nor parallel_tool_calls. Other models hand them to their own engine, which accepts or refuses them. |
| any other field | body | no | Apart from the three cases above (reasoning_effort, seed, cache_salt), a model served by enrolled workers refuses an undeclared or unknown field and never drops it: 400 invalid_request, reason: unsupported_field, field naming it. An SDK's extra_body= argument is merged into the top level before sending, so its keys are judged as fields; a literal nested extra_body object is itself an unknown field. |
service_tier | body | no | auto, default, flex (served last) or priority (interactive, served first). Another word is 400, reason: invalid_field. |
jurisdictions | body, or header X-Weights-Jurisdictions | no | Country codes, EU or EEA: the call runs only where the model's known location is inside them, else 409 jurisdiction_refused. |
encrypted_envelope | body | in a confidential workspace | The sealed request (POST /v1/workspaces); a plain call there answers 400 encrypted_envelope_required. |
Return value
200 OK. Streamed: text/event-stream chunks of OpenAI's chat.completion.chunk, then data: [DONE]. Whole: one chat.completion.
| Field | Meaning |
|---|---|
usage | On the last chunk, or in the whole answer: prompt and completion tokens. After a move, the sum of both readings. |
x-weights-recovered | 1 on the last chunk, or in the whole answer, when the answer was carried across a move. A whole answer also has the header X-Weights-Recovered: 1. |
model | The model's id as you sent it. |
Errors
Every refusal is OpenAI-shaped and carries the call's request id.
| Status | Code | When it happens | What to do |
|---|---|---|---|
400 | invalid_request | No messages, or a field refused: reason says unsupported_field, invalid_field or stream_unsupported, and field names it. | Fix the request. |
400 | model_not_available | The model is not in your workspace's catalog; available lists those that are. | Name one of them. |
400 | encrypted_envelope_required | A plain call from a confidential workspace. | Send the sealed request. |
402 | no_credit | No credit (a start costs nothing). | Add credit. |
404 | endpoint_not_found | You have no endpoint for this model. | Create it, send X-Weights-Auto-Endpoint: true, or use /v1/proxy. |
409 | jurisdiction_refused | No eligible capacity has a known location inside jurisdictions. | Widen them, or wait. |
429 | overloaded | reason: concurrency_limit: the model's calls in flight are at its shared cap. reason: capacity_unavailable: the model is starting, moving or paused, no ready capacity serves it, or its capacity policy refused the request. | Wait Retry-After seconds and send again; for a model that is not ready the body carries the endpoint's state, estimate and status address. |
503 | model_not_ready | The endpoint was stopped; this call starts it. | Wait Retry-After, the readiness estimate, or make it ready first. |
503 | price_unavailable | A price cannot be set right now; nothing was admitted or charged. | Send again after Retry-After. |
200, then an error event | replacement_timeout | An admitted call's model was not ready again in the time a move is expected to take. | Send the conversation again once the endpoint is ready. |
200, then an error event | model_moving | An answer with several choices, held to a schema or grammar, or that had sent a tool call cannot be continued after a move. | Send the conversation again. |
Examples
A streamed answer that was carried across a move (an illustration, not a measurement):
curl -sN https://weights.fyi/run/v1/chat/completions -H "Authorization: Bearer $WEIGHTS_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "qwen3.8-27b", "stream": true, "max_tokens": 64, "messages": [{"role": "user", "content": "Name three rivers."}]}'data: {"id":"chatcmpl-6f1c","object":"chat.completion.chunk","model":"qwen3.8-27b","choices":[{"index":0,"delta":{"role":"assistant","content":"The"}}]}
: keepalive
data: {"id":"chatcmpl-6f1c","object":"chat.completion.chunk","model":"qwen3.8-27b","choices":[{"index":0,"delta":{"content":" Nile"}}]}
data: {"id":"chatcmpl-6f1c","object":"chat.completion.chunk","model":"qwen3.8-27b","choices":[],"usage":{"prompt_tokens":27,"completion_tokens":64,"total_tokens":91},"x-weights-recovered":1}
data: [DONE]Patterns
Retrying a new call
Treat 429 overloaded and 503 model_not_ready as "not yet": sleep the Retry-After seconds of the answer, then send the same request again, a bounded number of times. Do not retry a 400. An admitted call needs no retry of yours unless its stream ends with an error event.
History
- 2026-10-09: built, not live. A move no longer ends the answer: the call is held and continued on the new hardware.
- 2026-11-16: this page no longer promises that a new call waits through a start or a move, or that fields reach the model unchanged; both described an earlier build.