usage


Description

{“what”:“Per-request LLM usage metrics: tokens, latency, cost, and outcome.”,“why”:“Without it, token consumption and cost attribution across services are unknown.”,“by”:“fleet-annotator-worker”,“at”:“2026-09-23T04:22:07.887782405+00:00”}

Columns

Column Type Size Nulls Auto Default Children Parents Comments
id bigserial 19 √ nextval('usage_id_seq'::regclass)

{“what”:“Surrogate primary key, auto-incrementing sequence value.”,“why”:“Provides a unique row identifier for joins and stable ordering.”,“by”:“fleet-annotator-worker”,“at”:“2026-09-23T04:22:07.935123076+00:00”}

request_id uuid 2147483647 null

{“what”:“UUID identifying the originating API request.”,“why”:“Links usage rows to request logs; without it, multiple calls per request are indistinguishable.”,“by”:“fleet-annotator-worker”,“at”:“2026-09-23T04:22:07.960345453+00:00”}

ts timestamptz 35,6 now()

{“what”:“UTC timestamp when the usage record was created.”,“why”:“Enables time-based aggregation and billing periods; missing it loses temporal context.”,“by”:“fleet-annotator-worker”,“at”:“2026-09-23T04:22:07.987548312+00:00”}

model text 2147483647 null

{“what”:“Model identifier string, e.g. ‘gpt-4o’.”,“why”:“Needed to apply per-model pricing and capacity planning.”,“by”:“fleet-annotator-worker”,“at”:“2026-09-23T04:22:08.031683276+00:00”}

from_service text 2147483647 'unknown'::text

{“what”:“Name of the calling service or component.”,“why”:“Attributes usage to the originating service for cost allocation and anomaly detection.”,“by”:“fleet-annotator-worker”,“at”:“2026-09-23T04:22:08.073408415+00:00”}

stream bool 1 false

{“what”:“True if the response was streamed, false if buffered.”,“why”:“Streaming affects token timing and cost; without it, latency metrics are misinterpreted.”,“by”:“fleet-annotator-worker”,“at”:“2026-09-23T04:22:08.141239671+00:00”}

prompt_tokens int8 19 0

{“what”:“Number of tokens in the input prompt.”,“why”:“Basis for input cost calculation and usage quotas.”,“by”:“fleet-annotator-worker”,“at”:“2026-09-23T04:22:08.176462815+00:00”}

completion_tokens int8 19 0

{“what”:“Number of tokens generated in the response.”,“why”:“Basis for output cost and throughput analysis.”,“by”:“fleet-annotator-worker”,“at”:“2026-09-23T04:22:08.201794803+00:00”}

reasoning_tokens int8 19 0

{“what”:“Tokens used for model reasoning (e.g., chain-of-thought).”,“why”:“Separates reasoning cost from completion; without it, cost attribution is incomplete.”,“by”:“fleet-annotator-worker”,“at”:“2026-09-23T04:22:08.227593285+00:00”}

cached_tokens int8 19 0

{“what”:“Tokens served from cache, not newly processed.”,“why”:“Affects pricing and latency; missing it overstates compute cost.”,“by”:“fleet-annotator-worker”,“at”:“2026-09-23T04:22:08.251209567+00:00”}

ttft_ms int8 19 √ null

{“what”:“Time to first token in milliseconds.”,“why”:“Measures perceived latency; without it, streaming responsiveness is unknown.”,“by”:“fleet-annotator-worker”,“at”:“2026-09-23T04:22:08.261682259+00:00”}

total_ms int8 19 √ null

{“what”:“Total request duration in milliseconds.”,“why”:“Provides end-to-end latency for performance monitoring.”,“by”:“fleet-annotator-worker”,“at”:“2026-09-23T04:22:08.278356702+00:00”}

decode_tok_s float8 17,17 √ null

{“what”:“Decode speed in tokens per second.”,“why”:“Indicates generation throughput; without it, efficiency comparisons are impossible.”,“by”:“fleet-annotator-worker”,“at”:“2026-09-23T04:22:08.299202381+00:00”}

status int4 10 √ null

{“what”:“HTTP status code or internal error code.”,“why”:“Distinguishes successful calls from failures; without it, error rate is unknown.”,“by”:“fleet-annotator-worker”,“at”:“2026-09-23T04:22:08.338212536+00:00”}

cost_usd float8 17,17 √ null

{“what”:“Monetary cost of the request in US dollars.”,“why”:“Directly feeds billing and budget tracking; missing it hides spend.”,“by”:“fleet-annotator-worker”,“at”:“2026-09-23T04:22:08.348717157+00:00”}

backend text 2147483647 √ null

{“what”:“Backend provider or endpoint used for the call.”,“why”:“Identifies which infrastructure served the request for reliability and cost analysis.”,“by”:“fleet-annotator-worker”,“at”:“2026-09-23T04:22:08.397640701+00:00”}

Indexes

Constraint Name Type Sort Column(s)
usage_pkey Primary key Asc id
usage_model_idx Performance Asc/Desc model + ts
usage_ts_idx Performance Desc ts

Relationships