mirror of
https://github.com/openai/codex.git
synced 2026-08-27 13:49:27 +00:00
## What changed - Parse `cache_write_tokens` from response input token details and carry it through token usage aggregation. - Expose `cache_write_input_tokens` in protocol, app-server, exec, and TypeScript SDK usage events, defaulting it to zero for compatibility with older payloads. - Report cache-write usage in analytics, metrics, traces, and rollout data alongside existing cache-read usage. ## Testing - Add coverage for response parsing, usage event output, aggregation, analytics, metrics, and telemetry fields. GitOrigin-RevId: 634e4fbe3086a8923c0ee13b622573e7d9d221bd
82 lines
1.7 KiB
JSON
Generated
82 lines
1.7 KiB
JSON
Generated
{
|
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
"definitions": {
|
|
"ThreadTokenUsage": {
|
|
"properties": {
|
|
"last": {
|
|
"$ref": "#/definitions/TokenUsageBreakdown"
|
|
},
|
|
"modelContextWindow": {
|
|
"format": "int64",
|
|
"type": [
|
|
"integer",
|
|
"null"
|
|
]
|
|
},
|
|
"total": {
|
|
"$ref": "#/definitions/TokenUsageBreakdown"
|
|
}
|
|
},
|
|
"required": [
|
|
"last",
|
|
"total"
|
|
],
|
|
"type": "object"
|
|
},
|
|
"TokenUsageBreakdown": {
|
|
"properties": {
|
|
"cacheWriteInputTokens": {
|
|
"default": 0,
|
|
"format": "int64",
|
|
"type": "integer"
|
|
},
|
|
"cachedInputTokens": {
|
|
"format": "int64",
|
|
"type": "integer"
|
|
},
|
|
"inputTokens": {
|
|
"format": "int64",
|
|
"type": "integer"
|
|
},
|
|
"outputTokens": {
|
|
"format": "int64",
|
|
"type": "integer"
|
|
},
|
|
"reasoningOutputTokens": {
|
|
"format": "int64",
|
|
"type": "integer"
|
|
},
|
|
"totalTokens": {
|
|
"format": "int64",
|
|
"type": "integer"
|
|
}
|
|
},
|
|
"required": [
|
|
"cachedInputTokens",
|
|
"inputTokens",
|
|
"outputTokens",
|
|
"reasoningOutputTokens",
|
|
"totalTokens"
|
|
],
|
|
"type": "object"
|
|
}
|
|
},
|
|
"properties": {
|
|
"threadId": {
|
|
"type": "string"
|
|
},
|
|
"tokenUsage": {
|
|
"$ref": "#/definitions/ThreadTokenUsage"
|
|
},
|
|
"turnId": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"required": [
|
|
"threadId",
|
|
"tokenUsage",
|
|
"turnId"
|
|
],
|
|
"title": "ThreadTokenUsageUpdatedNotification",
|
|
"type": "object"
|
|
} |