How do I scrape Cognocient spend into Prometheus or Grafana?
A Prometheus metrics endpoint for month-to-date AI spend, requests, tokens, latency and budget utilisation, scrapeable into Prometheus, Grafana Cloud or any compatible tool. Growth plan and above.
GET /api/metrics/prometheus returns your AI spend in the Prometheus text
exposition format, so you can graph and alert on it next to the rest of your
infrastructure. Available on the Growth plan and above.
Scrape configuration
Metrics
| Metric | Type | Labels | Meaning |
|---|---|---|---|
cognocient_spend_usd_total | counter | provider, model, feature | Month-to-date spend in USD |
cognocient_requests_total | counter | provider, model, feature, status | Requests by HTTP status class (2xx, 4xx, 5xx) |
cognocient_tokens_total | counter | provider, model, feature, direction | Tokens, direction is prompt or completion |
cognocient_request_latency_ms_sum | counter | provider, model, feature, status | Total latency in ms; divide by requests for the mean |
cognocient_budget_used_ratio | gauge | budget, scope, mode | Budget spend divided by its monthly limit |
cognocient_budget_limit_usd | gauge | budget, scope, mode | Configured monthly limit |
Untagged calls appear with feature="unattributed".
Example alerts
Month-to-date, and bounded
Counters reset at the start of each UTC month, which Prometheus handles in
rate() and increase(). Series are capped at the 500 highest-spend
provider, model and feature combinations; the remainder is folded into
feature="__other__", so a tenant with thousands of tags cannot overwhelm a
scraper.
Frequently asked questions
Related articles