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(sse): use x-api-key for opencode-go minimax messages requests (#733)

Otto Gb94c0c7d045c
diff --git a/open-sse/executors/opencode.ts b/open-sse/executors/opencode.ts
index 51a0472852..99a591d7d0 100644
--- a/open-sse/executors/opencode.ts
+++ b/open-sse/executors/opencode.ts
@@ -45,7 +45,11 @@ export class OpencodeExecutor extends BaseExecutor {
const key = credentials?.apiKey || credentials?.accessToken;
if (key) {
- headers["Authorization"] = `Bearer ${key}`;
+ if (this._requestFormat === "claude") {
+ headers["x-api-key"] = key;
+ } else {
+ headers["Authorization"] = `Bearer ${key}`;
+ }
}
if (this._requestFormat === "claude") {
diff --git a/tests/unit/opencode-executor.test.mjs b/tests/unit/opencode-executor.test.mjs
index 11710961f7..8859eb6404 100644
--- a/tests/unit/opencode-executor.test.mjs
+++ b/tests/unit/opencode-executor.test.mjs
@@ -158,7 +158,7 @@ describe("OpencodeExecutor", () => {
);
assert.deepEqual(result.headers, {
- Authorization: "Bearer claude-key",
+ "x-api-key": "claude-key",
"Content-Type": "application/json",
"anthropic-version": "2023-06-01",
Accept: "text/event-stream",