Skip to content
Back to skills

Openrouter Usage Analytics

ASecurity

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'.

  • 4 stars
  • 0 votes
  • 0 copies
  • 4 views
  • Added September 10, 2026
devopsapidatabaseperformancedocumentation

Works with

  • cli
  • api

Security analysis

A100/100

Pro scans all 6 files and shows the line behind each finding

Scanned September 10, 2026

npx -y skills add micsapp/micstec-skills --skill openrouter-usage-analytics --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Openrouter Usage Analytics?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Openrouter Usage Analytics
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/micsapp-openrouter-usage-analytics/badge)](https://www.skillsdirectory.com/skills/micsapp-openrouter-usage-analytics)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: openrouter-usage-analytics
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
version: 1.0.0
license: MIT
author: Jeremy Longshore <jeremy@intentsolutions.io>
compatible-with: claude-code, codex, openclaw
---
# 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

1. **Instrument API calls**: Add middleware that captures timestamp, model, prompt/completion token counts, cost, latency, and status for every request
2. **Store metrics efficiently**: Write metrics to a time-series database (InfluxDB, TimescaleDB) or append-only table with proper indexing on timestamp and model
3. **Build aggregation queries**: Create queries for daily/weekly cost by model, average latency trends, token usage distribution, and error rates
4. **Create a dashboard**: Visualize key metrics — total spend over time, cost per model, average latency, requests per hour, and error rate trends
5. **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

- [OpenRouter Documentation](https://openrouter.ai/docs)
- [OpenRouter Models](https://openrouter.ai/models)
- [OpenRouter API Reference](https://openrouter.ai/docs/api-reference)
- [OpenRouter Status](https://status.openrouter.ai)

Files in this skill

  • SKILL.md2.6 KB
  • 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

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.