Skip to content

Never stop coding. Free MIT AI gateway: one endpoint, 375 providers (150+ free), 1,400+ models Kimi, Claude, GPT, Gemini, GLM, DeepSeek, MiniMax. Works with Claude Code, Codex, Cursor, OpenCode, Cline & Copilot. Quota-aware auto-fallback, RTK+Caveman compression saves 15-95% tokens, MCP/A2A, Desktop/PWA. Built by 900+ contributors

fix(cliproxyapi): strip Capy premium extras on Anthropic-shape bodies

OmniRoute Ops05212b0a3f1d
diff --git a/open-sse/executors/cliproxyapi.ts b/open-sse/executors/cliproxyapi.ts
index 2ab2545f41..85ca6534f4 100644
--- a/open-sse/executors/cliproxyapi.ts
+++ b/open-sse/executors/cliproxyapi.ts
@@ -133,6 +133,21 @@ export class CliproxyapiExecutor extends BaseExecutor {
transformed.model = model;
}
+ // For Anthropic-shape bodies routed to CPA's /v1/messages, strip the
+ // Capy/Anthropic-SDK premium extras that Anthropic gates with
+ // "Extra usage is required" / "out of extra usage" (400). CPA does its
+ // own Claude Code wire-image cloak (CCH, billing header, uTLS, metadata
+ // user_id, system sentinel) downstream — but it forwards client extras
+ // like output_config.effort=xhigh which trigger the extras-billing gate.
+ //
+ // Mirrors the runtime "Patch I2/I4" effect previously applied via patch.mjs.
+ // Strips are no-op when fields are absent (OpenAI-shape passthrough).
+ if (this.isAnthropicShape(transformed)) {
+ delete transformed.thinking;
+ delete transformed.output_config;
+ delete transformed.context_management;
+ }
+
return transformed;
}