sub2api icon indicating copy to clipboard operation
sub2api copied to clipboard

bug: explicit prompt-cache hints fail across GPT chat forwarding

Open Mickey0811 opened this issue 2 months ago • 1 comments

Summary

After upgrading from 0.2.7 to 0.2.8, Chat Completions requests containing explicit prompt-cache hints can fail for GPT models with upstream HTTP 400:

{"error":{"message":"prompt_cache_options is not supported on this model","type":"invalid_request_error"}}

Confirmed affected models:

  • gpt-5.6-sol
  • gpt-5.6-terra
  • gpt-5.6-luna
  • gpt-6-astra
  • gpt-6-sol
  • gpt-6-luna

gpt-5.5 is included for compatibility coverage. The fix also covers GPT-5.4, suffix variants, and future gpt- models so behavior does not depend on a model whitelist.

Returning to 0.2.7 restored successful requests with the same model and cache-options fields. This points to a forwarding compatibility regression rather than general model availability.

Minimal request shape

Send POST /v1/chat/completions with a valid locally configured credential:

{
  "model": "gpt-5.6-luna",
  "messages": [{"role": "user", "content": "What is 2 + 3?"}],
  "reasoning_effort": "none",
  "stream": true,
  "prompt_cache_options": {"mode": "explicit", "ttl": "30m"}
}

Cause

Commit c4c2e660704dbde070f445beac3808cc829880c1 added PromptCacheOptions to request structs and began copying it through ChatCompletionsToResponses. Some GPT upstream paths reject this explicit control. Protocol-level prompt_cache_breakpoint hints can cause the same compatibility problem, and raw Responses-shaped requests sent through /v1/chat/completions bypass the typed converter.

Expected behavior

Use the final mapped and normalized upstream model for the compatibility decision. For final model names beginning with gpt-:

  • remove top-level prompt_cache_options and prompt_cache_breakpoint;
  • remove protocol-level prompt_cache_breakpoint from message/content positions under messages and input;
  • preserve prompt_cache_key and automatic caching;
  • preserve tools, function argument JSON, metadata, unrelated user data, and non-message Responses input items;
  • leave non-GPT forwarding and generic protocol conversion unchanged.

Fix status

PR #7547 implements this at the OpenAI Chat forwarding layer after final model mapping and Codex normalization. It covers typed Chat Completions conversion and raw Responses-shaped compatibility requests, while retaining one commit and using this issue as the single tracker.

Related: #5803 concerns prompt_cache_retention, and #4388 concerns top-level explicit_cache.

Mickey0811 avatar Sep 23 '26 10:09 Mickey0811

Proposed fix: #7547. The patch and regression tests cover all six reported models: GPT-5.6 Sol/Terra/Luna and GPT-6 Astra/Sol/Luna. It targets the Chat Completions-to-Responses conversion regression and preserves existing automatic cache-key handling.

Mickey0811 avatar Sep 23 '26 10:09 Mickey0811