A connection to Dabel AI.
Add AI chat to your own app with a private key and a simple HTTP request.
Local base URL · http://127.0.0.1:3000/v1Open Dabel AI → Developer API. Sign in, create a named key, and copy it once. Keep it in your app’s server environment as DABEL_API_KEY. The API key grants chat and model-list access; it cannot read saved chats or projects.
1. Choose a model
Use a model ID returned by your server. The owner must configure the AI provider before these endpoints can return responses.
curl http://127.0.0.1:3000/v1/models \
-H "Authorization: Bearer $DABEL_API_KEY"The response has object: "list" and a data array containing model IDs.
2. Send a message
curl http://127.0.0.1:3000/v1/chat/completions \
-H "Authorization: Bearer $DABEL_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "your-model-id",
"messages": [{"role": "user", "content": "Hello Dabel!"}],
"max_tokens": 512
}'Shell examples use Bash syntax. Replace your-model-id with an ID from /v1/models. Read the answer from choices[0].message.content.
{
"id": "dabel-…",
"object": "chat.completion",
"created": 1800000000,
"model": "your-model-id",
"choices": [{
"index": 0,
"message": {"role": "assistant", "content": "Hello!"},
"finish_reason": "stop"
}]
}This is an illustrative response. Token usage is included only when returned by the provider.
Stream the answer
Add "stream": true and use curl -N. The server sends SSE data: events. Text arrives in choices[0].delta.content, followed by a finish event and data: [DONE]. A stream error has an error object; an interrupted stream does not end with a successful completion marker.
Dabel client libraries
The 0.1.0 beta client bundle contains JavaScript and Python clients with streaming, timeouts and structured errors. Download the client bundle and copy the client files into your backend project. JavaScript requires Node.js 22+; Python requires Python 3.10+. Neither client needs third-party packages.
JavaScript
import {DabelAI} from './javascript/dabel.mjs';
const client = new DabelAI({
apiKey: process.env.DABEL_API_KEY,
baseURL: process.env.DABEL_BASE_URL || 'http://127.0.0.1:3000/v1',
});
const models = await client.listModels();
const answer = await client.chat({
model: models.data[0].id,
messages: [{role: 'user', content: 'Hello Dabel!'}],
});
console.log(answer.choices[0].message.content);
Python
import os
from dabel_ai import DabelAI
client = DabelAI(
api_key=os.environ['DABEL_API_KEY'],
base_url=os.environ.get('DABEL_BASE_URL', 'http://127.0.0.1:3000/v1'),
)
model = client.list_models()['data'][0]['id']
answer = client.chat({
'model': model,
'messages': [{'role': 'user', 'content': 'Hello Dabel!'}],
})
print(answer['choices'][0]['message']['content'])For streaming use JavaScript for await (const event of client.stream(request)), or Python with client.stream(request) as events:. JavaScript accepts an AbortSignal for cancellation. Python closes the stream when its context exits. JavaScript's timeout covers the full request; Python's timeout applies to each blocking network operation. Requests are not automatically retried.
Supported request fields
| Field | Accepted value |
|---|---|
model | Required model ID, up to 200 characters. |
messages | 1–60 text messages. Roles: system, user, assistant. Up to 100,000 characters per message and a 200,000-byte request body. |
stream | Boolean, defaults to false. |
max_tokens | Integer 1–4096, defaults to 1024. |
temperature | Optional number 0–2, subject to the selected model’s support. |
Images, tools, file inputs and other request fields are not supported by this release. Messages sent through this API are not saved as workspace conversations.
Keys and limits
- Up to 10 active keys per account, with a 7, 30 or 90 day expiry.
- Web and API chat share the account's configured daily and minute AI allowances. Owner-specific limits, output caps and paused access apply to both.
- The API also limits each key to 20 requests per minute and API chat to 100 attempts per day across an account's keys. The lower applicable allowance wins. Daily counters reset at midnight UTC.
- Model-list requests consume the API key's minute allowance; chat also consumes account AI quota. Accepted chat attempts count even when the provider fails. Validation errors, missing provider configuration and concurrency rejections do not count.
- At most two simultaneous API requests per account; the server shares three AI request slots with the web app.
- Quota and request counts are stored in SQLite. Minute limits use fixed UTC minute windows.
- Revoking a key stops new requests. Changing or resetting the account password revokes all its API keys.
- Keys cannot be retrieved again. Create a replacement if you lose one. Creation is limited to 10 attempts per 15 minutes per account.
Responses include X-RateLimit-Limit and X-RateLimit-Remaining. Limit errors include Retry-After. The SDK exposes that delay as retryAfter in JavaScript or retry_after in Python.
Errors
{"error":{"message":"Provide a valid Dabel API key.",
"type":"authentication_error","code":"invalid_api_key"}}| Status | Meaning |
|---|---|
| 400 / 413 / 415 | Invalid fields, oversized body or incorrect content type. |
| 401 | Missing, expired or revoked API key. |
| 403 | Email verification is required, or AI access has been paused by the owner. |
| 429 | Request/day/concurrency limit, or upstream service busy. |
| 502 / 503 / 504 | AI connection failed, is not configured, or timed out. |
Connecting from another system
The local app listens on 127.0.0.1, so this address works on the same computer. For other devices or hosted apps, first deploy Dabel AI on a reachable HTTPS domain and use that domain followed by /v1. Browser cross-origin access is disabled; call Dabel from your app’s backend.