fix(sse): use x-api-key for opencode-go minimax messages requests (#733)

OpenCode Go mixes request protocols by model family:

   - `glm-5` and `kimi-k2.5` use OpenAI-style `/chat/completions`
   - `minimax-m2.5` and `minimax-m2.7` use Anthropic-style `/messages`

   OmniRoute already routed MiniMax Go models to `/messages`, but the
   executor still sent `Authorization: Bearer ...`, which caused upstream
   `401 Missing API key` errors.

   This changes `OpencodeExecutor` to send:
   - `x-api-key` + `anthropic-version` for Claude-targeted OpenCode Go requests
   - `Authorization: Bearer ...` for the remaining OpenCode Go request formats

   Also updates unit coverage to assert the correct header behavior for
   MiniMax Go models.

   Validated with:
   - direct curl repro against OpenCode Go endpoints
   - `node --import tsx/esm --test tests/unit/opencode-executor.test.mjs`
   - `npm run typecheck:core`
   - `npm run build`
This commit is contained in:
Otto G 2026-03-29 09:29:59 +02:00 committed by GitHub
parent 500bfdf588
commit b94c0c7d04
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 6 additions and 2 deletions

View file

@ -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",