Guardrails and usage

token_usage_metrics

Read the release-matched token usage metrics documentation and its scope.

Praxis AI Development (bcdcfdbcf963) 2 min read

Switching projects opens that project’s default documentation release.

Versions marked “overview” do not contain this page. Selecting one opens that version’s documentation overview.

On this page

Emits bounded per-tenant Prometheus token counters from token.* metadata.

Configuration Notes

The filter fails configuration unless tenant and model allowlists are explicit. Requests without authenticated tenant metadata are skipped. Values outside either allowlist map to fixed overflow labels.

The admin /metrics endpoint remains an operator boundary: protect it with network policy and authentication. Prometheus labels do not provide tenant authorization or billing-grade accounting.

Declare this filter before token_count so response hooks (which run in reverse order) extract counts first.

Configuration

FieldTypeRequiredDescription
tenant_metadata_keystringnoExact unnamespaced metadata key populated from verified credentials by an authentication filter. Namespaced keys are rejected because identity_header_guard stores unverified client headers there.
allowed_tenantsstring[]yesTenant labels admitted as their own Prometheus series.
allowed_modelsstring[]yesModel labels admitted as their own Prometheus series.
overflow_tenantstringnoLabel for an authenticated tenant not in allowed_tenants.
overflow_modelstringnoLabel for a model not in allowed_models.