API guide
doorflow uses the OpenAI API. Set the base URL, use a df- key, and choose a model.
Quick start
| Setting | Value |
|---|---|
| Base URL | http://<host>:52005/v1 — on the same machine, http://127.0.0.1:52005/v1. |
| API key | A key starting with df-. Ask your operator to issue one, or to replace a lost key. |
| Model | Any model the engine serves. List them with GET /v1/models. |
export OPENAI_BASE_URL=http://127.0.0.1:52005/v1 export OPENAI_API_KEY=df-…
Set these two values in your tool's provider settings. The fields may be called Base URL, API base or api_base.
Python
from openai import OpenAI
client = OpenAI(
base_url="http://127.0.0.1:52005/v1",
api_key="df-…",
)
reply = client.chat.completions.create(
model="qwen3.8-flash-next-q2_0",
messages=[{"role": "user", "content": "hello"}],
)
print(reply.choices[0].message.content)JavaScript
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "http://127.0.0.1:52005/v1",
apiKey: "df-…",
});
const reply = await client.chat.completions.create({
model: "qwen3.8-flash-next-q2_0",
messages: [{ role: "user", content: "hello" }],
});curl
curl http://127.0.0.1:52005/v1/chat/completions \
-H "Authorization: Bearer df-…" \
-H "Content-Type: application/json" \
-d '{"model":"qwen3.8-flash-next-q2_0","messages":[{"role":"user","content":"hello"}]}'Add "stream": true to stream. Put the key in Authorization: Bearer <key> or x-api-key.
Check GET /v1/models first. If it returns models, your URL and key work.
Limits
Keys can limit requests, tokens, spend, request and token rate, and concurrent requests. Token limits cover input, cache write, cache read and output, and can be daily, monthly or lifetime.
When a limit is reached the gateway returns 429 with the limit and the amount used:
{
"error": {
"type": "insufficient_quota",
"code": "insufficient_quota",
"message": "You exceeded your current quota: daily request quota reached (500/500).",
"limit": "requests_per_day",
"limit_value": 500,
"used": 500
}
}Rate limits also include requested, reset_s and a Retry-After header. Successful responses include x-ratelimit-remaining-* headers.
Check a key with the usage checker, or send GET /me with the key.
Priority
A key can carry a request priority. normal (the default) is served at once; high is served as soon as the current generation finishes; low only while the gateway has no other activity; and ultra preempts the requests in flight.
Errors
| Status | Meaning | What to do |
|---|---|---|
| 401 | Missing or wrong key. | Check the key. |
| 403 | Key disabled or expired. | Ask your operator for a new key. |
| 429 | A limit or rate limit was reached. | Wait for Retry-After or the next period. |
| 502 / 504 | The engine did not answer. | Retry; tell your operator if it continues. |
| 503 | The gateway is restarting. | Retry after Retry-After seconds. |
| 503 | An ultra key preempted this request (error.type request_preempted). | Retry when the urgent work is done. |
All errors use the same OpenAI shape: error.type, error.code and error.message.