Rubric
API reference for Rubric, which writes chat titles and one-line previews of emails, messages, tickets and agent actions, at $0.10 per million input tokens.
Rubric writes two kinds of line:
- Title: a chat title of 2 to 7 words.
- Preview: a line of at most 15 words that tells the reader what an item in a list is about.
Send the chat or item as JSON. Rubric returns one line of text.
Endpoints
| Method | Path | Returns |
|---|---|---|
POST |
/api/inference/rubric/v1/titles |
A title for a chat. |
POST |
/api/inference/rubric/v1/previews |
A preview of an item. |
Base URL: https://api.divergentlabs.xyz. Authenticate with an API key as a bearer token. The key needs the inference:invoke scope. Keys created by div login do not have it. Create one under Settings in the dashboard.
Titles
POST /api/inference/rubric/v1/titles
| Field | Type | Required | Description |
|---|---|---|---|
messages |
array | yes | The chat, oldest first. |
messages[].content |
string | yes | The message text. |
messages[].role |
string | at least one of role and name |
user or assistant. |
messages[].name |
string | at least one of role and name |
The sender’s name. |
Long chats are shortened before the model reads them. Each message keeps its first 4,200 and last 1,800 characters, and the chat keeps about 12,000 characters in total. Messages beyond that are counted but not included.
Example
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?"}]}'
{
"object": "title",
"model": "rubric",
"text": "Docker container exiting immediately",
"fallback": false,
"usage": { "input_tokens": 45, "output_tokens": 6 },
"latency_ms": 363
}
Previews
POST /api/inference/rubric/v1/previews
| Field | Type | Required | Description |
|---|---|---|---|
kind |
string | yes | email, message, ticket, issue, event, doc or agent_action. |
item |
object | yes | The item. Fields depend on kind, below. |
reader |
string | no | The name of the person viewing the list. Their name is marked as “(you)” in the item, so a message they sent is previewed as “You offered to…”. |
language |
string | no | Only "English" is accepted. Previews are always in English. |
Item fields for all kinds except agent_action
All fields are optional strings.
| Field | Description |
|---|---|
subject, title, channel, status, when, where |
Headers, read in this order. |
from, to, cc |
Names, comma-separated. The reader’s name is marked in each. |
date |
The date, formatted as you display it. |
body |
The newest message. The first 8,400 and last 3,600 characters are kept. |
thread |
Earlier messages, in the same format as messages for titles. Used as context. Only the newest message is summarized. |
Item fields for agent_action
| Field | Type | Required | Description |
|---|---|---|---|
tool |
string | yes | The tool’s name. |
arguments |
object or string | no | The tool call’s arguments. |
result |
string | no | The tool’s output. Omit it or send null while the tool is running, and the preview describes the action in progress, such as “Searching the web for…”. |
context |
string | no | What the agent was doing. |
Example
curl https://api.divergentlabs.xyz/api/inference/rubric/v1/previews \
-H "Authorization: Bearer $DIVERGENT_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"kind": "email",
"reader": "Sam Haddad",
"item": {
"from": "Ines Okafor",
"to": "Sam Haddad",
"subject": "Re: coffee",
"body": "Hey Sam! Want to come to the Harbour Street café instead? We could work from there afterwards."
}
}'
{
"object": "preview",
"model": "rubric",
"text": "Ines suggests meeting at the Harbour Street café to work afterwards.",
"fallback": false,
"usage": { "input_tokens": 93, "output_tokens": 14 },
"latency_ms": 518
}
Response
| Field | Type | Description |
|---|---|---|
object |
string | title or preview. |
model |
string | rubric. |
text |
string | One line, with no quotes or label. |
fallback |
boolean | true if text is a fallback, below. |
usage.input_tokens |
integer | Input tokens billed. |
usage.output_tokens |
integer | Output tokens. Not billed. |
latency_ms |
integer | Time the model took, excluding network time between you and the API. |
Validation and fallbacks
Every line is validated before it is returned:
| Kind | Rules |
|---|---|
| Title | 2 to 8 words. No quotes, no emoji, no trailing full stop. English, one line. |
| Preview | 1 to 20 words, at most 160 characters. English, one line. |
If the line fails validation, text is a fallback and fallback is true:
| Request | Fallback text |
|---|---|
| Title | New conversation |
agent_action preview |
Running <tool>…, or Ran <tool> if result is set |
| Other previews | The subject, else the title, else the first line of the body, cut to 15 words |
Requests with a fallback are billed like any other request.
Pricing
| Tokens | Price |
|---|---|
| Input | $0.10 per million |
| Output | free |
Usage is totaled per UTC day and charged from the org’s credit in whole cents. There is no per-request fee. The dashboard’s Billing page shows charges per model, and the Usage page lists each request.
Errors
{ "error": { "code": "invalid_request", "type": "invalid_request_error", "message": "…", "param": "item.tool" } }
| Status | code |
Cause | Fix |
|---|---|---|---|
| 401 | unauthorized |
The key is missing or revoked. | Send a valid key in the Authorization header. |
| 402 | insufficient_credit |
The org has no credit. | Add credit on the Billing page. |
| 403 | insufficient_scope |
The key lacks inference:invoke. |
Create a key with that scope under Settings. |
| 404 | model_not_found |
The path names a model that does not support titles and previews. | Use /api/inference/rubric/v1/…. |
| 422 | invalid_request |
A field is missing or has the wrong type. param is its path, such as messages[0].content. |
Fix the named field. |
| 502 | upstream_unavailable |
The model did not respond. Not billed. | Retry. |
| 503 | not_configured |
The model is not available. | Retry later. |