xonecas.io
64875
Mc

mini-coder / commit d27dccb

refactor(providers): replace hardcoded Zen model sets with prefix-based routing

Replace ZEN_ANTHROPIC_MODELS, ZEN_OPENAI_MODELS, ZEN_GOOGLE_MODELS Sets
with a zenEndpointFor() function that matches on model ID prefix:
- claude-* → @ai-sdk/anthropic (/messages)
- gpt-*    → @ai-sdk/openai (/responses)
- gemini-* → @ai-sdk/google
- *        → @ai-sdk/openai-compatible (/chat/completions)

This fixes custom commands (e.g. zen/claude-3-5-haiku) which were broken
because the hardcoded sets required manual updates for every new Zen model.
Routing now self-maintains as Zen adds models.

Sean2026-02-25 d27dccbf6ca2ced4f05d493701da9d8fe809e05d parent 9c2941c

2 files changed

TODO.md+5−0
@@ -1,5 +1,10 @@
11 # TODO
22
3+## Glob and grep ignore dot files and folders
4+
5+This is just dumb and an error when implementing the spec. We are making a dev tool, it's
6+**obvious** that dotfiles shouldn't be ignored. We should respect the gitignore and nothing more.
7+
38 ## Subagents don't have access to MCP tools?
49
510 Investigate if subagents are able to see the mcp tools. The user reported that after adding the exa mcp tools, that the subagents claimed to not be able to search online, but the main agent could.
src/llm-api/providers.ts+8−42
@@ -9,37 +9,13 @@ import { createOllama } from "ollama-ai-provider";
99
1010 const ZEN_BASE = "https://opencode.ai/zen/v1";
1111
12-// Models that use the Anthropic messages endpoint on Zen
13-const ZEN_ANTHROPIC_MODELS = new Set([
14- "claude-opus-4-6",
15- "claude-opus-4-5",
16- "claude-opus-4-1",
17- "claude-sonnet-4-6",
18- "claude-sonnet-4-5",
19- "claude-sonnet-4",
20- "claude-haiku-4-5",
21- "claude-3-5-haiku",
22-]);
23-
24-// Models that use the OpenAI responses endpoint on Zen
25-const ZEN_OPENAI_MODELS = new Set([
26- "gpt-5.2",
27- "gpt-5.2-codex",
28- "gpt-5.1",
29- "gpt-5.1-codex",
30- "gpt-5.1-codex-max",
31- "gpt-5.1-codex-mini",
32- "gpt-5",
33- "gpt-5-codex",
34- "gpt-5-nano",
35-]);
36-
37-// Models that use the Google generative AI endpoint on Zen
38-const ZEN_GOOGLE_MODELS = new Set([
39- "gemini-3.1-pro",
40- "gemini-3-pro",
41- "gemini-3-flash",
42-]);
12+// Zen endpoint routing — matched in order, fallthrough to OpenAI-compatible
13+function zenEndpointFor(modelId: string) {
14+ if (modelId.startsWith("claude-")) return zenAnthropic()(modelId);
15+ if (modelId.startsWith("gpt-")) return zenOpenAI()(modelId);
16+ if (modelId.startsWith("gemini-")) return zenGoogle()(modelId);
17+ return zenCompat()(modelId);
18+}
4319
4420 // ─── Lazy provider factories (created on first use) ───────────────────────────
4521
@@ -199,17 +175,7 @@ export function resolveModel(modelString: string): LanguageModel {
199175
200176 switch (provider) {
201177 case "zen": {
202- if (ZEN_ANTHROPIC_MODELS.has(modelId)) {
203- return zenAnthropic()(modelId);
204- }
205- if (ZEN_OPENAI_MODELS.has(modelId)) {
206- return zenOpenAI()(modelId);
207- }
208- if (ZEN_GOOGLE_MODELS.has(modelId)) {
209- return zenGoogle()(modelId);
210- }
211- // Fallback: assume OpenAI-compatible (MiniMax, GLM, Kimi, Qwen, etc.)
212- return zenCompat()(modelId);
178+ return zenEndpointFor(modelId);
213179 }
214180
215181 case "anthropic":