mirror of
https://github.com/openai/codex.git
synced 2026-11-12 06:40:35 +00:00
Expose response usage metadata in completion events (#41087)
## What changed - Parse optional `usage_metadata.amount` values from Responses API completion events without converting their string representation. - Propagate the metadata through SSE and WebSocket streams, regular turns, and remote compaction. - Add `usageMetadata` to the app-server `rawResponse/completed` notification and its generated schemas. ## Testing - Cover missing, null, zero, and high-precision amounts, including completion events emitted during compaction. GitOrigin-RevId: b16d81e8350eab0dc7ff613d0dc9dbed73041713
This commit is contained in:
1 parent
b592a0bfed
commit
2c4a95736b
25 files changed
+250
-18
No files matched your search
+22
@@ -1,6 +1,18 @@
|
||||
{
|
||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||
"definitions": {
|
||||
"ResponseUsageMetadata": {
|
||||
"description": "Usage metadata reported for one upstream response.",
|
||||
"properties": {
|
||||
"amount": {
|
||||
"type": [
|
||||
"string",
|
||||
"null"
|
||||
]
|
||||
}
|
||||
},
|
||||
"type": "object"
|
||||
},
|
||||
"TokenUsageBreakdown": {
|
||||
"properties": {
|
||||
"cacheWriteInputTokens": {
|
||||
@@ -59,6 +71,16 @@
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
},
|
||||
"usageMetadata": {
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/definitions/ResponseUsageMetadata"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
|
||||
Reference in new issue
Block a user