fix: map OpenCode Zen models to correct APIs
This commit is contained in:
@@ -16,6 +16,7 @@ Docs: https://docs.clawd.bot
|
|||||||
### Fixes
|
### Fixes
|
||||||
- Config: avoid stack traces for invalid configs and log the config path.
|
- Config: avoid stack traces for invalid configs and log the config path.
|
||||||
- Doctor: warn when gateway.mode is unset with configure/config guidance.
|
- Doctor: warn when gateway.mode is unset with configure/config guidance.
|
||||||
|
- OpenCode Zen: route models to the Zen API shape per family so proxy endpoints are used. (#1416)
|
||||||
- macOS: include Textual syntax highlighting resources in packaged app to prevent chat crashes. (#1362)
|
- macOS: include Textual syntax highlighting resources in packaged app to prevent chat crashes. (#1362)
|
||||||
- Cron: cap reminder context history to 10 messages and honor `contextMessages`. (#1103) Thanks @mkbehr.
|
- Cron: cap reminder context history to 10 messages and honor `contextMessages`. (#1103) Thanks @mkbehr.
|
||||||
- Exec approvals: treat main as the default agent + migrate legacy default allowlists. (#1417) Thanks @czekaj.
|
- Exec approvals: treat main as the default agent + migrate legacy default allowlists. (#1417) Thanks @czekaj.
|
||||||
|
|||||||
@@ -44,6 +44,8 @@ describe("resolveOpencodeZenModelApi", () => {
|
|||||||
expect(resolveOpencodeZenModelApi("minimax-m2.1-free")).toBe("anthropic-messages");
|
expect(resolveOpencodeZenModelApi("minimax-m2.1-free")).toBe("anthropic-messages");
|
||||||
expect(resolveOpencodeZenModelApi("gemini-3-pro")).toBe("google-generative-ai");
|
expect(resolveOpencodeZenModelApi("gemini-3-pro")).toBe("google-generative-ai");
|
||||||
expect(resolveOpencodeZenModelApi("gpt-5.2")).toBe("openai-responses");
|
expect(resolveOpencodeZenModelApi("gpt-5.2")).toBe("openai-responses");
|
||||||
|
expect(resolveOpencodeZenModelApi("alpha-gd4")).toBe("openai-completions");
|
||||||
|
expect(resolveOpencodeZenModelApi("big-pickle")).toBe("openai-completions");
|
||||||
expect(resolveOpencodeZenModelApi("glm-4.7-free")).toBe("openai-completions");
|
expect(resolveOpencodeZenModelApi("glm-4.7-free")).toBe("openai-completions");
|
||||||
expect(resolveOpencodeZenModelApi("some-unknown-model")).toBe("openai-completions");
|
expect(resolveOpencodeZenModelApi("some-unknown-model")).toBe("openai-completions");
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -87,19 +87,19 @@ export function resolveOpencodeZenAlias(modelIdOrAlias: string): string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* OpenCode Zen routes models to different APIs based on model family.
|
* OpenCode Zen routes models to specific API shapes by family.
|
||||||
*/
|
*/
|
||||||
export function resolveOpencodeZenModelApi(modelId: string): ModelApi {
|
export function resolveOpencodeZenModelApi(modelId: string): ModelApi {
|
||||||
const lower = modelId.toLowerCase();
|
const lower = modelId.toLowerCase();
|
||||||
if (lower.startsWith("claude-") || lower.startsWith("minimax") || lower.startsWith("alpha-gd4")) {
|
if (lower.startsWith("gpt-")) {
|
||||||
|
return "openai-responses";
|
||||||
|
}
|
||||||
|
if (lower.startsWith("claude-") || lower.startsWith("minimax-")) {
|
||||||
return "anthropic-messages";
|
return "anthropic-messages";
|
||||||
}
|
}
|
||||||
if (lower.startsWith("gemini-")) {
|
if (lower.startsWith("gemini-")) {
|
||||||
return "google-generative-ai";
|
return "google-generative-ai";
|
||||||
}
|
}
|
||||||
if (lower.startsWith("gpt-")) {
|
|
||||||
return "openai-responses";
|
|
||||||
}
|
|
||||||
return "openai-completions";
|
return "openai-completions";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user