Multi-provider AI Prometheus exporter. Collects usage and cost metrics from AI providers and exposes them in Prometheus format.
Currently supported providers:
- OpenAI — token usage, request counts, and cost data via the Organization API
| Metric | Type | Labels | Description |
|---|---|---|---|
robotheus_openai_requests_total |
Counter | model, project, api_key_id |
Total API requests |
robotheus_openai_tokens_total |
Counter | model, project, api_key_id, direction |
Total tokens (direction: input or output) |
robotheus_openai_cost_usd_total |
Counter | project |
Cumulative cost in USD since exporter start |
robotheus_openai_cost_usd_today |
Gauge | project |
Cost in USD since midnight UTC today |
robotheus_openai_cost_usd_week |
Gauge | project |
Cost in USD over the last 7 days |
robotheus_openai_cost_usd_month |
Gauge | project |
Cost in USD over the last 30 days |
robotheus_openai_cost_usd_daily |
Gauge | project, date |
Cost in USD per calendar day (date: YYYY-MM-DD), used for week/month time series panels |
- Python 3.12+
- uv
export OPENAI_API_KEY="sk-..."
uv run robotheus| Flag | Default | Description |
|---|---|---|
--web.listen-address |
:9185 |
Listen address |
--scrape.interval |
60 |
Usage scrape interval in seconds |
--cost.window-interval |
1800 |
How often to refresh the cost window gauges (today/week/month) in seconds |
--log.level |
info |
Log level (debug, info, warning, error) |
| Variable | Required | Description |
|---|---|---|
OPENAI_API_KEY |
Yes | OpenAI API key |
OPENAI_ORG_ID |
No | OpenAI Organization ID |
docker run -e OPENAI_API_KEY="sk-..." -p 9185:9185 ghcr.io/thepetk/robotheus:latest# install dependencies
uv sync --all-extras
# run tests
make test
# run linter
make ruff
# run type checker
make ty
# install pre-commit hooks
make pre-commit-installYou're more than welcome to contribute to the project. Feel free to open a PR!