openrouter-usage-analytics
Installation
SKILL.md
OpenRouter Usage Analytics
Overview
OpenRouter provides usage data through three endpoints: GET /api/v1/auth/key (credit balance and rate limits), GET /api/v1/generation?id= (per-request cost and metadata), and response usage fields (token counts). This skill covers collecting metrics from these sources, building analytics pipelines, cost reporting, and performance dashboards.
Prerequisites
- An OpenRouter API key (
sk-or-v1-...) exported asOPENROUTER_API_KEY— see theopenrouter-install-authskill for setup - Python 3.8+ with the OpenAI SDK plus
requests(used to fetch exact per-request cost from the generation endpoint);sqlite3(stdlib) backs the analytics database curlandjqfor the Credit Balance Monitoring one-linerHTTP-Referer/X-Titleheaders set on the client if you also want OpenRouter dashboard attribution