Skip to content

fix: correct prompt_cache_retention type to use underscore#1765

Open
fuleinist wants to merge 1 commit intoopenai:masterfrom
fuleinist:fix/issue-1756-prompt-cache-retention-type
Open

fix: correct prompt_cache_retention type to use underscore#1765
fuleinist wants to merge 1 commit intoopenai:masterfrom
fuleinist:fix/issue-1756-prompt-cache-retention-type

Conversation

@fuleinist
Copy link

Summary

This PR fixes a type definition mismatch in the prompt_cache_retention parameter.

According to the OpenAI API documentation, the allowed values for prompt_cache_retention are in_memory and 24h (with underscore, not hyphen).

If you don't specify a retention policy, the default is in_memory. Allowed values are in_memory and 24h.

However, the SDK type definition was using in-memory (with hyphen) instead of in_memory (with underscore), causing TypeScript errors when developers try to use the documented value.

Changes

  • Updated prompt_cache_retention type from in-memory | 24h to in_memory | 24h in:
    • src/resources/responses/responses.ts (3 occurrences)
    • src/resources/chat/completions/completions.ts (1 occurrence)
  • Updated test file to use correct value

Testing

The type change allows developers to use the documented in_memory value without TypeScript errors.

Fixes #1756

The OpenAI API documentation specifies that the allowed values for
prompt_cache_retention are 'in_memory' and '24h' (with underscore,
not hyphen). This commit updates the type definitions to match the
API documentation.

Fixes openai#1756
@fuleinist fuleinist requested a review from a team as a code owner March 13, 2026 08:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Prompt Caching retention policy value mismatch

1 participant