# is_openai_prompt_cache_key_enabled

> **Function** in `deepagents_code`

📖 [View in docs](https://reference.langchain.com/python/deepagents-code/config/is_openai_prompt_cache_key_enabled)

Return whether OpenAI model calls should carry a per-thread cache key.

Resolves the `models.openai_prompt_cache_key` option from env/`config.toml`,
defaulting to enabled. When disabled, `ConfigurableModelMiddleware` stops
injecting the thread ID as an OpenAI `prompt_cache_key` (a user-supplied key
is still forwarded). This is the opt-out for OpenAI-compatible endpoints that
reject unknown request fields.

## Signature

```python
is_openai_prompt_cache_key_enabled() -> bool
```

---

[View source on GitHub](https://github.com/langchain-ai/deepagents/blob/4bfa52000ef65ac623d8ada0cb67f67cbdd663ea/libs/code/deepagents_code/config.py#L4549)