Budgets & Control

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

scrape_configs:
  - job_name: cognocient
    metrics_path: /api/metrics/prometheus
    scheme: https
    scrape_interval: 60s
    authorization:
      credentials: "<your Cognocient key>"
    static_configs:
      - targets: ["api.cognocient.com"]

Metrics

MetricTypeLabelsMeaning
cognocient_spend_usd_totalcounterprovider, model, featureMonth-to-date spend in USD
cognocient_requests_totalcounterprovider, model, feature, statusRequests by HTTP status class (2xx, 4xx, 5xx)
cognocient_tokens_totalcounterprovider, model, feature, directionTokens, direction is prompt or completion
cognocient_request_latency_ms_sumcounterprovider, model, feature, statusTotal latency in ms; divide by requests for the mean
cognocient_budget_used_ratiogaugebudget, scope, modeBudget spend divided by its monthly limit
cognocient_budget_limit_usdgaugebudget, scope, modeConfigured monthly limit

Untagged calls appear with feature="unattributed".

Example alerts

# Spend rate: more than $50 in the last hour
increase(cognocient_spend_usd_total[1h]) > 50

# Any budget above 90% used
cognocient_budget_used_ratio > 0.9

# Error rate above 5% for a model
sum by (model) (increase(cognocient_requests_total{status="5xx"}[15m]))
  / sum by (model) (increase(cognocient_requests_total[15m])) > 0.05

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

On this page