Describe the bug
openai 2.45.0 (released 2026-07-09) added cache_write_tokens to openai.types.responses.response_usage.InputTokensDetails as a required field. The SDK constructs InputTokensDetails(cached_tokens=0) in several places, starting with the Usage default factory (agents/usage.py:112), so every run now fails immediately:
pydantic_core._pydantic_core.ValidationError: 1 validation error for InputTokensDetails
cache_write_tokens
Field required [type=missing, input_value={'cached_tokens': 0}, input_type=dict]
The crash happens at Runner.run() entry, when RunContextWrapper builds its default Usage(). No model call is made, so this is independent of model or provider. The current dependency pin (openai<3,>=2.36.0) admits 2.45.0, so any fresh install is broken.
Debug information
- Agents SDK version: 0.18.0
- Python version: 3.12
Repro steps
# pip install openai-agents==0.18.0 openai==2.45.0
from agents.usage import Usage
Usage() # raises ValidationError
Expected behavior
Usage() constructs and runs work under openai 2.45.0. Fix is probably passing cache_write_tokens=0 at the construction sites (about 10, across agents/usage.py, models/chatcmpl_stream_handler.py, and extensions/models/), or capping the openai pin until that lands.
Describe the bug
openai 2.45.0 (released 2026-07-09) added
cache_write_tokenstoopenai.types.responses.response_usage.InputTokensDetailsas a required field. The SDK constructsInputTokensDetails(cached_tokens=0)in several places, starting with theUsagedefault factory (agents/usage.py:112), so every run now fails immediately:The crash happens at
Runner.run()entry, whenRunContextWrapperbuilds its defaultUsage(). No model call is made, so this is independent of model or provider. The current dependency pin (openai<3,>=2.36.0) admits 2.45.0, so any fresh install is broken.Debug information
Repro steps
Expected behavior
Usage()constructs and runs work under openai 2.45.0. Fix is probably passingcache_write_tokens=0at the construction sites (about 10, acrossagents/usage.py,models/chatcmpl_stream_handler.py, andextensions/models/), or capping the openai pin until that lands.