mirror of
https://github.com/farion1231/cc-switch.git
synced 2026-07-31 19:22:15 +08:00
feat(proxy): session-based prompt_cache_key routing for Codex Chat bridge
Codex always sends prompt_cache_key in its Responses requests, but the Responses -> Chat Completions conversion dropped it, breaking session cache affinity on upstreams that route by key (e.g. Kimi Coding). - Re-inject prompt_cache_key after conversion in the forwarder: an explicit client key wins, otherwise a client-provided session ID; generated per-request UUIDs are never sent upstream. - Provider-aware gating: "auto" enables only known-compatible upstreams (api.openai.com, api.kimi.com/coding) because strict gateways reject unknown fields with HTTP 400 (e.g. Fireworks); an advanced Auto/Enabled/Disabled override is available on the Codex form in all four locales. - Kimi For Coding preset opts in explicitly.
This commit is contained in:
@@ -6,6 +6,7 @@ import type {
|
||||
CodexApiFormat,
|
||||
CodexCatalogModel,
|
||||
CodexChatReasoning,
|
||||
PromptCacheRoutingMode,
|
||||
} from "../types";
|
||||
import type { PresetTheme } from "./claudeProviderPresets";
|
||||
|
||||
@@ -36,6 +37,8 @@ export interface CodexProviderPreset {
|
||||
modelCatalog?: CodexCatalogModel[];
|
||||
// Codex Responses -> Chat Completions reasoning capability defaults
|
||||
codexChatReasoning?: CodexChatReasoning;
|
||||
// Session-based prompt-cache routing override for Chat Completions upstreams
|
||||
promptCacheRouting?: PromptCacheRoutingMode;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -604,6 +607,7 @@ requires_openai_auth = true`,
|
||||
),
|
||||
endpointCandidates: ["https://api.kimi.com/coding/v1"],
|
||||
apiFormat: "openai_chat",
|
||||
promptCacheRouting: "enabled",
|
||||
modelCatalog: modelCatalog([
|
||||
{
|
||||
model: "kimi-for-coding",
|
||||
|
||||
Reference in New Issue
Block a user