Created
June 30, 2026 19:13
-
-
Save gretel/558d09395e93b44186e17438087c7dca to your computer and use it in GitHub Desktop.
dirge plugin: register OpenCode Zen & Go providers (OpenAI + Anthropic endpoints)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # OpenCode provider registration (P1) | |
| # | |
| # Registers OpenAI-compatible and Anthropic-compatible endpoints for | |
| # OpenCode's two model namespaces: | |
| # | |
| # Zen — curated models (Claude, GPT, Gemini, DeepSeek, Qwen, etc.) | |
| # Go — low-cost subscription for open coding models | |
| # | |
| # Both use the same OPENCODE_API_KEY. | |
| # | |
| # Usage | |
| # ----- | |
| # 1. Get an API key from https://opencode.ai (Zen → API keys) | |
| # 2. Optionally subscribe to Go for open-model access | |
| # 3. Set OPENCODE_API_KEY in your environment (or use a .env loader) | |
| # 4. Restart dirge; the providers below are auto-loaded | |
| # 5. /model opencode-zen/claude-sonnet-4-6 | |
| # /model opencode-go/glm-5.2 | |
| # etc. | |
| # | |
| # To see the full model catalogue: | |
| # https://opencode.ai/docs/zen/#models | |
| # https://opencode.ai/docs/go/#models | |
| # | |
| # Or curl (requires a key with active credits): | |
| # curl -H "Authorization: Bearer $OPENCODE_API_KEY" \ | |
| # https://opencode.ai/zen/v1/models | jq . | |
| # | |
| # Not supported in this plugin | |
| # ---------------------------- | |
| # - GPT models using OpenAI's /v1/responses endpoint (different | |
| # protocol from /v1/chat/completions — rig has no Responses API | |
| # client). Use openrouter/gpt-5.5 as a fallback. | |
| # - Gemini models (OpenCode's Gemini endpoint structure differs from | |
| # what rig's gemini provider expects under `base_url`). | |
| # | |
| # Provider table | |
| # -------------- | |
| # | /model prefix | protocol | base URL | | |
| # |-------------------------------|------------|-------------------------------------------------------| | |
| # | opencode-zen | openai | https://opencode.ai/zen/v1 | | |
| # | opencode-zen-anthropic | anthropic | https://opencode.ai/zen/v1 | | |
| # | opencode-go | openai | https://opencode.ai/zen/go/v1 | | |
| # | opencode-go-anthropic | anthropic | https://opencode.ai/zen/go/v1 | | |
| (var env "OPENCODE_API_KEY") | |
| # --- Zen: OpenAI-compatible --- | |
| # DeepSeek, MiniMax, GLM, Kimi, Grok, Big Pickle, MiMo, North, Nemotron | |
| (harness/register-provider | |
| "opencode-zen" | |
| "openai" | |
| "https://opencode.ai/zen/v1" | |
| env) | |
| # --- Zen: Anthropic-compatible --- | |
| # Claude (Fable, Opus, Sonnet, Haiku), Qwen | |
| (harness/register-provider | |
| "opencode-zen-anthropic" | |
| "anthropic" | |
| "https://opencode.ai/zen/v1" | |
| env) | |
| # --- Go: OpenAI-compatible --- | |
| # GLM, Kimi, DeepSeek, MiMo, MiniMax M3 | |
| (harness/register-provider | |
| "opencode-go" | |
| "openai" | |
| "https://opencode.ai/zen/go/v1" | |
| env) | |
| # --- Go: Anthropic-compatible --- | |
| # MiniMax M2.7/M2.5, Qwen | |
| (harness/register-provider | |
| "opencode-go-anthropic" | |
| "anthropic" | |
| "https://opencode.ai/zen/go/v1" | |
| env) | |
| (defn opencode-models-handler | |
| "Slash command: print OpenCode model quick-reference." | |
| [arg-string] | |
| (string | |
| "OpenCode providers registered. Select a model with:\n" | |
| "\n" | |
| " /model opencode-zen/<model-id>\n" | |
| " /model opencode-zen-anthropic/<model-id>\n" | |
| " /model opencode-go/<model-id>\n" | |
| " /model opencode-go-anthropic/<model-id>\n" | |
| "\n" | |
| "Zen — OpenAI-compatible models:\n" | |
| " deepseek-v4-pro, deepseek-v4-flash, minimax-m2.7, minimax-m2.5,\n" | |
| " glm-5.2, glm-5.1, glm-5, kimi-k2.5, kimi-k2.6,\n" | |
| " grok-build-0.1, big-pickle,\n" | |
| " mimo-v2.5-free, north-mini-code-free, nemotron-3-ultra-free,\n" | |
| " deepseek-v4-flash-free\n" | |
| "\n" | |
| "Zen — Anthropic-compatible models:\n" | |
| " claude-fable-5, claude-opus-4-8, claude-opus-4-7, claude-opus-4-6,\n" | |
| " claude-opus-4-5, claude-opus-4-1,\n" | |
| " claude-sonnet-4-6, claude-sonnet-4-5, claude-sonnet-4,\n" | |
| " claude-haiku-4-5, claude-3-5-haiku,\n" | |
| " qwen3.7-max, qwen3.7-plus, qwen3.6-plus, qwen3.5-plus\n" | |
| "\n" | |
| "Go — OpenAI-compatible models:\n" | |
| " glm-5.2, glm-5.1, kimi-k2.7-code, kimi-k2.6,\n" | |
| " deepseek-v4-pro, deepseek-v4-flash,\n" | |
| " mimo-v2.5, mimo-v2.5-pro, minimax-m3\n" | |
| "\n" | |
| "Go — Anthropic-compatible models:\n" | |
| " minimax-m2.7, minimax-m2.5,\n" | |
| " qwen3.7-max, qwen3.7-plus, qwen3.6-plus\n" | |
| "\n" | |
| "Full catalogue: https://opencode.ai/docs/zen/#models\n" | |
| "Go models: https://opencode.ai/docs/go/#models\n" | |
| "\n" | |
| "Not supported (different API protocol):\n" | |
| " GPT 5.x models (OpenAI Responses API)\n" | |
| " Gemini models (endpoint structure mismatch)")) | |
| (harness/register-command "opencode-models" "opencode-models-handler") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment