mirror of
https://github.com/openai/codex.git
synced 2026-09-05 15:18:41 +00:00
## What changed - Include the complete upstream `response.usage` object in `ResponseUsageMetadata.metadata` while retaining the existing `amount` field. - Expose the metadata through `rawResponse/completed` notifications and update the generated JSON and TypeScript schemas. ## Testing - Cover SSE, WebSocket, turn, and compaction completion paths. GitOrigin-RevId: 6d79b1b4c92ac11abf43ec98f380b4868288a701
94 lines
2.0 KiB
JSON
Generated
94 lines
2.0 KiB
JSON
Generated
{
|
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
"definitions": {
|
|
"ResponseUsageMetadata": {
|
|
"description": "Usage metadata reported for one upstream response.",
|
|
"properties": {
|
|
"amount": {
|
|
"type": [
|
|
"string",
|
|
"null"
|
|
]
|
|
},
|
|
"metadata": true
|
|
},
|
|
"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"
|
|
}
|
|
},
|
|
"description": "Internal-only notification containing the exact usage from one upstream Responses API completion.",
|
|
"properties": {
|
|
"responseId": {
|
|
"type": "string"
|
|
},
|
|
"threadId": {
|
|
"type": "string"
|
|
},
|
|
"turnId": {
|
|
"type": "string"
|
|
},
|
|
"usage": {
|
|
"anyOf": [
|
|
{
|
|
"$ref": "#/definitions/TokenUsageBreakdown"
|
|
},
|
|
{
|
|
"type": "null"
|
|
}
|
|
]
|
|
},
|
|
"usageMetadata": {
|
|
"anyOf": [
|
|
{
|
|
"$ref": "#/definitions/ResponseUsageMetadata"
|
|
},
|
|
{
|
|
"type": "null"
|
|
}
|
|
]
|
|
}
|
|
},
|
|
"required": [
|
|
"responseId",
|
|
"threadId",
|
|
"turnId"
|
|
],
|
|
"title": "RawResponseCompletedNotification",
|
|
"type": "object"
|
|
} |