divergent/docs

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

  1. In the dashboard, go to Settings and create an API key with the inference:invoke scope. Keys created by div login do not have this scope.

  2. Export the key:

    export DIVERGENT_API_KEY=dv_live_...
  3. 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.

esc