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
9 changes: 9 additions & 0 deletions packages/core/src/__tests__/model-metadata.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,4 +95,13 @@ describe('openAiAdapterApiProtocol', () => {
assert.equal(openAiAdapterApiProtocol('deepseek-v4-pro', 'deepseek'), 'openai-responses');
assert.equal(openAiAdapterApiProtocol('deepseek-chat', 'deepseek'), 'openai-chat');
});

it('routes only OpenCode Go Muse Spark through its supported Responses wire', () => {
assert.equal(
openAiAdapterApiProtocol('muse-spark-1.2-contributor', 'opencode-go'),
'openai-responses',
);
assert.equal(openAiAdapterApiProtocol('muse-spark-1.2-contributor', 'opencode'), 'openai-chat');
assert.equal(openAiAdapterApiProtocol('minimax-m3', 'opencode-go'), 'openai-chat');
});
});
1 change: 1 addition & 0 deletions packages/core/src/model-metadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ export function openAiAdapterApiProtocol(
): 'openai-responses' | 'openai-chat' {
const id = modelId.trim();
return (providerType === 'deepseek' && deepSeekModelSupportsResponses(id)) ||
(providerType === 'opencode-go' && id === 'muse-spark-1.2-contributor') ||
/^gpt-5/i.test(id) ||
((providerType === 'xai' || providerType === 'xai-oauth') && id === 'grok-4.5')
? 'openai-responses'
Expand Down
26 changes: 26 additions & 0 deletions packages/runtime/src/__tests__/responses-wire-contract.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,32 @@ describe('responses wire contract', () => {
);
});

test('routes OpenCode Go Muse Spark through the Responses endpoint', async () => {
const urls: string[] = [];
const fetch = (async (url: string | URL | Request) => {
urls.push(String(url));
return Response.json({
id: 'r',
object: 'response',
status: 'completed',
output: [],
usage: { input_tokens: 1, output_tokens: 1 },
});
}) as typeof globalThis.fetch;
const model = getAIModel({
connection: conn('opencode-go'),
apiKey: '[redacted]',
modelId: 'muse-spark-1.2-contributor',
fetch,
});

await model.doGenerate({
prompt: [{ role: 'user', content: [{ type: 'text', text: 'ping' }] }],
});

assert.deepEqual(urls, ['https://opencode.ai/zen/go/v1/responses']);
});

test('normalizes the upstream Open Responses endpoint exactly once', () => {
assert.equal(
openResponsesUrl('https://api.deepseek.com/v1'),
Expand Down