openrouter-usage-analytics
Track and analyze OpenRouter API usage patterns. Use when optimizing costs or understanding usage trends. Trigger with phrases like 'openrouter analytics', 'openrouter usage', 'openrouter metrics', 'track openrouter'.
- License 许可
- MIT
- 最近更新
- 2026-05-26
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- openrouter-usage-analytics
- author
- Jeremy Longshore <jeremy@intentsolutions.io>
- license
- MIT
- version
- 1.0.0
- description
- Track and analyze OpenRouter API usage patterns. Use when optimizing costs or understanding usage trends. Trigger with phrases like 'openrouter analytics', 'openrouter usage', 'openrouter metrics', 'track openrouter'.
- allowed-tools
- Read, Write, Edit, Grep
- compatible-with
- claude-code, codex, openclaw
02 资源文件 5
- 参考文档references/custom-analytics-implementation.md6.2 KB
- 参考文档references/dashboard-export.md1.9 KB
- 参考文档references/errors.md323 B
- 参考文档references/examples.md4.7 KB
- 参考文档references/performance-analytics.md2.2 KB
03 SKILL.md 正文
Openrouter Usage Analytics
Overview
This skill demonstrates building usage analytics for OpenRouter to track costs, token usage, model popularity, and performance metrics over time.
Prerequisites
- OpenRouter integration with logging
- Data storage for metrics (database, time-series DB, or analytics service)
Instructions
- Instrument API calls: Add middleware that captures timestamp, model, prompt/completion token counts, cost, latency, and status for every request
- Store metrics efficiently: Write metrics to a time-series database (InfluxDB, TimescaleDB) or append-only table with proper indexing on timestamp and model
- Build aggregation queries: Create queries for daily/weekly cost by model, average latency trends, token usage distribution, and error rates
- Create a dashboard: Visualize key metrics — total spend over time, cost per model, average latency, requests per hour, and error rate trends
- Set up automated reports: Schedule daily or weekly summary emails/alerts with top-line metrics and any anomalies detected
Output
- Analytics pipeline capturing cost, latency, and usage per request
- Dashboard with charts for spend, token usage, model distribution, and errors
- Automated weekly report summarizing key usage trends and anomalies
Error Handling
| Error | Cause | Fix |
|---|---|---|
| Missing metrics for some requests | Instrumentation middleware not covering all paths | Centralize all API calls through a single instrumented client |
| Metric storage growing too fast | High request volume with verbose logging | Aggregate metrics hourly/daily; keep raw data only for recent period |
| Dashboard showing stale data | Query or aggregation pipeline lagging | Check pipeline health; add alerting on data freshness |
See ${CLAUDE_SKILL_DIR}/references/errors.md for full error reference.
Examples
See ${CLAUDE_SKILL_DIR}/references/examples.md for runnable code samples.
Resources
04 同仓库更多 Skills
zustand-store-ts
Create Zustand stores with TypeScript, subscribeWithSelector middleware, and proper state/action separation. Use when building React state management, creating global stores, or implementing reactive state patterns with Zustand.
zustand-store-creator
Zustand Store Creator - Auto-activating skill for Frontend Development. Triggers on: zustand store creator, zustand store creator Part of the Frontend Development skill category.
zero-trust-config-helper
Zero Trust Config Helper - Auto-activating skill for Security Advanced. Triggers on: zero trust config helper, zero trust config helper Part of the Security Advanced skill category.
zapier-integration-helper
Zapier Integration Helper - Auto-activating skill for Business Automation. Triggers on: zapier integration helper, zapier integration helper Part of the Business Automation skill category.
zai-cli
Execute z.AI CLI providing vision, search, reader, and GitHub exploration via CLI and MCP. Use when user needs image/video analysis, OCR, UI-to-code conversion, error diagnosis, real-time web search, web page to markdown extraction, or GitHub code exploration. Trigger with phrases like "analyze this image", "search the web for", "read this page", "explore this repo", or "use zai". Requires Z_AI_API_KEY.
yt-research
Research competitor YouTube channels, niches, and trending topics for your content strategy. Use this skill whenever the user says "research channels", "analyze competitors", "find trending topics", "niche analysis", "competitive research", "what are other creators doing", "scrape YouTube channels", or wants to understand the competitive landscape for a specific tool or topic area. Use when working with yt research. Trigger with 'yt', 'research'.