create-agent-tui
Scaffolds a complete agent TUI in TypeScript using @openrouter/agent — like create-react-app for terminal agents. Generates a…
Answer natural-language questions about a user's OpenRouter usage data — spend, request volume, model breakdown, latency, token usage, and cost optimization. Use when the user asks about their API usage, billing, costs, top models, traffic patterns, or wants to optimize their
$ npx -y skills add openrouterteam/skills --skill openrouter-analytics --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/openrouter-analyticsContext preview
The summary Claude sees to decide when to auto-load this skill.
Answer natural-language questions about a user's OpenRouter usage data — spend, request volume, model breakdown, latency, token usage, and cost optimization. Use when the user asks about their API usage, billing, costs, top models, traffic patterns, or wants to optimize their
name: openrouter-analytics description: Answer natural-language questions about a user's OpenRouter usage data — spend, request volume, model breakdown, latency, token usage, and cost optimization. Use when the user asks about their API usage, billing, costs, top models, traffic patterns, or wants to optimize their OpenRouter spend. version: 0.1.0
Query your OpenRouter usage data programmatically. Answer questions like "What was my spend this month?", "Which models cost the most?", and "How can I reduce my bill?" using the Analytics API.
cd <skill-path>/scripts && npm install
| User wants to… | Do this | |---|---| | Know what data is available | Run `discover-schema.ts` to see metrics, dimensions, and filters | | See spend / usage / volume | Run `query-analytics.ts` with appropriate metrics | | Break down by model, provider, API key | Add `--dimensions` to the query | | See trends over time | Add `--granularity day` (or `hour`, `week`, `month`) | | Reduce costs | Run `suggest-queries.ts`, find the cost optimization template, execute it | | Inspect individual generations | Add `--dimensions generation_id`, then use the `openrouter-generations` skill for details | | Break down by classifier labels | Use `classifier_dimensions` in the request body (see `openrouter-analytics-query` skill) | | Filter by classifier labels | Use `classifier_filters` in the request body (see `openrouter-analytics-query` skill) | | Answer a specific question | Map the question → metrics + dimensions, then query |
The recommended workflow for answering a user's analytics question:
1. **Discover** — Call `discover-schema.ts` to see available metrics and dimensions 2. **Map** — Translate the user's question into metrics, dimensions, filters, and time range 3. **Query** — Execute via `query-analytics.ts` 4. **Interpret** — Analyze the returned data and explain the results
For common questions, `suggest-queries.ts` provides ready-made query templates.
cd <skill-path>/scripts && npx tsx discover-schema.ts
Returns the full schema: metrics, dimensions, filter operators, and granularities.
Filter to a specific section:
npx tsx discover-schema.ts --section metrics npx tsx discover-schema.ts --section dimensions npx tsx discover-schema.ts --section operators npx tsx discover-schema.ts --section granularities
See the `openrouter-analytics-schema` skill for detailed guidance on interpreting the schema response and mapping user questions to the right metrics and dimensions.
cd <skill-path>/scripts && npx tsx query-analytics.ts --metrics request_count,total_usage
See the `openrouter-analytics-query` skill for the full parameter reference and query construction guide.
Spend over the last 7 days, broken down by day:
npx tsx query-analytics.ts --metrics total_usage --granularity day
Top 10 models by cost:
npx tsx query-analytics.ts --metrics total_usage,request_count --dimensions model --order-by total_usage --limit 10
Usage by API key:
npx tsx query-analytics.ts --metrics request_count,tokens_total --dimensions api_key_id --order-by request_count --limit 10
Latency by provider (limited to 31-day range):
npx tsx query-analytics.ts --metrics avg_latency,p90_latency --dimensions provider --order-by p90_latency
Usage cost breakdown (credits, BYOK, upstream, cache, data logging, web search):
npx tsx query-analytics.ts --metrics credits_usage,byok_usage,byok_fees,usage_upstream,usage_cache,usage_data,usage_web --granularity day
cd <skill-path>/scripts && npx tsx suggest-queries.ts
Returns a list of pre-built query templates for common questions, each with:
The query endpoint returns an array of data rows. Each row is a flat object with keys matching the requested metrics and dimensions.
When interpreting results for the user:
A collection of Agent Skills for building with OpenRouter — a unified API for 600+ AI models.
Scaffolds a complete agent TUI in TypeScript using @openrouter/agent — like create-react-app for terminal agents. Generates a…
Scaffolds a headless agent in TypeScript using @openrouter/agent and Bun — for CLI tools, API servers, queue workers, and…
Install Ori and run the user's existing coding agent CLI through Ori on OpenRouter, with OAuth sign-in, model selection,…
Migration guide from @openrouter/sdk to @openrouter/agent for callModel, tool(), stop conditions, and agent features. This skill…
Construct and execute analytics queries against the OpenRouter API — full parameter reference for metrics, dimensions, filters,…
Discover the OpenRouter analytics schema — available metrics, dimensions, filter operators, and granularities. Use when you need…