openai / openai/codex

Python SDK: TokenUsageBreakdown is missing the cacheWriteInputTokens field

Open Beginner friendly
#38,158 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

app-server bug rate-limits
Dominant language
Rust
Stars
125k
Forks
19.5k
PR merge metrics
PR metrics pending

Description

Summary
The Python SDK's generated TokenUsageBreakdown type is missing the cacheWriteInputTokens field. This field is present in the source schema, so it appears the generated Python bindings are out of sync with the protocol definition.

Details
The file sdk/python/src/openai_codex/generated/v2_all.py is autogenerated based on codex_app_server_protocol.v2.schemas.json.
The source schema (codex_app_server_protocol.v2.schemas.json) defines cacheWriteInputTokens as part of the TokenUsageBreakdown structure, but this field is not present in the generated Python TokenUsageBreakdown type.

Expected Behavior
The generated TokenUsageBreakdown in v2_all.py should include the cacheWriteInputTokens field, matching the structure defined in codex_app_server_protocol.v2.schemas.json

Actual Behavior
The cacheWriteInputTokens field is missing from the TokenUsageBreakdown type in the Python SDK, meaning consumers of the SDK cannot access cache write token usage information

Impact
Users relying on the Python SDK are unable to read cacheWriteInputTokens from token usage data, resulting in incomplete usage/cost reporting compared to what the protocol actually provides

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by comparing the TokenUsageBreakdown definition in sdk/python/src/openai_codex/generated/v2_all.py with codex_app_server_protocol.v2.schemas.json. Check how the generated Python bindings are produced, then update the generated type so it matches the schema. Done means Python SDK consumers can access cacheWriteInputTokens in token usage data.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
78/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.