Create a drop-in chat completion
POST https://weights.fyi/run/v1/proxy/chat/completions
Authorization: Bearer <token> scope: submit
[X-Request-Id: <uuid>]
{"model": "<model>", "messages": [...], "stream": true, ...}- Available since
- 2026-10-16: included in this build; see What is live for deployment status. No LLM chat model is available on this service yet.
- Answer time
- the model's own once it is ready; while it starts or moves, a refusal at once that says when to send again.
The chat call for a drop-in OpenAI client: set its base_url to https://weights.fyi/run/v1/proxy and nothing else changes. The request and the answer are those of POST /v1/chat/completions, with three things done for you. The first call for a model makes your workspace's endpoint for it, so no POST /v1/endpoints is needed. A call to a stopped model starts it and never answers 503 model_not_ready. And a call that names neither max_tokens nor max_completion_tokens is given a max_tokens of at most 16,384, less when the context has less room.
A new call is not held open through a start. While the model starts or moves, it is refused at once with 429 overloaded, reason: capacity_unavailable and Retry-After: wait that many seconds and send the same request again, until the model answers. A call already in flight when a move begins is carried for you, as the other chat call describes. Every refusal, a token's included, comes in OpenAI's error shape with the code inside an error object.
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-Jurisdictions | header | no | Country codes, EU or EEA: the call runs only on a model whose known location is inside them. |
model | body | yes | The exact id from GET /v1/proxy/models, kind llm. |
messages | body | yes | The conversation, OpenAI's shape; not empty. |
stream | body | no | true for server-sent events; refused for a model that answers whole responses only. |
max_tokens, max_completion_tokens | body | no | The answer's bound; one is set for you when you send neither. |
| the other OpenAI fields | body | no | As OpenAI defines them, where the model takes them: reasoning_effort is mapped onto the model's own settings, a cache_salt of your own is dropped, and a model served by your own workers refuses a field its workers did not declare. |
Return value
200 OK. Whole: one chat.completion. Streamed: text/event-stream chunks of chat.completion.chunk, then data: [DONE]; the last chunk carries usage.
| Field | Meaning |
|---|---|
X-Request-Id | Header: the call's id. |
usage | Prompt and completion tokens; after a move, the sum of both readings. |
x-weights-recovered | 1 when the answer was carried across a move; a whole answer also has the header X-Weights-Recovered: 1. |
Errors
Every refusal has OpenAI's shape, {"error": {"message": "...", "type": "...", "code": "...", "request_id": "..."}}.
| Status | Code | When it happens | What to do |
|---|---|---|---|
400 | invalid_request, invalid_json, invalid_jurisdictions, encrypted_envelope_required | No messages, a body that is not JSON, a field or a stream the model does not take (reason and field say which), or a confidential workspace sending a plain body. | Fix the request. |
400 | model_not_available | Your workspace has no such model. | Pick an id from error.available. |
401 | unauthorized, invalid_token, token_revoked, token_expired | No token, or one that does not work (any more). | Use a valid token. |
402 | no_credit, token_daily_cap, plan_budget_exhausted | No credit, the token's daily cap, or the compute plan the call belongs to has no budget left. | Add credit or raise the limit; do not retry as is. |
403 | scope_required, account_suspended | The token lacks submit, or the account is suspended. | Use a token with submit. |
409 | jurisdiction_refused, compute_plan_not_runnable, compute_plan_conflict, request_already_admitted | No model inside the jurisdictions you allow, a compute plan that ended or cannot be told apart, or a request id that was already admitted. | Read the message, then act. |
413, 422 | body_too_large, invalid_request | The body is over the call's limit, or the model's own check refused the prompt before the call was admitted; message says why. | Send less, or fix the prompt. |
429 | overloaded | reason: capacity_unavailable: the model is starting, moving or paused. reason: concurrency_limit: its calls in flight are at the cap. | Wait Retry-After seconds and send again. |
429 | campaign_concurrency_limited, rate_limited | A compute plan's share of the model is in use, or the token's request rate. | Wait Retry-After seconds and send that call again; the plan goes on. |
502 | model_error, model_moving, completion_unacknowledged, execution_unclaimed | The model did not answer, or an answer could not be carried or confirmed. | Send the conversation again. |
503 | price_unavailable, capacity_temporarily_unavailable | No price can be set, or no capacity, right now; nothing was charged. | Send again after Retry-After. |
Examples
curl -s https://weights.fyi/run/v1/proxy/chat/completions -H "Authorization: Bearer $WEIGHTS_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "qwen3.8-27b", "max_tokens": 64, "messages": [{"role": "user", "content": "Name three rivers."}]}'{"id": "chatcmpl-6f1c", "object": "chat.completion", "model": "qwen3.8-27b",
"choices": [{"index": 0, "message": {"role": "assistant", "content": "The Nile, the Amazon and the Yangtze."}, "finish_reason": "stop"}],
"usage": {"prompt_tokens": 27, "completion_tokens": 12, "total_tokens": 39}}Patterns
Sending again while the model starts
A stopped model takes typical_ready_seconds to start (GET /v1/proxy/models). Treat 429 as "not yet": sleep for Retry-After, send the identical request, and stop at your own deadline. Give an OpenAI client enough retries and a timeout above that start time, or loop around it yourself.
History
- 2026-10-16: built.
- 2026-11-16: this page added.
See also
- POST /v1/chat/completions for the answer's fields and what a move does to a stream.
- LLM endpoints and Rate limits.