fix(sse): authenticate CLIProxyAPI fallback/passthrough legs with a dedicated credential (#7645) (#7712)

CLIProxyAPI requires its own separately-configured api-keys credential and
rejects any other token with 401. Both the direct mode:"cliproxyapi"
passthrough leg and the mode:"fallback" retry leg reused the resolved
connection's own credentials (the native provider's key) unchanged, making
the fallback path a permanent no-op for every provider configured this way.

Adds a dedicated cliproxyapi_api_key setting (settingsSchemas.ts) and a new
credential-resolution module (cliproxyapiCredentials.ts) that substitutes it
in at the executorProxy.ts choke point for both CLIProxyAPI-bound legs, so
CliproxyapiExecutor itself stays credential-source-agnostic. Falls back to
the connection's own credential when no dedicated key is configured,
preserving prior (workaround) behavior.
This commit is contained in:
Diego Rodrigues de Sa e Souza
2026-07-19 02:31:23 -03:00
committed by GitHub
parent ebd6afd59a
commit b4ee34fa02
5 changed files with 326 additions and 24 deletions

View File

@@ -322,6 +322,11 @@ export const updateSettingsSchema = z.object({
cliproxyapi_fallback_enabled: z.boolean().optional(),
cliproxyapi_url: z.string().url().max(500).optional(),
cliproxyapi_fallback_codes: z.string().max(200).optional(),
// #7645: dedicated CLIProxyAPI credential. CLIProxyAPI requires its own
// separately-configured `api-keys:` credential and rejects any other token
// with 401 — without this field, the fallback/passthrough legs had no way
// to authenticate except by reusing the (incompatible) native provider key.
cliproxyapi_api_key: z.string().max(500).optional(),
// CLIProxyAPI model mapping (Record<string, string>)
cliproxyapi_model_mapping: z.record(z.string(), z.string()).optional(),
// Model lockout settings