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 }))