Vanguard AI

Account & usage

Inspect your balance and usage, and configure where results are stored.

Balance

GET /v1/account/balance API key
200 Balance
{ "status": "success", "balance": 100, "plan": "FREE" }

A key with assigned credits

An organization can set credits aside for one API key — an agency gives each of its clients a key with its own budget. Only that key can spend them. Such a key reads only itself: balance is what it can spend, keyCredits is its budget, and the usage endpoints below return its own calls only.

200 Balance (key with assigned credits)
{
  "status": "success",
  "scope": "key",
  "balance": 820,
  "keyCredits": { "balance": 820, "assignedTotal": 1000, "spentTotal": 180, "onEmpty": "stop" }
}

When the assigned credits run out, calls fail with 402 KEY_CREDITS_EXHAUSTED — unless the owner set the key to continue on the organization’s shared credits. Credits are assigned in the dashboard, under API keys → Credits.

Usage history

GET /v1/account/usage API key

Query parameters

service
string
Filter by service, e.g. "ocr".
status
success | error
Filter by outcome.
apiKeyId
uuid
Filter by the key that made the call.
from
YYYY-MM-DD
First day of the range.
to
YYYY-MM-DD
Last day of the range (inclusive).
tz
UTC | Asia/Vientiane
Which days from/to mean. Default UTC; Asia/Vientiane matches your invoices.
limit
integer
Page size. Default 20.
offset
integer
Page offset. Default 0.
200 Recent events + summary
{
  "status": "success",
  "recent": [
    { "id": "...", "service": "ocr", "credits": 1, "latencyMs": 842, "status": "success", "createdAt": "..." }
  ],
  "summary": [ { "service": "ocr", "calls": 42, "credits": 42 } ]
}

Aggregate stats

GET /v1/account/usage/stats API key

Returns aggregates by service, by key, by status, and a time series — handy for building a usage dashboard.

Overview

GET /v1/account/usage/overview API key

Everything the dashboard’s Reports page shows, in one call: totals for the period and for the equal period before it, a daily series, and the top services, keys, projects and members. Takes from, to (days, default this month so far), tz (default Asia/Vientiane), and the filters service, apiKeyId (or none for the web app), projectId and userId. Each top list ignores only its own filter, so a filtered row stays visible beside its peers. Postpaid organizations also get amounts in kip at their contract rate. A key with assigned credits sees only itself.

Bring-your-own storage

GET /v1/account/storage API key
POST /v1/account/storage API key

Configure an S3‑compatible bucket to hold stored results.

JSON body (POST)

endpoint *
uri
S3-compatible endpoint URL.
region
string
Bucket region.
bucket *
string
Bucket name.
accessKeyId *
string
Access key id.
secretAccessKey *
string
Secret access key (stored encrypted).