<?xml version="1.0" encoding="UTF-8"?><database name="basetenrhythm" schema="public" type="PostgreSQL - 18.4 (Ubuntu 18.4-1.pgdg24.04+1)">
   <sequences>
      <sequence increment="1" name="usage_id_seq" startValue="1"/>
   </sequences>
   <tables>
      <table name="usage" remarks="{&quot;what&quot;:&quot;One row per LLM API call, with token counts, cost, and latency.&quot;,&quot;why&quot;:&quot;Without it, no auditable record of model usage for cost allocation and monitoring.&quot;,&quot;by&quot;:&quot;fleet-annotator-worker&quot;,&quot;at&quot;:&quot;2026-09-23T04:04:08.638231509+00:00&quot;}" schema="public" type="TABLE">
         <column autoUpdated="true" defaultValue="nextval('usage_id_seq'::regclass)" digits="0" id="0" name="id" nullable="false" remarks="{&quot;what&quot;:&quot;Surrogate primary key, auto-incrementing integer.&quot;,&quot;why&quot;:&quot;Uniquely identifies each usage row for joins and updates.&quot;,&quot;by&quot;:&quot;fleet-annotator-worker&quot;,&quot;at&quot;:&quot;2026-09-23T04:04:08.749568782+00:00&quot;}" size="19" type="bigserial" typeCode="-5"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="1" name="request_id" nullable="false" remarks="{&quot;what&quot;:&quot;UUID of the originating API request.&quot;,&quot;why&quot;:&quot;Links usage to the caller's request for debugging and deduplication.&quot;,&quot;by&quot;:&quot;fleet-annotator-worker&quot;,&quot;at&quot;:&quot;2026-09-23T04:04:08.858560161+00:00&quot;}" size="2147483647" type="uuid" typeCode="1111"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="2" name="ts" nullable="false" remarks="{&quot;what&quot;:&quot;Timestamp when the usage record was created.&quot;,&quot;why&quot;:&quot;Enables time-based aggregation and billing periods.&quot;,&quot;by&quot;:&quot;fleet-annotator-worker&quot;,&quot;at&quot;:&quot;2026-09-23T04:04:08.893711602+00:00&quot;}" size="35" type="timestamptz" typeCode="93"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="3" name="provider" nullable="false" remarks="{&quot;what&quot;:&quot;Name of the LLM provider (e.g., OpenAI, Anthropic).&quot;,&quot;why&quot;:&quot;Distinguishes costs and metrics across different vendors.&quot;,&quot;by&quot;:&quot;fleet-annotator-worker&quot;,&quot;at&quot;:&quot;2026-09-23T04:04:08.919560123+00:00&quot;}" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="4" name="route" nullable="false" remarks="{&quot;what&quot;:&quot;API endpoint or route that handled the request.&quot;,&quot;why&quot;:&quot;Identifies which service feature generated the usage.&quot;,&quot;by&quot;:&quot;fleet-annotator-worker&quot;,&quot;at&quot;:&quot;2026-09-23T04:04:08.946427948+00:00&quot;}" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="5" name="model" nullable="false" remarks="{&quot;what&quot;:&quot;Model identifier (e.g., gpt-4o, claude-3).&quot;,&quot;why&quot;:&quot;Needed to apply correct pricing and capacity planning.&quot;,&quot;by&quot;:&quot;fleet-annotator-worker&quot;,&quot;at&quot;:&quot;2026-09-23T04:04:08.982568919+00:00&quot;}" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="'unknown'::text" digits="0" id="6" name="from_service" nullable="false" remarks="{&quot;what&quot;:&quot;Internal service that initiated the request.&quot;,&quot;why&quot;:&quot;Allows per-team or per-service cost attribution.&quot;,&quot;by&quot;:&quot;fleet-annotator-worker&quot;,&quot;at&quot;:&quot;2026-09-23T04:04:09.097597403+00:00&quot;}" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="7" name="service_tier" nullable="true" remarks="{&quot;what&quot;:&quot;Tier of service (e.g., free, pro) if applicable.&quot;,&quot;why&quot;:&quot;Differentiates pricing or quotas by customer tier.&quot;,&quot;by&quot;:&quot;fleet-annotator-worker&quot;,&quot;at&quot;:&quot;2026-09-23T04:04:09.184589699+00:00&quot;}" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="false" digits="0" id="8" name="stream" nullable="false" remarks="{&quot;what&quot;:&quot;Whether the response was streamed.&quot;,&quot;why&quot;:&quot;Streaming affects latency and cost calculation.&quot;,&quot;by&quot;:&quot;fleet-annotator-worker&quot;,&quot;at&quot;:&quot;2026-09-23T04:04:09.204752810+00:00&quot;}" size="1" type="bool" typeCode="-7"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="9" name="status" nullable="false" remarks="{&quot;what&quot;:&quot;HTTP status code of the API response.&quot;,&quot;why&quot;:&quot;Identifies failed requests for retry and error analysis.&quot;,&quot;by&quot;:&quot;fleet-annotator-worker&quot;,&quot;at&quot;:&quot;2026-09-23T04:04:09.220422420+00:00&quot;}" size="10" type="int4" typeCode="4"/>
         <column autoUpdated="false" defaultValue="0" digits="0" id="10" name="prompt_tokens" nullable="false" remarks="{&quot;what&quot;:&quot;Number of tokens in the input prompt.&quot;,&quot;why&quot;:&quot;Basis for input cost and context length monitoring.&quot;,&quot;by&quot;:&quot;fleet-annotator-worker&quot;,&quot;at&quot;:&quot;2026-09-23T04:04:09.266611250+00:00&quot;}" size="19" type="int8" typeCode="-5"/>
         <column autoUpdated="false" defaultValue="0" digits="0" id="11" name="completion_tokens" nullable="false" remarks="{&quot;what&quot;:&quot;Number of tokens generated in the response.&quot;,&quot;why&quot;:&quot;Basis for output cost and generation length.&quot;,&quot;by&quot;:&quot;fleet-annotator-worker&quot;,&quot;at&quot;:&quot;2026-09-23T04:04:09.311580159+00:00&quot;}" size="19" type="int8" typeCode="-5"/>
         <column autoUpdated="false" defaultValue="0" digits="0" id="12" name="cached_tokens" nullable="false" remarks="{&quot;what&quot;:&quot;Tokens served from cache, if any.&quot;,&quot;why&quot;:&quot;Cache hits reduce cost; needed for accurate billing.&quot;,&quot;by&quot;:&quot;fleet-annotator-worker&quot;,&quot;at&quot;:&quot;2026-09-23T04:04:09.459211565+00:00&quot;}" size="19" type="int8" typeCode="-5"/>
         <column autoUpdated="false" defaultValue="0" digits="0" id="13" name="reasoning_tokens" nullable="false" remarks="{&quot;what&quot;:&quot;Tokens used for reasoning (e.g., chain-of-thought).&quot;,&quot;why&quot;:&quot;Separates reasoning cost from final output.&quot;,&quot;by&quot;:&quot;fleet-annotator-worker&quot;,&quot;at&quot;:&quot;2026-09-23T04:04:09.551255679+00:00&quot;}" size="19" type="int8" typeCode="-5"/>
         <column autoUpdated="false" defaultValue="null" digits="17" id="14" name="cost_reported_usd" nullable="true" remarks="{&quot;what&quot;:&quot;Cost reported by provider in USD.&quot;,&quot;why&quot;:&quot;Provides actual billed amount for reconciliation.&quot;,&quot;by&quot;:&quot;fleet-annotator-worker&quot;,&quot;at&quot;:&quot;2026-09-23T04:04:09.648819059+00:00&quot;}" size="17" type="float8" typeCode="8"/>
         <column autoUpdated="false" defaultValue="0" digits="17" id="15" name="cost_estimated_usd" nullable="false" remarks="{&quot;what&quot;:&quot;Estimated cost in USD from internal pricing.&quot;,&quot;why&quot;:&quot;Used when provider cost is unavailable or delayed.&quot;,&quot;by&quot;:&quot;fleet-annotator-worker&quot;,&quot;at&quot;:&quot;2026-09-23T04:04:09.666948197+00:00&quot;}" size="17" type="float8" typeCode="8"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="16" name="ttft_ms" nullable="true" remarks="{&quot;what&quot;:&quot;Time to first token in milliseconds.&quot;,&quot;why&quot;:&quot;Measures perceived latency for streaming responses.&quot;,&quot;by&quot;:&quot;fleet-annotator-worker&quot;,&quot;at&quot;:&quot;2026-09-23T04:04:09.678617302+00:00&quot;}" size="19" type="int8" typeCode="-5"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="17" name="total_ms" nullable="false" remarks="{&quot;what&quot;:&quot;Total request duration in milliseconds.&quot;,&quot;why&quot;:&quot;Monitors API performance and timeout issues.&quot;,&quot;by&quot;:&quot;fleet-annotator-worker&quot;,&quot;at&quot;:&quot;2026-09-23T04:04:09.693926920+00:00&quot;}" size="19" type="int8" typeCode="-5"/>
         <column autoUpdated="false" defaultValue="null" digits="17" id="18" name="output_tok_s" nullable="true" remarks="{&quot;what&quot;:&quot;Output tokens per second (completion_tokens / (total_ms - ttft_ms)).&quot;,&quot;why&quot;:&quot;Indicates generation speed for capacity planning.&quot;,&quot;by&quot;:&quot;fleet-annotator-worker&quot;,&quot;at&quot;:&quot;2026-09-23T04:04:09.711723263+00:00&quot;}" size="17" type="float8" typeCode="8"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="19" name="error" nullable="true" remarks="{&quot;what&quot;:&quot;Error message or code if the request failed.&quot;,&quot;why&quot;:&quot;Provides failure reason for debugging and alerting.&quot;,&quot;by&quot;:&quot;fleet-annotator-worker&quot;,&quot;at&quot;:&quot;2026-09-23T04:04:09.729425310+00:00&quot;}" size="2147483647" type="text" typeCode="12"/>
         <primaryKey column="id" sequenceNumberInPK="1"/>
         <index name="usage_pkey" unique="true">
            <column ascending="true" name="id"/>
         </index>
         <index name="usage_model_idx" unique="false">
            <column ascending="true" name="model"/>
            <column ascending="false" name="ts"/>
         </index>
         <index name="usage_provider_idx" unique="false">
            <column ascending="true" name="provider"/>
            <column ascending="false" name="ts"/>
         </index>
         <index name="usage_ts_idx" unique="false">
            <column ascending="false" name="ts"/>
         </index>
      </table>
   </tables>
</database>
