Wanted to update this – turns out my prompts weren’t getting cached because I was using chatgpt-4o-latest
, which isn’t listed in the supported models for prompt caching: Prompt Caching - OpenAI API:
Prompt Caching is enabled for the following models:
gpt-4o (excludes gpt-4o-2024-05-13 and chatgpt-4o-latest)
gpt-4o-mini
o1-preview
o1-mini
When I switch to something like gpt-4o-2024-08-06
for my long prompts, prompt caching works, and more importantly, it works even if you’re using a number of different prompts.