Confirm this is a Node library issue and not an underlying OpenAI API issue
Describe the bug
I noticed an inconsistency between the official documentation and the openai-node SDK regarding the prompt caching retention policy values.
The allowed values in retention policy are documented as in_memory and 24h
However, in the openai-node implementation, the value appears to be defined as
/**
* The retention policy for the prompt cache. Set to `24h` to enable extended
* prompt caching, which keeps cached prefixes active for longer, up to a maximum
* of 24 hours.
* [Learn more](https://platform.openai.com/docs/guides/prompt-caching#prompt-cache-retention).
*/
prompt_cache_retention?: 'in-memory' | '24h' | null;
This is currently type-enforced in the SDK, so developers cannot use in_memory without modifying the type definitions. This makes it difficult to follow the official documentation as written.
This mismatch makes it unclear which value is officially supported and may cause confusion for developers following the documentation.
Could you please clarify:
- Which value is correct?
- Whether the documentation or the SDK should be updated for consistency?
If this is confirmed as an issue, I’d be happy to work on a fix (either updating the SDK or the documentation, depending on the intended behavior).
Thanks!
To Reproduce
- Install the latest version of openai (openai-node).
- Create a minimal TypeScript file with the following code:
Code snippets
import OpenAI from 'openai';
const client = new OpenAI({
apiKey: process.env.OPENAI_API_KEY!,
});
async function main() {
const response = await client.responses.create({
model: 'gpt-4o-mini',
input: 'Hello',
// According to docs: "in_memory"
prompt_cache_retention: 'in-memory',
});
console.log(response.output_text);
}
main();
OS
macOS
Node version
Node v25.2.1
Library version
openai v6.25.0
Confirm this is a Node library issue and not an underlying OpenAI API issue
Describe the bug
I noticed an inconsistency between the official documentation and the openai-node SDK regarding the prompt caching retention policy values.
The allowed values in retention policy are documented as
in_memoryand24hHowever, in the openai-node implementation, the value appears to be defined as
This is currently type-enforced in the SDK, so developers cannot use
in_memorywithout modifying the type definitions. This makes it difficult to follow the official documentation as written.This mismatch makes it unclear which value is officially supported and may cause confusion for developers following the documentation.
Could you please clarify:
If this is confirmed as an issue, I’d be happy to work on a fix (either updating the SDK or the documentation, depending on the intended behavior).
Thanks!
To Reproduce
Code snippets
OS
macOS
Node version
Node v25.2.1
Library version
openai v6.25.0