LLM Metrics

Track LLM request latency, token usage, and billed spend across providers and models. See Labels for request and agent dimensions.

Metrics

MetricTypeExtra LabelsMeasures
llm_request_duration_secondsHistogramstatus_codeLLM request duration
llm_tokens_totalCountertype (input, output)Tokens used. input excludes prompt-cache tokens.
llm_cache_tokens_totalCountercache_type (read, write)Prompt-cache tokens read from or written to the provider cache
llm_token_usageHistogramInput plus output tokens per request
llm_cost_totalCounterbilling_mode, auth_methodEstimated list-price cost in USD. Needs model pricing.
llm_cache_cost_totalCounterCost in USD of prompt-cache reads and writes
llm_cache_savings_totalCounterUSD saved by cache reads at the discounted price
llm_time_to_first_token_secondsHistogramStreaming: from the upstream call to the provider's first chunk
llm_time_to_first_byte_secondsHistogramStreaming: from request receipt to the first byte sent to the client
llm_tokens_per_secondHistogramOutput token throughput
llm_blocked_tools_totalCounterTool calls blocked by guardrails
agent_runs_totalCounterexternal_agent_idUnique runs, counted by the X-Archestra-Run-Id header
llm_active_usersGaugewindow (24h, 7d) onlyDistinct users with at least one LLM request in the window

billing_mode is metered for per-token billing and subscription for flat-rate subscription credentials. Billed spend is sum(llm_cost_total{billing_mode="metered"}). auth_method is provider_key, virtual_key, passthrough_virtual_key, jwks, oauth_client_credentials, oauth_user, internal, or unknown.

llm_time_to_first_byte_seconds minus llm_time_to_first_token_seconds is the time Archestra spends before the upstream call: authentication and guardrails.

Every replica reports the same llm_active_users value, so aggregate it with max(), not sum(). ARCHESTRA_METRICS_ACTIVE_USERS_REFRESH_INTERVAL_MS sets the refresh interval; 0 turns the metric off.

LLM and MCP metrics carry trace exemplars, so a Grafana panel can link a data point to its trace. See Exemplars.