Usage & analytics

Query spend, balance, and token usage programmatically with your API key — by model, by day, and by key.

Usage & analytics

Spend and usage are readable over the API with the same key you use for inference, under /v1/billing and /v1/usage. Use them to build your own dashboards, alert on burn rate, or attribute cost to a workload without instrumenting your application.

All of these are read-only GETs. Amounts are in micros — millionths of a dollar, so 61240000 is $61.24.

Endpoints

EndpointReturns
GET /v1/billing/balanceCredit balance and billing mode
GET /v1/billing/summarySpend and tokens over a window, by model, plus the balance
GET /v1/billing/transactionsLedger entries: charges, top-ups, credits. Team admins only
GET /v1/usage/summaryToken, request, and cost totals over a window, by model
GET /v1/usage/dailyThe same per day and model, for charting
GET /v1/usage/by-keySpend per API key, and rolled up by key tag
curl "https://api.sference.com/v1/billing/balance" \
  -H "Authorization: Bearer $SFERENCE_API_KEY"
{ "credit_balance_micros": 61240000, "billing_mode": "prepaid" }

What a key can see

A key sees what its owner sees in the console:

Key ownerUsageLedger
Team adminThe whole team; user_id narrows to one member✅
Department headTheir department❌ 403
MemberTheir own❌ 403

The balance is the team's and is visible to every member. For a team-wide dashboard, use a key owned by a team admin.

Windows and filters

ParameterOnMeaning
daysbilling/summary, usage/*Rolling window ending now. 1–365, default 30
monthusage/by-keyCalendar month YYYY-MM (UTC); overrides days
tagusage/by-keyOnly keys with this tag
user_idusage/summary, usage/dailyTeam admins: one member's usage
limit, starting_afterbilling/transactionsPage size (1–100, default 25) and the cursor from next_starting_after
# Last 7 days, by model
curl "https://api.sference.com/v1/usage/summary?days=7" \
  -H "Authorization: Bearer $SFERENCE_API_KEY"

# October, per key — the per-engineer view for coding agents
curl "https://api.sference.com/v1/usage/by-key?month=2026-10" \
  -H "Authorization: Bearer $SFERENCE_API_KEY"

Attribution comes from the key, not the payload

Every request is attributed to the API key that made it. That is why one key per engineer, per service, or per workload is the simplest way to get useful breakdowns — no application instrumentation, no tagging in the request body.

A burn-rate alert

GET /v1/usage/daily returns one item per day and model.

from collections import defaultdict

import requests

def check_burn_rate(threshold_usd: float = 50.0):
    r = requests.get(
        "https://api.sference.com/v1/usage/daily",
        headers={"Authorization": f"Bearer {SFERENCE_KEY}"},
        params={"days": 7},
    )
    r.raise_for_status()
    per_day = defaultdict(int)
    for item in r.json()["items"]:
        per_day[item["date"]] += item["cost_micros"]
    if not per_day:
        return
    avg = sum(per_day.values()) / len(per_day) / 1_000_000
    if avg > threshold_usd:
        alert(f"sference burn rate is ${avg:.2f}/day, above ${threshold_usd:.2f}")

In the console only

API keys are not accepted on /control/v1; those routes serve the console session and answer a key with 401. That covers the per-request activity log, the per-member and per-department reports, CSV exports, and top-ups — use the console for those.

Streams

A stream rolls up its own tokens and cost, which is the cleanest attribution when a workload spans many requests:

GET /v1/streams/{stream_id}

total_cost_micros on the stream detail is the workload's spend in millionths of a dollar.