YOUR APPS. YOUR WORKFLOW.

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/v1

Open 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

FieldAccepted value
modelRequired model ID, up to 200 characters.
messages1–60 text messages. Roles: system, user, assistant. Up to 100,000 characters per message and a 200,000-byte request body.
streamBoolean, defaults to false.
max_tokensInteger 1–4096, defaults to 1024.
temperatureOptional 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

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"}}
StatusMeaning
400 / 413 / 415Invalid fields, oversized body or incorrect content type.
401Missing, expired or revoked API key.
403Email verification is required, or AI access has been paused by the owner.
429Request/day/concurrency limit, or upstream service busy.
502 / 503 / 504AI 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.