OpenAI-Compatible
Dooor OS exposes an OpenAI-compatible endpoint, allowing you to use any OpenAI SDK or library by simply changing the base URL and API key.
Compatibility: Works with the
openai Python package v1+ and the openai npm package v4+. Set baseURL to https://os-develop.dooor.ai/api/v1 and use your Dooor API key.Chat Completions
POST
/v1/chat/completionsStandard OpenAI chat completions format. Use the model field to route to a specific agent using its slug or ID:
By slug
agent:my-support-agentBy ID
agent:agt_01hx...Request Body
| Name | Type | Required | Description |
|---|---|---|---|
| model | string | required | Agent identifier prefixed with "agent:". Use slug or ID. |
| messages | array | required | Array of message objects with "role" (system|user|assistant) and "content" fields |
| stream | boolean | optional | Stream the response as SSE. Default: false |
| temperature | number | optional | Sampling temperature 0-2. Forwarded to the underlying model. |
| max_tokens | integer | optional | Maximum tokens to generate. |
Response
json
{
"id": "chatcmpl_01hx...",
"object": "chat.completion",
"created": 1705312000,
"model": "agent:my-support-agent",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "Hello! I'm here to help. What can I assist you with?"
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 24,
"completion_tokens": 18,
"total_tokens": 42
}
}bash
curl -X POST "https://os-develop.dooor.ai/api/v1/chat/completions" \
-H "Authorization: Bearer dor_sk_your_key_here" \
-H "Content-Type: application/json" \
-d '{
"model": "agent:my-support-agent",
"messages": [
{ "role": "user", "content": "Hello!" }
]
}'