Repository navigation
Description
Summary
A caller can send prompt_cache_key as an optional string to /v1/responses.
OpenCodex's Responses parser writes the value to options.promptCacheKey.
createOpenAIChatAdapter().buildRequest() builds the outbound /chat/completions body without that value.
The OpenAI Chat Completions Create API lists prompt_cache_key as an optional string.
OpenAI uses the key to group similar requests for prompt caching and improve cache hit rates.
OpenCodex should copy parsed.options.promptCacheKey to body.prompt_cache_key without changing the string.
OpenCodex should omit the upstream field if the caller does not send it.
Reproduction
-
Add a provider that uses the
openai-chatadapter. -
Send a Responses request with
prompt_cache_key.curl http://127.0.0.1:10100/v1/responses \ -H 'Content-Type: application/json' \ -d '{ "model": "example/example-model", "input": "Hello", "prompt_cache_key": "shared-prefix-v1", "stream": false }'
-
Capture the request that OpenCodex sends to the provider's
/chat/completionsendpoint. -
Confirm that the outbound body lacks
prompt_cache_key.
Logs and screenshots
src/responses/schema.ts
prompt_cache_key: z.string().optional()
src/responses/parser.ts
options.promptCacheKey = data.prompt_cache_key
src/adapters/openai-chat.ts
createOpenAIChatAdapter().buildRequest() constructs the body without prompt_cache_key
Expected outbound field:
prompt_cache_key="shared-prefix-v1"Area
Provider adapter
Version
2.7.30
OS
macOS 26.5.2 (arm64)
Config shape
{
"defaultProvider": "example",
"providers": {
"example": {
"adapter": "openai-chat",
"baseUrl": "https://example.invalid/v1",
"authMode": "key",
"apiKey": "<redacted>",
"defaultModel": "example-model"
}
}
}Checks
- I searched existing issues and docs first.
- I removed secrets, tokens, and personal data from logs and screenshots.
Activity
fix(adapters): forward prompt_cache_key through openai-chat adapter (#…
lidge-jun commentedon Jul 21, 2026
Fixed on dev by PR #224 (commit 15d83ba). The openai-chat adapter now forwards
prompt_cache_keyto the outbound/chat/completionsbody when set, gated behind a per-provider opt-in (promptCacheKey: truein the registry entry) so strict backends that reject unknown fields are not affected. Omitted when the caller does not send it. Will ship in the next release.fix(adapters): forward prompt_cache_key through openai-chat adapter (l…