Docs/DevThrottle API/Chat
API

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.

POST/chat/completions
Create a chat completion. Supports server-sent-event streaming with "stream": true.

Request

ParameterTypeRequiredDescription
modelstringRequiredA model id from GET /models. Unknown models are rejected outright - there is no silent substitution.
messagesarrayRequiredThe conversation, OpenAI chat format: objects with role and content.
streambooleanOptionaltrue streams tokens as SSE chunks in the OpenAI chunk format.
max_tokens, temperature, ...variousOptionalStandard OpenAI sampling parameters are passed through to the model.
Example
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 with its cost.

Models and billing

The models your key can call - and therefore what you can put in model - come from GET /models; the list depends on your account. Requests are billed from your prepaid credits per token; each request's exact cost shows in Usage.

Note
A request that fails returns an error without debiting credits - you pay for completions you received, not for attempts. Error shapes are on errors and limits.