DoubleX AgentesDocs

API reference › Resources

Chat

Call an AI model directly, without an agent, with a full response or streaming.

POST/api/chat/completions#

Sends messages straight to a model, with no agent instructions, connectors or saved history. Use it to classify, summarize, extract data or generate text inside your systems.

FieldTypeDescription
messagesarray, 1 to 200Required. Items { "role": "user" | "assistant", "content": "text" }.
modelstringprovider/model, for example anthropic/claude-sonnet-5.5. Without it, the default is used: DoubleX Auto (openrouter/auto) in organizations with platform credits. See the IDs in Models.
systemstringSystem instruction.
maxTokensnumber, 1 to 128,000Token limit for the response.
temperaturenumber, 0 to 2
streambooleantrue to receive it in chunks. Default false.

Full response#

curl -X POST https://doublex.ai/api/chat/completions \
  -H "Authorization: Bearer $DOUBLEX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "system": "Reply with only Positive, Negative or Neutral.",
    "messages": [{ "role": "user", "content": "Loved the service, they solved it fast." }]
  }'
JSON
{
  "provider": "openrouter",
  "model": "openrouter/auto",
  "servedModel": "google/gemini-3.8-flash",
  "text": "Positive",
  "usage": { "inputTokens": 31, "outputTokens": 2, "costUsd": 0.00002 }
}

servedModel is the model that actually answered (useful with DoubleX Auto).

Streaming#

With "stream": true, the response arrives as NDJSON:

NDJSON
{"type":"delta","text":"Posi"}
{"type":"delta","text":"tive"}
{"type":"done","provider":"openrouter","model":"openrouter/auto","servedModel":"google/gemini-3.8-flash","text":"Positive","usage":{"inputTokens":31,"outputTokens":2,"costUsd":0.00002}}
typeFields
deltatext: the next chunk of the response.
doneThe full response, with text, usage and the model used.
errorerror: the error message.

If you close the connection midway, the model call is cancelled too.

Errors#

StatuscodeWhen
400no_providerNo model is available to you.
400model_unavailableThe requested model isn't in the catalog or isn't enabled.
402no_creditsThe organization is out of credits.
402plan_requiredThe organization has not chosen a plan yet.
502provider_errorThe model provider failed. In streaming, it arrives as an error event.

Each call consumes credits based on the model's cost and shows up in the Usage and credits report with the source Terminal (CLI).