|
| 1 | +// Known OpenCode Zen models and the wire protocol each one requires, from |
| 2 | +// https://opencode.ai/docs/zen/#available-models. Zen's /models catalog is |
| 3 | +// the live source of truth; this map only pins the protocol assignment per |
| 4 | +// known id. Unknown ids default to chat completions (the status quo). |
| 5 | + |
| 6 | +/** Packaged fallback seed: live discovery fallback + picker default, never empty. */ |
| 7 | +export const ZEN_MODEL_IDS: readonly string[] = [ |
| 8 | + "gpt-6-astra", |
| 9 | + "gpt-5.4", |
| 10 | + "gpt-5.4-mini", |
| 11 | + "claude-fable-5-1", |
| 12 | + "claude-sonnet-4-5", |
| 13 | + "claude-opus-4-5", |
| 14 | + "gemini-3-flash", |
| 15 | + "gemini-3-pro", |
| 16 | +]; |
| 17 | + |
| 18 | +export const ZEN_DEFAULT_MODEL = "claude-sonnet-4-5"; |
| 19 | + |
| 20 | +export type ZenProtocol = "messages" | "responses" | "chat-completions"; |
| 21 | + |
| 22 | +interface ZenModel { |
| 23 | + id: string; |
| 24 | + protocol: ZenProtocol; |
| 25 | +} |
| 26 | + |
| 27 | +const ZEN_MODELS: readonly ZenModel[] = [ |
| 28 | + // Anthropic Messages API |
| 29 | + { id: "claude-fable-5-1", protocol: "messages" }, |
| 30 | + { id: "claude-fable-5", protocol: "messages" }, |
| 31 | + { id: "claude-opus-5", protocol: "messages" }, |
| 32 | + { id: "claude-opus-4-8", protocol: "messages" }, |
| 33 | + { id: "claude-opus-4-7", protocol: "messages" }, |
| 34 | + { id: "claude-opus-4-6", protocol: "messages" }, |
| 35 | + { id: "claude-opus-4-5", protocol: "messages" }, |
| 36 | + { id: "claude-sonnet-5", protocol: "messages" }, |
| 37 | + { id: "claude-sonnet-4-6", protocol: "messages" }, |
| 38 | + { id: "claude-sonnet-4-5", protocol: "messages" }, |
| 39 | + { id: "claude-haiku-4-5", protocol: "messages" }, |
| 40 | + { id: "qwen3.7-max", protocol: "messages" }, |
| 41 | + { id: "qwen3.7-plus", protocol: "messages" }, |
| 42 | + { id: "qwen3.6-plus", protocol: "messages" }, |
| 43 | + { id: "qwen3.5-plus", protocol: "messages" }, |
| 44 | + // OpenAI Responses API |
| 45 | + { id: "gpt-6-astra", protocol: "responses" }, |
| 46 | + { id: "gpt-5.6-sol", protocol: "responses" }, |
| 47 | + { id: "gpt-5.6-terra", protocol: "responses" }, |
| 48 | + { id: "gpt-5.6-luna", protocol: "responses" }, |
| 49 | + { id: "gpt-5.5", protocol: "responses" }, |
| 50 | + { id: "gpt-5.5-pro", protocol: "responses" }, |
| 51 | + { id: "gpt-5.4", protocol: "responses" }, |
| 52 | + { id: "gpt-5.4-pro", protocol: "responses" }, |
| 53 | + { id: "gpt-5.4-mini", protocol: "responses" }, |
| 54 | + { id: "gpt-5.4-nano", protocol: "responses" }, |
| 55 | + { id: "gpt-5.3-codex", protocol: "responses" }, |
| 56 | + { id: "gpt-5.3-codex-spark", protocol: "responses" }, |
| 57 | + { id: "gpt-5.2", protocol: "responses" }, |
| 58 | + { id: "gpt-5.2-codex", protocol: "responses" }, |
| 59 | + { id: "gpt-5.1", protocol: "responses" }, |
| 60 | + { id: "gpt-5.1-codex", protocol: "responses" }, |
| 61 | + { id: "gpt-5.1-codex-max", protocol: "responses" }, |
| 62 | + { id: "gpt-5.1-codex-mini", protocol: "responses" }, |
| 63 | + { id: "gpt-5", protocol: "responses" }, |
| 64 | + { id: "gpt-5-codex", protocol: "responses" }, |
| 65 | + { id: "gpt-5-nano", protocol: "responses" }, |
| 66 | + { id: "grok-4.6", protocol: "responses" }, |
| 67 | + { id: "grok-4.5", protocol: "responses" }, |
| 68 | + { id: "grok-build-0.1", protocol: "responses" }, |
| 69 | + { id: "muse-spark-1.3", protocol: "responses" }, |
| 70 | + { id: "muse-spark-1.2", protocol: "responses" }, |
| 71 | + { id: "muse-spark-1.3-contributor-free", protocol: "responses" }, |
| 72 | + // OpenAI Chat Completions API (explicit; unknown ids also land here) |
| 73 | + { id: "deepseek-v4-pro", protocol: "chat-completions" }, |
| 74 | + { id: "deepseek-v4-flash", protocol: "chat-completions" }, |
| 75 | + { id: "deepseek-v4-flash-vision-exp", protocol: "chat-completions" }, |
| 76 | + { id: "minimax-m3", protocol: "chat-completions" }, |
| 77 | + { id: "minimax-m2.7", protocol: "chat-completions" }, |
| 78 | + { id: "minimax-m2.5", protocol: "chat-completions" }, |
| 79 | + { id: "glm-5.3-flash", protocol: "chat-completions" }, |
| 80 | + { id: "glm-5.3", protocol: "chat-completions" }, |
| 81 | + { id: "glm-5.2", protocol: "chat-completions" }, |
| 82 | + { id: "glm-5.1", protocol: "chat-completions" }, |
| 83 | + { id: "glm-5", protocol: "chat-completions" }, |
| 84 | + { id: "kimi-k2.5", protocol: "chat-completions" }, |
| 85 | + { id: "kimi-k2.6", protocol: "chat-completions" }, |
| 86 | + { id: "kimi-k2.7-code", protocol: "chat-completions" }, |
| 87 | + { id: "kimi-k3", protocol: "chat-completions" }, |
| 88 | + { id: "big-pickle", protocol: "chat-completions" }, |
| 89 | + { id: "mimo-v2.5-free", protocol: "chat-completions" }, |
| 90 | + { id: "ling-3.0-flash-fin-free", protocol: "chat-completions" }, |
| 91 | + { id: "nemotron-3-ultra-free", protocol: "chat-completions" }, |
| 92 | + { id: "nemotron-3.5-lightning-free", protocol: "chat-completions" }, |
| 93 | + { id: "gemini-3-flash", protocol: "chat-completions" }, |
| 94 | + { id: "gemini-3-pro", protocol: "chat-completions" }, |
| 95 | +]; |
| 96 | + |
| 97 | +const PROTOCOL_BY_ID = new Map<string, ZenProtocol>( |
| 98 | + ZEN_MODELS.map((model) => [model.id, model.protocol]), |
| 99 | +); |
| 100 | + |
| 101 | +/** |
| 102 | + * Return the wire protocol for a known Zen model id. Unknown ids default to |
| 103 | + * chat completions — the status quo for an unmapped model, never inferred |
| 104 | + * from name prefixes. |
| 105 | + */ |
| 106 | +export function protocolForZenModel(modelId: string): ZenProtocol { |
| 107 | + return PROTOCOL_BY_ID.get(modelId) ?? "chat-completions"; |
| 108 | +} |
| 109 | + |
| 110 | +export function isKnownZenModel(modelId: string): boolean { |
| 111 | + return PROTOCOL_BY_ID.has(modelId); |
| 112 | +} |
0 commit comments