Skip to main content
Ottili AI API

Ottili AI API — Credits & usage fields

How AI usage is metered with credits in the public Ottili AI API, and which usage fields are returned per request.

Ottili AI usage is credit-based. Each request consumes credits according to the model, input and output size, and any tool execution. Credits are tracked per company and enforced before dispatch.

Budget controls

A monthly AI budget is configured in Settings → AI. When the budget or remaining credits are exhausted, generation requests return a clear error rather than over-spending. No charges occur without an explicit, configured budget.

Usage fields

Every successful generation response includes a usage object:

{
  "usage": {
    "prompt_tokens": 182,
    "completion_tokens": 47,
    "total_tokens": 229
  }
}
When the upstream provider does not report exact counts, usage.source is "estimated" and cache/reasoning detail fields are omitted — never invented. The console labels estimated usage honestly.
FieldTypeDescription
prompt_tokensintegerTokens sent in the request.
completion_tokensintegerTokens generated in the response.
total_tokensintegerprompt_tokens + completion_tokens.
creditsnumberCredits consumed by this request.

Streaming responses report usage in the final event.

Checking remaining credits

Credit balance and limits are reported through the developer identity and company endpoints; do not poll the generation endpoint to track spend. Cache the balance and react to usage-limit errors instead.

Exceeding limits

When the credit balance or monthly budget is exhausted, generation

requests return insufficient_balance (HTTP 402) or rate_limit_exceeded

(HTTP 429) with a machine-readable body, rather than over-spending.

Top up the budget in Settings → AI to resume.

Was this article helpful?