fix(opencode): route Muse Spark models to Responses API and declare vision

Route all Muse Spark models (not just 1.2) on OpenCode Free to
/zen/v1/responses via isMuseSparkModel(), fixing HTTP 500 on
muse-spark-1.3-contributor-free. Declare vision:true on Muse Spark
models so image input is no longer stripped; register 1.3 in the
registry and capabilities. Scoped to opencode only — other providers
keep Chat Completions routing.
This commit is contained in:
anojndr
2026-09-03 09:23:24 +07:00
parent b870b5d41b
commit acb5c34cdc
7 changed files with 94 additions and 26 deletions

View File

@@ -55,12 +55,17 @@ describe("OpenCode Free endpoint routing", () => {
expect(opencode.transport.format).toBeUndefined();
const muse = opencode.models.find((m) => m.id === MUSE);
expect(muse?.targetFormat).toBe("openai-responses");
const muse13 = opencode.models.find((m) => m.id === "muse-spark-1.3-contributor-free");
expect(muse13?.targetFormat).toBe("openai-responses");
});
it("routes Muse Spark to /responses and every other model to /chat/completions", () => {
const executor = new OpenCodeExecutor();
expect(executor.buildUrl(MUSE)).toBe("https://opencode.ai/zen/v1/responses");
expect(executor.buildUrl(`${MUSE}(xhigh)`)).toBe("https://opencode.ai/zen/v1/responses");
expect(executor.buildUrl("muse-spark-1.3-contributor-free")).toBe("https://opencode.ai/zen/v1/responses");
expect(executor.buildUrl("muse-spark-1.4-contributor-free")).toBe("https://opencode.ai/zen/v1/responses");
expect(executor.buildUrl("muse-spark-2.0-contributor-free(xhigh)")).toBe("https://opencode.ai/zen/v1/responses");
expect(executor.buildUrl("big-pickle")).toBe("https://opencode.ai/zen/v1/chat/completions");
expect(executor.buildUrl("hy3-free")).toBe("https://opencode.ai/zen/v1/chat/completions");
});