Usage
GET /v1/usage
Returns aggregated request counters for the calling API key — requests, successes, errors, tokens, and durations over a rolling period.
curl "https://ghostmind.optdmsa.com/v1/usage?period=7d" \ -H "Authorization: Bearer $GHOSTMIND_API_KEY"Query parameters:
| Parameter | Values | Default | Description |
|---|---|---|---|
period | 24h, 7d, 30d | 7d | Aggregation window |
Response (200):
{ "period": "7d", "scope": "api_key", "total_requests": 142, "successful": 138, "errors": 3, "rate_limited": 1, "total_tokens_in": 40211, "total_tokens_out": 88340, "total_duration_ms": 912000, "by_model": [ {"model": "auto", "requests": 142, "tokens_in": 40211, "tokens_out": 88340} ], "by_day": [ {"date": "2026-09-24", "requests": 60, "tokens": 71000} ]}Scope and privacy
- A scoped API key sees only its own records (
scope: "api_key"). - The legacy operator key (no key id) aggregates across tenants
(
scope: "all"). - The endpoint exposes no cost figures, quotas, provider internals, or other tenants’ data — only counters the caller produced.
Limits
- Counters are estimates derived from recorded usage — treat token totals as approximations, not billing truth.
- Usage is recorded per completed request; in-flight streaming requests appear once they finish.
Next Steps
- Errors — Error envelope
- Rate Limits — Throttling contract
- Capabilities — Feature discovery