diff --git a/open-sse/executors/opencode.ts b/open-sse/executors/opencode.ts index 51a04728..99a591d7 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 11710961..8859eb64 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",