Chat completions#
POST /v1/chat/completions accepts model and messages. Each message has role and content. Optional fields include temperature, max_tokens, stream, tools, tool_choice and response_format when the deployed model supports them. Success returns id, object, choices and usage. Streaming returns text/event-stream.
Legacy completions#
POST /v1/completions accepts model and prompt. Supported only when the serving backend exposes completion mode for the requested model.
Embeddings#
POST /v1/embeddings uses model and input. Confirm a supported embedding deployment before using this endpoint; an unavailable service returns 503 service_unavailable. Check service status for availability.
Model discovery#
GET /v1/models lists connected deployment IDs. A catalogue entry describes the model and its rates; use model discovery and service status to check availability.
Response fields#
Non-streaming responses include usage.prompt_tokens and usage.completion_tokens. SSE finishes with an authoritative usage record followed by [DONE]. Provider errors are normalized and exclude internal credentials.
Auxiliary services#
Audio transcription, image generation, reranking and managed batch processing require their own supported deployments. Check service status before using them; unavailable operations return service_unavailable. A listed rate does not establish an active service.
Request example
curl https://weightsapi.com/v1/chat/completions \
-H "Authorization: Bearer $WEIGHTSAPI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "Qwen/Qwen3-32B",
"messages": [
{
"role": "user",
"content": "Hello!"
}
],
"stream": true
}'