Key status
GET /v1/key — limits, current-window usage and what's left, without opening the dashboard.
GET
https://iranrouter.com/v1/keyThis key's limits, current-window usage and what is left — without opening the dashboard. Enough for an agent to check headroom before starting heavy work.
{
"object": "key",
"plan": "pro",
"limits": {
"requests_per_minute": 60,
"requests_per_hour": 1000,
"requests_per_day": 10000,
"tokens_per_minute": 200000,
"monthly_budget_rial": null
},
"usage": {
"requests_this_hour": 42,
"requests_today": 380,
"spend_mtd_rial": 1840000
},
"remaining": {
"requests_this_hour": 958,
"requests_today": 9620,
"budget_rial": null
}
}null means unlimited, not zero. An agent that reads null as zero stops itself for no reason.
GET
https://iranrouter.com/v1/generation?id={request_id}One past request of this account by its x-request-id: tokens by class, counts (images, searches, OCR pages), Rial cost, latency and status — the numbers the dashboard shows. The row lands a few seconds after the answer; an immediate lookup may be a 404.
curl "https://iranrouter.com/v1/generation?id=3f6c...-request-id" -H "Authorization: Bearer ir-..."
{
"id": "3f6c...", "object": "generation", "model": "openai/gpt-4o-mini", "status": "success", "streamed": true,
"usage": { "prompt_tokens": 24, "completion_tokens": 108, "total_tokens": 132,
"prompt_tokens_details": { "cached_tokens": 0, "cache_write_tokens": 0, "audio_tokens": 0, "image_tokens": 0 },
"completion_tokens_details": { "reasoning_tokens": 0, "audio_tokens": 0, "image_tokens": 0 },
"cost_rial": 1840, "discount_pct": 0, "estimated": false },
"latency": { "ttft_ms": 412, "total_ms": 2210 }
}