fix(alicode): preserve cache_control for DashScope providers (#2069)

Opt-in quirk preserveCacheControl keeps cache_control on content blocks
for alicode/alicode-intl, enabling DashScope prompt caching. signature
is always stripped; all other providers unchanged.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Rex
2026-06-29 15:28:02 +07:00
committed by decolua
parent 8a664d619d
commit 9e3866658a
5 changed files with 88 additions and 14 deletions

View File

@@ -109,7 +109,9 @@ export function translateRequest(sourceFormat, targetFormat, model, body, stream
// Always normalize to clean OpenAI format when target is OpenAI
// This handles hybrid requests (e.g., OpenAI messages + Claude tools)
if (targetFormat === FORMATS.OPENAI) {
result = filterToOpenAIFormat(result);
result = filterToOpenAIFormat(result, {
preserveCacheControl: !!PROVIDERS[provider]?.quirks?.preserveCacheControl,
});
}
// Final step: prepare request for Claude format endpoints