Viro API

Account & usage API

Check a key, your balance, your spend and recent requests with the same API key you call models with. All three endpoints are read-only and free, and cover your whole account (every key), the same as the Usage page.

Ask your coding agent

Viro's docs MCP server has account tools built on these endpoints: check_setup, get_usage, list_requests and get_request. Connect it with your key, then ask things like "is my Viro key working?", "what did I spend this week?" or "why did my last request fail?":

# Claude Code
claude mcp add --transport http viro-docs https://console.viro.app/mcp --header "Authorization: Bearer $VIRO_API_KEY"

# Codex CLI
codex mcp add viro-docs --url https://console.viro.app/mcp --bearer-token-env-var VIRO_API_KEY

The server passes your key to the endpoints below and doesn't store it. Without a key, the docs tools still work.

GET /v1/account

Whether the key works, the balance, and the key's name, environment, rate limit and spend limit. A quick way to check a setup.

curl https://api.viro.app/v1/account -H "Authorization: Bearer $VIRO_API_KEY"
{
  "object": "account",
  "status": "active",
  "balance_usd": 25.81,
  "can_make_requests": true,
  "key": {
    "name": "laptop",
    "prefix": "viro_sk_live_ab12cd34",
    "environment": "live",
    "rate_limit_rpm": 60,
    "spend_limit_usd": null,
    "spent_usd": null,
    ...
  },
  "endpoints": { "base_url": "https://api.viro.app/v1", ... }
}
GET /v1/usage

Spend, requests, errors, tokens and estimated energy over the last days days (1 to 90, default 7, UTC): in total, per model (highest spend first) and per day.

curl "https://api.viro.app/v1/usage?days=30" -H "Authorization: Bearer $VIRO_API_KEY"

Each block has requests, errors, input_tokens, output_tokens, cached_input_tokens, spend_usd, renewable_verified_share, and energy_wh and co2e_g as lower and upper estimates (see Energy & Emissions). Per-model rows are keyed by the model that ran, so a router's requests appear under the models it picked.

GET /v1/requests

Recent requests, newest first. Optional filters:

  • limit: 1 to 100, default 20.
  • status: success or error.
  • model: a model ID or router, matching either what was asked for or what ran.
curl "https://api.viro.app/v1/requests?status=error&limit=5" -H "Authorization: Bearer $VIRO_API_KEY"
curl https://api.viro.app/v1/requests/<id> -H "Authorization: Bearer $VIRO_API_KEY"

Each request shows its status and error_code, requested_model (what you asked for, e.g. viro/clean) and model (what ran), the provider, the client tool that sent it, tokens, cost_usd, latency, whether it ran on renewable-verified infrastructure, and this_key (made with the key you're calling with). The id is the x-request-id header of the original response.

Prompts and completions are never stored, so they aren't here. Only requests that reached a model are recorded: one refused before that (bad key, unknown model, no credit, rate limit) got its error in the response and has no entry. See Errors.