usage


Description

{“what”:“One row per LLM API request, capturing token counts, latency, and cost.”,“why”:“Without it, no auditable record of model usage or billing exists.”,“by”:“fleet-annotator-worker”,“at”:“2026-09-23T04:26:31.556986393+00:00”}

Columns

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

{“what”:“Surrogate primary key; unique row identifier.”,“why”:“Without it, rows cannot be uniquely referenced for updates or joins.”,“by”:“fleet-annotator-worker”,“at”:“2026-09-23T04:26:31.603491711+00:00”}

request_id uuid 2147483647 null

{“what”:“UUID of the originating API request, as sent by the client.”,“why”:“Without it, multiple usage rows cannot be correlated to a single logical request.”,“by”:“fleet-annotator-worker”,“at”:“2026-09-23T04:26:31.644713068+00:00”}

ts timestamptz 35,6 now()

{“what”:“UTC timestamp when the usage record was created.”,“why”:“Without it, time-based aggregation and latency analysis are impossible.”,“by”:“fleet-annotator-worker”,“at”:“2026-09-23T04:26:31.661665941+00:00”}

model text 2147483647 null

{“what”:“Model identifier string, e.g. ‘gpt-4o’.”,“why”:“Without it, cost and performance cannot be attributed to a specific model.”,“by”:“fleet-annotator-worker”,“at”:“2026-09-23T04:26:31.728484387+00:00”}

from_service text 2147483647 'unknown'::text

{“what”:“Name of the service that issued the request, defaulting to ‘unknown’.”,“why”:“Without it, usage cannot be attributed to the originating service for billing or monitoring.”,“by”:“fleet-annotator-worker”,“at”:“2026-09-23T04:26:31.780638753+00:00”}

stream bool 1 false

{“what”:“Flag indicating whether the request used streaming response.”,“why”:“Without it, streaming vs non-streaming latency and token behavior cannot be distinguished.”,“by”:“fleet-annotator-worker”,“at”:“2026-09-23T04:26:31.912599859+00:00”}

prompt_tokens int8 19 0

{“what”:“Number of tokens in the prompt (input) for this request.”,“why”:“Without it, input token consumption and cost cannot be calculated.”,“by”:“fleet-annotator-worker”,“at”:“2026-09-23T04:26:32.186662228+00:00”}

completion_tokens int8 19 0

{“what”:“Number of tokens in the completion (output) for this request.”,“why”:“Without it, output token consumption and cost cannot be calculated.”,“by”:“fleet-annotator-worker”,“at”:“2026-09-23T04:26:32.460997852+00:00”}

reasoning_tokens int8 19 0

{“what”:“Number of tokens used for reasoning (e.g., chain-of-thought) if reported.”,“why”:“Without it, reasoning-specific token usage and its cost impact are unknown.”,“by”:“fleet-annotator-worker”,“at”:“2026-09-23T04:26:32.483777645+00:00”}

cached_tokens int8 19 0

{“what”:“Number of prompt tokens served from cache, if any.”,“why”:“Without it, cache hit rate and its cost savings cannot be measured.”,“by”:“fleet-annotator-worker”,“at”:“2026-09-23T04:26:32.506369195+00:00”}

ttft_ms int8 19 √ null

{“what”:“Time to first token in milliseconds, if measured.”,“why”:“Without it, perceived latency for streaming responses cannot be assessed.”,“by”:“fleet-annotator-worker”,“at”:“2026-09-23T04:26:32.538394595+00:00”}

total_ms int8 19 √ null

{“what”:“Total request duration in milliseconds, from start to finish.”,“why”:“Without it, end-to-end latency and performance SLAs cannot be evaluated.”,“by”:“fleet-annotator-worker”,“at”:“2026-09-23T04:26:32.573737289+00:00”}

decode_tok_s float8 17,17 √ null

{“what”:“Average decode speed in tokens per second, if computed.”,“why”:“Without it, generation throughput cannot be compared across models or configurations.”,“by”:“fleet-annotator-worker”,“at”:“2026-09-23T04:26:32.590364947+00:00”}

status int4 10 √ null

{“what”:“HTTP status code or internal status of the request, if available.”,“why”:“Without it, failed or partial requests cannot be filtered out of usage analysis.”,“by”:“fleet-annotator-worker”,“at”:“2026-09-23T04:26:32.622756520+00:00”}

cost_usd float8 17,17 √ null

{“what”:“Monetary cost of the request in US dollars, if calculated.”,“why”:“Without it, total spend and budget tracking are impossible.”,“by”:“fleet-annotator-worker”,“at”:“2026-09-23T04:26:32.659155122+00:00”}

backend text 2147483647 √ null

{“what”:“Identifier of the backend or provider that served the request, if known.”,“why”:“Without it, multi-provider or multi-backend cost and performance cannot be compared.”,“by”:“fleet-annotator-worker”,“at”:“2026-09-23T04:26:32.682824643+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