Skip to content

Python: [Bug]: usage_details.cache_creation_input_token_count is missing for gpt-5.6 models #7368

Description

@cecheta

Description

When using a gpt-5.6 model with a long prompt prefix, usage_details is missing cache_creation_input_token_count, despite being available in the raw response.

Code Sample

import asyncio

from agent_framework import Agent
from agent_framework.foundry import FoundryChatClient
from azure.identity import AzureCliCredential
from dotenv import load_dotenv

load_dotenv()


async def main() -> None:
    client = FoundryChatClient(credential=AzureCliCredential())

    agent = Agent(
        client=client,
        name="WeatherAgent",
        instructions="You are a helpful weather agent. " * 200,
        default_options={"prompt_cache_key": "cache-key"},
    )

    result = await agent.run("Hello")
    print(result.usage_details.get("cache_creation_input_token_count"))  # None
    print(result.raw_representation.raw_representation.usage.input_tokens_details.cache_write_tokens)  # 1409


if __name__ == "__main__":
    asyncio.run(main())

Error Messages / Stack Traces

Package Versions

agent-framework-core: 1.12.1, agent-framework-openai: 1.11.0

Python Version

Python 3.14.5

Additional Context

No response

Metadata

Metadata

Assignees

Labels

agentsUsage: [Issues, PRs], Target: Single agentpythonUsage: [Issues, PRs], Target: PythonreproducedUsage: [Issues], Target: all issues that can be reproduced by the triage workflow

Type

Projects

Status
No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions