Prompt caching not applied for Anthropic Claude models via OpenAI-compatible Responses API with agent_reference (Foundry prompt agents)

Syed Naqvi 0 Reputation points
2026-07-19T16:23:34.69+00:00

We serve Claude Opus 4.7 and Claude Sonnet 4.6 through Azure AI Foundry prompt agents, invoked via POST {endpoint}/openai/v1/responses with an agent_reference, per the Foundry prompt-agent quickstart. Telemetry shows usage.input_tokens_details.cached_tokens = 0 on every call — even for the same agent invoked minutes apart with an identical ~20K-token server-side system prompt — so the full prompt bills as fresh input every call (~2x input cost at our volumes).

Anthropic's documentation describes prompt caching on Microsoft Foundry via the native /anthropic/v1/messages surface using cache_control, and notes caching is not supported on OpenAI-compatibility layers.

Questions: (1) Is prompt caching supported — or on the roadmap — for Claude models on the OpenAI-compatible /responses surface with agent_reference? (2) Is there any agent-level or deployment-level setting to enable caching of a prompt agent's instructions? (3) If not, is the recommended pattern to invoke via /anthropic/v1/messages directly with cache_control, sending the system prompt client-side? (4) Can you confirm the supported status of Claude models with Foundry prompt agents / agent_reference?

Microsoft Foundry
Microsoft Foundry

A unified Azure platform for creating and managing AI models, agents, and applications with built‑in enterprise security, monitoring, and governance

0 comments No comments

1 answer

Sort by: Most helpful
  1. Christos Panagiotidis 2,741 Reputation points
    2026-07-20T06:00:05.25+00:00

    Your zero cached_tokens results match the documented API boundary, not a missing agent setting. Microsoft lists Messages and token counting as Claude APIs in Foundry. Prompt caching is a Claude capability, but the Foundry Responses reference documents agent_reference without a cache control or agent/deployment cache switch. Caching prompt-agent instructions through /openai/v1/responses is therefore not a documented supported path.

    For caching, call the deployment through the native Messages API, keep the reusable system prefix identical, and follow the native Messages caching contract. This requires sending the system prompt in the request instead of relying on server-side prompt-agent instructions. Verify operation from the native API's returned usage across repeated requests.

    Claude models are supported for agents through Microsoft Agent Framework, but that does not imply prompt-caching support with agent_reference. Microsoft documentation publishes no roadmap or delivery date, so use Microsoft Support if you need an authoritative production commitment.

    Was this answer helpful?

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.