Model monitoring
Monitoring groups usage by provider connection and actual upstream model. Public aliases of the same upstream model on one connection are aggregated. Provider identity uses the credential connection name when available; inline addresses remove authentication and query parameters. Selectors combine authorized deployments and visible historical records.
The catalog returned in options follows the current caller’s effective grants: a virtual key uses its organization/team/project/key intersection; a session without team_id reads the account’s current team and organization. An explicit team is checked by UsageScope before its model grants are read. Platform administrators retain the full catalog. Authorization lookup failures reject the request rather than falling back to an unrestricted catalog. Historical statistics keep their existing usage scope, so revoking a model does not erase the caller’s own usage; the interface can still offer those visible historical combinations.
Billing and monitoring buckets commit in the same PostgreSQL transaction. Statistics change only after an idempotent billing insert succeeds. Task settlement subtracts the previous value and adds the settled value. Queued billing becomes visible after persistence.
Fifteen-minute UTC buckets retain organization, team, project, user, key, billing ownership, provider and upstream-model dimensions. Batches merge matching buckets and apply UPSERTs in stable key order. Queries read aggregated buckets, with a window of 1–90 days and timezone offsets aligned to 15 minutes. High-cardinality dimensions increase storage and query cost; local tests are not a production load benchmark.
TTFT records the first upstream response byte/data segment, which can contain metadata rather than visible text. TPS uses output tokens × 1000 / (total milliseconds − first-byte milliseconds), and only successful uncached streamed text with positive output and a valid interval contributes a sample. Input tokens never inflate generation speed; synchronous responses have no TPS sample because their response-read tail cannot represent model generation. Cross-bucket means are weighted by valid sample counts. Request, token and cost totals continue to include all recorded terminal requests.
Startup upgrades rebuild output TPS once from retained usage events in a transaction shared with billing writes. New output-TPS columns keep the corrected metric separate from legacy writers. Only performance sums/sample counts are rebuilt; historical billing, request counts, tokens and other measurements are retained. Buckets whose original events have been purged keep their totals but show no TPS sample. A completion marker makes repeated startup idempotent; a failed rebuild rolls back and fails startup.
The bilingual Recharts interface displays at most eight chart series while retaining all combinations in the detail table. Deploy matching console, gateway and database structures. Missing interface structures produce a retryable error.
Request log amounts and reasoning effort
Log tables, session views, metrics and cost breakdowns share a USD formatter that preserves the numeric precision supplied by the API. Small nonzero costs do not round to $0.00; real zero remains $0.00, and missing values remain unknown. This only changes presentation, not pricing or billing.
The log reasoning_effort field records an explicitly requested Chat reasoning_effort, Responses reasoning.effort, or Messages output_config.effort. It is persisted independently of prompt storage. Missing settings and pre-upgrade records remain unknown; model defaults, thinking budgets and actual provider behavior are not inferred. Startup adds the column idempotently without replaying bills.