Cline: "400 invalid prompt_cache_retention value 'in-memory'" on Azure
Back to the blog
Articletroubleshootingclineopenaidev tools

Cline: "400 invalid prompt_cache_retention value 'in-memory'" on Azure

MafraNovember 28, 20265 min read

Cline on top of an Azure OpenAI deployment stops mid-task and returns 400 invalid prompt_cache_retention value 'in-memory'. The request never reaches the model: Azure rejects the body before generating a single token. The culprit is a hyphenated field where the API expects an underscore, and on the newer models that field no longer exists at all.

Why do you get "invalid prompt_cache_retention value 'in-memory'"?

Because Cline sends prompt_cache_retention: "in-memory" and Azure only accepts in_memory, with an underscore. It is body validation, not account, key, or quota validation. That is why the message comes back as 400 and not as 401 or 429.

The Azure prompt caching documentation is explicit: for gpt-5.4 and older models, "the allowed values are in_memory and 24h", and the default is in_memory. The hyphenated value, in-memory, is not on the list. The server rejects it before any inference.

Why does this only happen on some models?

Because starting with the GPT-5.6 family, the prompt_cache_retention field was deprecated. On those models cache is no longer controlled by it, but by prompt_cache_options with a ttl of 30m (default) or 12h.

The docs separate the two controls: on GPT-5.6 and later, prompt_cache_options.ttl sets the minimum cache lifetime; on earlier models, prompt_cache_retention selects the maximum-retention policy. They are different fields for different model versions. Sending the old one to a new model, or the wrong value to an old one, lands on the same 400.

Flowchart: the client sends prompt_cache_retention with an invalid value, Azure validates the body and rejects it, and without the field the model answers
The error is born in body validation, between the client and Azure, before any token is generated.

How do you prove the field is the cause, without relying on Cline?

Call the deployment straight on Azure, once with the field and once without. If only the second answers, the cause is closed. The curl below uses your deployment's Responses endpoint:

curl -sS "https://YOUR-RESOURCE.openai.azure.com/openai/v1/responses" \
  -H "api-key: $AZURE_OPENAI_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "YOUR-DEPLOYMENT",
    "input": "say hello",
    "prompt_cache_retention": "in-memory"
  }'

Expect the 400 invalid prompt_cache_retention value 'in-memory'. From there the test depends on the model you are calling.

If the deployment is gpt-5.4 or older, change only the value to in_memory, with an underscore:

  -d '{
    "model": "YOUR-DEPLOYMENT",
    "input": "say hello",
    "prompt_cache_retention": "in_memory"
  }'

If that second call answers, the problem was the value, not the network, the key, or the quota. But if you are on the gpt-6.1-sol from the report, or any GPT-5.6 or later, the field is deprecated: drop prompt_cache_retention and use prompt_cache_options instead:

  -d '{
    "model": "YOUR-DEPLOYMENT",
    "input": "say hello",
    "prompt_cache_options": { "ttl": "30m" }
  }'

What is the difference between prompt_cache_retention and prompt_cache_options?

They are two controls with different semantics, and mixing them is what produces the error. The table sums up what applies to each model family:

ModelCache fieldAccepted valuesDefault
gpt-5.4 and olderprompt_cache_retentionin_memory, 24hin_memory
GPT-5.6 and laterprompt_cache_options with ttl30m, 12h30m

Note that prompt_cache_retention does not even appear in the row for the new models: there it is deprecated. And sending prompt_cache_options or prompt_cache_breakpoint to a model older than GPT-5.6 also returns 400, because those parameters do not exist in that generation.

How do you fix it in Cline?

Until the client fixes the value, the practical path is to take the Azure deployment out of the equation. If you configure Cline by base URL and key, switching the provider fixes it on the spot, because the error comes from the field and value Cline assembles, not from your code.

An OpenAI-compatible endpoint, like Verboo Code's at code.verboo.ai/router/v1 with a vbk_ key, accepts the same request format Cline uses without that problematic field in the middle. The setup is the same one you already use: base URL, key, and model name.

The 400 invalid prompt_cache_retention error is the whole class of failure that disappears when the cache field stops being assembled by the client. To stop depending on a hyphenated value the provider won't accept, Verboo Code exposes an OpenAI-compatible endpoint, so you keep the interface you already use and swap only the engine.

Frequently asked questions

Is the error Cline's fault or Azure's?

Both. Cline sends a value that is not on Azure's list. Azure is right to reject it. The definitive fix is on the client side, changing in-memory to in_memory or moving to prompt_cache_options on the new models.

Will I lose the cache if I remove the field?

No. Prompt caching is on by default on supported models. Without the field, Azure applies the default (in_memory on older models, 30m on GPT-5.6+). You only lose the ability to choose the policy, not the cache itself.

Does the same 400 show up in other clients?

It shows up in any client that sends prompt_cache_retention with a value outside Azure's list. That is why testing with curl straight against the deployment is worth more than switching extensions: it isolates the field from the rest of the stack.

Enjoyed this article?
Share knowledge with your network.
// Read also

Related articles