Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 43 additions & 1 deletion src/server/providers/opencode-go-facts.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
])
})
})
11 changes: 8 additions & 3 deletions src/server/providers/opencode-go-facts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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, (id: string) => string> = {
'chat-completions': () => 'chat/completions',
Expand All @@ -37,6 +40,8 @@ const GO_PROTOCOL_PATH: Record<string, (id: string) => string> = {
return `models/${id}:generateContent`
},
interactions: () => 'interactions',
systemone: () => 'systemone',
embeddings: () => 'embeddings',
}

export const OPENCODE_GO_REQUIRED_HEADERS: Array<RequiredHeader> = [
Expand Down
4 changes: 2 additions & 2 deletions src/server/providers/opencode-routes.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
},
},
Expand All @@ -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 }))
Expand Down
Loading