From 60d3aceeddc903fd28253d636c663115b5feba5b Mon Sep 17 00:00:00 2001 From: Tom Beckenham <34339192+tombeckenham@users.noreply.github.com> Date: Fri, 27 Nov 2026 18:57:49 +1100 Subject: [PATCH] opencode-go: map the systemone and embeddings api protocols (#776) The Go models list now states jev-1.14 and two other decision models on api.systemone, and three embedding models on api.embeddings. The Go page states both paths (.../systemone/v1/systemone, .../openai/v1/embeddings), so map them instead of failing the daily spec sync. Unknown keys still throw. --- .../providers/opencode-go-facts.test.ts | 44 ++++++++++++++++++- src/server/providers/opencode-go-facts.ts | 11 +++-- src/server/providers/opencode-routes.test.ts | 4 +- 3 files changed, 53 insertions(+), 6 deletions(-) diff --git a/src/server/providers/opencode-go-facts.test.ts b/src/server/providers/opencode-go-facts.test.ts index e857e637..5893d455 100644 --- a/src/server/providers/opencode-go-facts.test.ts +++ b/src/server/providers/opencode-go-facts.test.ts @@ -174,14 +174,56 @@ describe('goListingRoutes', () => { data: [ { id: 'grok-4.7', + api: { + speech: { + base_url: 'https://opencode.ai/inference/go/openai/v1', + }, + }, + }, + ], + }), + ).toThrow('opencode-go: grok-4.7 has unknown api protocol speech') + }) + + it('reads the live systemone and embeddings routes (issue #776)', () => { + // Rows trimmed from GET /inference/go/v1/models (2026-11-27). The Go + // page states both paths: .../systemone/v1/systemone and + // .../openai/v1/embeddings. + expect( + goListingRoutes({ + object: 'list', + data: [ + { + id: 'jev-1.14', + type: 'decision', + api: { + systemone: { + base_url: 'https://opencode.ai/inference/go/systemone/v1', + sdk: { + aisdk: '@ai-sdk/typesafe-ai', + opencodeai: '@opencode/ai/providers/opencode/decisions', + }, + }, + }, + }, + { + id: 'text-embedding-3-small', + type: 'embedding', api: { embeddings: { base_url: 'https://opencode.ai/inference/go/openai/v1', + sdk: { + aisdk: '@ai-sdk/openai', + opencodeai: '@opencode/ai/providers/openai/embeddings', + }, }, }, }, ], }), - ).toThrow('opencode-go: grok-4.7 has unknown api protocol embeddings') + ).toEqual([ + '/inference/go/openai/v1/embeddings', + '/inference/go/systemone/v1/systemone', + ]) }) }) diff --git a/src/server/providers/opencode-go-facts.ts b/src/server/providers/opencode-go-facts.ts index f501967b..1e4800cd 100644 --- a/src/server/providers/opencode-go-facts.ts +++ b/src/server/providers/opencode-go-facts.ts @@ -22,9 +22,12 @@ const OPENCODE_ORIGIN = 'https://opencode.ai' * method: the model id is one path segment, the same shape as * `:generateContent` on the probe records. `interactions` is Google's * Interactions API: `POST {base}/interactions`, and the model id is a - * request-body field, not a path segment. OpenCode publishes no request - * schema for either route, so both stay route-only (`opencode-routes.ts`). - * A key this map does not name is an unknown shape. + * request-body field, not a path segment. `systemone` is OpenCode's + * decision API (`POST {base}/systemone`) and `embeddings` is OpenAI's + * (`POST {base}/embeddings`); the Go page states both paths (issue #776). + * OpenCode publishes no request schema for any of these routes, so they + * stay route-only (`opencode-routes.ts`). A key this map does not name is + * an unknown shape. */ const GO_PROTOCOL_PATH: Record string> = { 'chat-completions': () => 'chat/completions', @@ -37,6 +40,8 @@ const GO_PROTOCOL_PATH: Record string> = { return `models/${id}:generateContent` }, interactions: () => 'interactions', + systemone: () => 'systemone', + embeddings: () => 'embeddings', } export const OPENCODE_GO_REQUIRED_HEADERS: Array = [ diff --git a/src/server/providers/opencode-routes.test.ts b/src/server/providers/opencode-routes.test.ts index 5cec8806..ab48e5f0 100644 --- a/src/server/providers/opencode-routes.test.ts +++ b/src/server/providers/opencode-routes.test.ts @@ -281,7 +281,7 @@ it('rejects a Go listing row with no api entry or an unknown protocol', async () { id: 'gpt', api: { - embeddings: { + speech: { base_url: 'https://opencode.ai/inference/go/openai/v1', }, }, @@ -300,7 +300,7 @@ it('rejects a Go listing row with no api entry or an unknown protocol', async () { url: 'docs', text: 'docs' }, true, ), - ).rejects.toThrow('opencode-go: gpt has unknown api protocol embeddings') + ).rejects.toThrow('opencode-go: gpt has unknown api protocol speech') }) it('rejects a failed docs source', async () => { globalThis.fetch = vi.fn(async () => new Response('gone', { status: 404 }))