Skip to content

Commit 6b8cad8

Browse files
lpcoxCopilot
andcommitted
schemas: add x_initiator and billing fields to token-usage schema
Document the new optional fields added to token-usage.jsonl records: - x_initiator: the X-Initiator header value sent (agent/user) - billing: parsed X-Quota-Snapshot-* and X-RateLimit-* response headers These fields enable offline analysis of PRU billing behavior. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 293f022 commit 6b8cad8

1 file changed

Lines changed: 39 additions & 0 deletions

File tree

schemas/token-usage.schema.json

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,45 @@
9494
"type": "integer",
9595
"minimum": 0,
9696
"description": "Total number of bytes in the response body (optional, omitted for WebSocket upgrades)."
97+
},
98+
"x_initiator": {
99+
"type": "string",
100+
"enum": ["agent", "user"],
101+
"description": "The X-Initiator header value sent on the request. Determines billing treatment: 'agent' requests are not billed as premium, 'user' requests are. Present only for Copilot-bound requests."
102+
},
103+
"billing": {
104+
"type": "object",
105+
"description": "Billing/quota information extracted from upstream response headers (X-Quota-Snapshot-*, X-RateLimit-*). Present only when the upstream returns billing headers.",
106+
"properties": {
107+
"quota_chat": {
108+
"type": "object",
109+
"description": "X-Quota-Snapshot-Chat parsed fields.",
110+
"properties": {
111+
"ent": { "type": "string", "description": "Entitlement count (-1 = unlimited)." },
112+
"ov": { "type": "string", "description": "Overage requests made this period." },
113+
"ovPerm": { "type": "string", "description": "Whether overage is allowed (true/false)." },
114+
"rem": { "type": "string", "description": "Percentage of entitlement remaining." },
115+
"rst": { "type": "string", "description": "Quota reset date (RFC 3339 UTC)." }
116+
},
117+
"additionalProperties": true
118+
},
119+
"quota_premium-chat": {
120+
"type": "object",
121+
"description": "X-Quota-Snapshot-Premium-Chat parsed fields. Tracks premium request units (PRU).",
122+
"properties": {
123+
"ent": { "type": "string", "description": "Premium entitlement count." },
124+
"ov": { "type": "string", "description": "Premium overage requests made." },
125+
"ovPerm": { "type": "string", "description": "Whether premium overage is allowed." },
126+
"rem": { "type": "string", "description": "Percentage of premium entitlement remaining." },
127+
"rst": { "type": "string", "description": "Premium quota reset date." }
128+
},
129+
"additionalProperties": true
130+
},
131+
"rate_limit": { "type": "string", "description": "X-RateLimit-Limit value." },
132+
"rate_remaining": { "type": "string", "description": "X-RateLimit-Remaining value." },
133+
"rate_reset": { "type": "string", "description": "X-RateLimit-Reset value (Unix timestamp)." }
134+
},
135+
"additionalProperties": true
97136
}
98137
}
99138
}

0 commit comments

Comments
 (0)