Models
Small models that each do one job in a product, such as writing chat titles and inbox previews, called over HTTP and billed per token.
What they are
Each model does one job. You send it the item as JSON, not a prompt, and it returns one line of text. Every line is validated before it is returned. If a line fails validation, the response contains a fallback line built from your input and fallback: true.
| Model | What it does | Price |
|---|---|---|
| Rubric | Writes a chat title of 2 to 7 words, and a one-line preview of an email, message, ticket, issue, event, doc or agent action. | $0.10 per million input tokens. Output is free. |
What it costs
Models are billed per token from the org’s credit. There is no per-request fee. Token usage is totaled per model per UTC day and charged in whole cents. Each response includes the usage it was billed for.
A request from an org with no credit is rejected with 402 insufficient_credit before the model runs. The dashboard’s Billing page shows charges per model. The Usage page lists each request with its API key and latency.
Quickstart
-
In the dashboard, go to Settings and create an API key with the
inference:invokescope. Keys created bydiv logindo not have this scope. -
Export the key:
export DIVERGENT_API_KEY=dv_live_... -
Request a title for a chat:
curl https://api.divergentlabs.xyz/api/inference/rubric/v1/titles \ -H "Authorization: Bearer $DIVERGENT_API_KEY" \ -H "Content-Type: application/json" \ -d '{"messages": [{"role": "user", "content": "why does my docker container exit immediately?"}]}'The response looks like this:
{ "object": "title", "model": "rubric", "text": "Docker container exiting immediately", "fallback": false, "usage": { "input_tokens": 45, "output_tokens": 6 }, "latency_ms": 363 }
To try requests without writing code, use Playground in the dashboard. It shows the equivalent curl command as you edit.
Base URL
Each model has its own base URL:
https://api.divergentlabs.xyz/api/inference/<model>/v1
Authenticate with the API key as a bearer token.
Errors
Every model returns errors in the same format. Branch on code. message is for people and can change.
{ "error": { "code": "invalid_request", "type": "invalid_request_error", "message": "…", "param": "item.tool" } }
Each model’s page lists its error codes. A 502 means the model did not respond, and the request is not billed.