Documentation
LLM endpoints
View .mdOpenAPI

Create a drop-in chat completion

POSThttps://weights.fyi/run/v1/proxy/chat/completionsscope: submit
text
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

NameWhereRequiredMeaning
AuthorizationheaderyesBearer and a token with submit.
X-Request-IdheadernoA UUID to follow the call by; answered back in the header of the same name. One is made when you send none.
X-Weights-JurisdictionsheadernoCountry codes, EU or EEA: the call runs only on a model whose known location is inside them.
modelbodyyesThe exact id from GET /v1/proxy/models, kind llm.
messagesbodyyesThe conversation, OpenAI's shape; not empty.
streambodynotrue for server-sent events; refused for a model that answers whole responses only.
max_tokens, max_completion_tokensbodynoThe answer's bound; one is set for you when you send neither.
the other OpenAI fieldsbodynoAs 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.

FieldMeaning
X-Request-IdHeader: the call's id.
usagePrompt and completion tokens; after a move, the sum of both readings.
x-weights-recovered1 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": "..."}}.

StatusCodeWhen it happensWhat to do
400invalid_request, invalid_json, invalid_jurisdictions, encrypted_envelope_requiredNo 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.
400model_not_availableYour workspace has no such model.Pick an id from error.available.
401unauthorized, invalid_token, token_revoked, token_expiredNo token, or one that does not work (any more).Use a valid token.
402no_credit, token_daily_cap, plan_budget_exhaustedNo 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.
403scope_required, account_suspendedThe token lacks submit, or the account is suspended.Use a token with submit.
409jurisdiction_refused, compute_plan_not_runnable, compute_plan_conflict, request_already_admittedNo 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, 422body_too_large, invalid_requestThe 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.
429overloadedreason: 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.
429campaign_concurrency_limited, rate_limitedA 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.
502model_error, model_moving, completion_unacknowledged, execution_unclaimedThe model did not answer, or an answer could not be carried or confirmed.Send the conversation again.
503price_unavailable, capacity_temporarily_unavailableNo price can be set, or no capacity, right now; nothing was charged.Send again after Retry-After.

Examples

sh
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."}]}'
json
{"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