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
TypeScript a2aai-agentsai-gatewayanthropicclaudeclaude-codeclinecodexcopilotcursordeepseekfree-aigeminikimillm-gatewaymcpopenaiopenai-proxyqwentoken-saver
fix(executors): truncate tools array to 128 items max in GitHub Copilot and OpenCode executors to mitigate 400 Bad Request errors (#1687)
diegosouzapw0274af8c9c6c
diff --git a/open-sse/executors/github.ts b/open-sse/executors/github.tsindex 24587b17ec..f8379fbcf6 100644--- a/open-sse/executors/github.ts+++ b/open-sse/executors/github.ts@@ -90,6 +90,10 @@ export class GithubExecutor extends BaseExecutor {delete modifiedBody.response_format;}+ if (Array.isArray(modifiedBody.tools) && modifiedBody.tools.length > 128) {+ modifiedBody.tools = modifiedBody.tools.slice(0, 128);+ }+return modifiedBody;}diff --git a/open-sse/executors/opencode.ts b/open-sse/executors/opencode.tsindex 99a591d7d0..9788cd53d0 100644--- a/open-sse/executors/opencode.ts+++ b/open-sse/executors/opencode.ts@@ -62,4 +62,22 @@ export class OpencodeExecutor extends BaseExecutor {return headers;}++ transformRequest(+ model: string,+ body: any,+ stream: boolean,+ credentials: ProviderCredentials+ ): any {+ const modifiedBody = super.transformRequest(model, body, stream, credentials);+ if (+ modifiedBody &&+ typeof modifiedBody === "object" &&+ Array.isArray(modifiedBody.tools) &&+ modifiedBody.tools.length > 128+ ) {+ modifiedBody.tools = modifiedBody.tools.slice(0, 128);+ }+ return modifiedBody;+ }}