Chat completions
3 min read
OpenAI-compatible chat completions. Send the same request body you would send to the OpenAI API; DevThrottle routes it to the model you name and streams the response back.
/chat/completions"stream": true.Request
| Parameter | Type | Required | Description |
|---|---|---|---|
model | string | Required | A model id from GET /models. Unknown models are rejected outright - there is no silent substitution. |
messages | array | Required | The conversation, OpenAI chat format: objects with role and content. |
stream | boolean | Optional | true streams tokens as SSE chunks in the OpenAI chunk format. |
max_tokens, temperature, ... | various | Optional | Standard OpenAI sampling parameters are passed through to the model. |
curl https://devthrottle.com/api/v1/chat/completions -H "Authorization: Bearer $DEVTHROTTLE_API_KEY" -H "Content-Type: application/json" -d '{
"model": "MODEL_ID_FROM_/models",
"messages": [{"role": "user", "content": "Say hello."}]
}'Response
The OpenAI chat-completion object (or SSE chunks when streaming), including the usage block with token counts. The same usage appears in your Usage page.
Models and billing
The models you can put in model come from GET /models; the catalog is the same for every account. Chat completions are direct catalog-model calls, billed from prepaid credits per token; each request shows in Usage.
When there is nothing left to bill, the request is declined before it runs. An empty credit balance returns 402 with insufficient_credits, and your own monthly spending limit returns 402 with monthly_limit_reached. In both cases no model was called and nothing was debited - top up, or raise the limit in Billing.
Limits
A burst limit applies per account. Over it, the endpoint answers 429 with rate_limit_exceeded and "type": "rate_limit_error": slow down and retry after a moment rather than hot-looping. No per-account quota is published yet - see errors and limits for the full status-code list and what each one means.