Skip to content

feat(providers): add OpenCode Zen gateway as a declarative provider - #10939

Merged
michaelneale merged 2 commits into
aaif-goose:mainfrom
vincenzopalazzo:feat/opencode-zen-provider
Aug 24, 2026
Merged

michaelneale merged 2 commits into
aaif-goose:mainfrom
vincenzopalazzo:feat/opencode-zen-provider

Conversation

@vincenzopalazzo

Copy link
Copy Markdown
Contributor

Summary

  • Adds the main OpenCode Zen gateway (https://opencode.ai/zen/v1) as a bundled declarative provider — opencode_zen — alongside the existing opencode_go.
  • Mirrors the opencode_go.json pattern; catalog_provider_id: "opencode" matches the canonical registry entry.
  • Model list is the curated set of models Zen serves over the OpenAI-compatible /chat/completions endpoint.

Context

Issue #8381 ("Add OpenCode Go/OpenCode Zen to provider configuration") was closed stating both shipped in #6934, but only OpenCode Go (/zen/go/v1) ever received a bundled declarative definition (opencode_go.json). The main Zen gateway never got one, so it was only reachable via manual custom-provider setup. This fills that gap.

Design choice: static curated model list (dynamic_models: false)

The Zen gateway serves models over multiple wire formats:

  • /chat/completions — DeepSeek, MiniMax, GLM, Kimi, MiMo (OpenAI-compatible) ✓ included
  • /responses — GPT, Grok
  • /messages — Claude, Qwen
  • Google wire format — Gemini

The declarative openai engine only speaks /chat/completions. With dynamic_models: true, fetch_supported_models would hit /v1/models and surface all 85 models — including GPT/Claude/Gemini — which would then fail with a wire-format mismatch. So this lists only the documented /chat/completions models. (If maintainers confirm Zen's /chat/completions normalizes all models, this can be flipped to dynamic_models: true.)

Verification

  • cargo test -p goose-providers --lib declarative → 10 passed, incl. expose_declarative_providers_enumerates_all_bundled_json_files and all_bundled_providers_are_valid
  • cargo clippy -p goose-providers --all-targets -- -D warnings → clean

Maintainer-directed; no separate Ready issue (context issue #8381 is closed).

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3018cf5a7c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0eba471176

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

"dynamic_models": false,
"model_doc_link": "https://opencode.ai/docs/zen",
"preserves_thinking": true,
"models": [

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Include all Zen chat-completions models

Because dynamic_models is false, fetch_supported_models returns only this static array, so documented OpenCode Zen /chat/completions models that are not listed here are undiscoverable in goose. I checked the current Zen docs and /zen/v1/models payload: compatible models such as big-pickle, laguna-s-2.1-free, ling-3.0-flash-free, longcat-2.0-free, north-mini-code-free, nemotron-3-ultra-free, and glm-5 are served on the same OpenAI-compatible endpoint but will not appear in model selection or inventory refresh unless users manually type them.

Useful? React with 👍 / 👎.

@vincenzopalazzo
vincenzopalazzo force-pushed the feat/opencode-zen-provider branch from 0eba471 to 5dcef55 Compare August 8, 2026 16:16

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5dcef5541a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

{"name": "glm-5.1", "context_limit": 204800},
{"name": "deepseek-v4-pro", "context_limit": 1000000},
{"name": "deepseek-v4-flash", "context_limit": 1000000},
{"name": "deepseek-v4-flash-free", "context_limit": 1000000},

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Correct the free Flash context limit

For deepseek-v4-flash-free, this declares a 1,000,000-token window even though the bundled canonical record specifies 200,000 (canonical_models.json:112540-112542); other new entries such as Kimi K3 and MiniMax M3 also disagree with that catalog. Canonical materialization corrects normal requests, but the CLI model-switch path reads metadata().known_models directly (crates/goose-cli/src/session/mod.rs:955-969), so switching from a model with a 200k–1m context to this model suppresses the smaller-window/compaction warning. Align the declared limits with the canonical records.

Useful? React with 👍 / 👎.

@vincenzopalazzo

Copy link
Copy Markdown
Contributor Author

Rebased onto main (clean, no conflicts).

Verification after rebase

  • cargo test -p goose-providers --lib declarative — 10 passed.
  • cargo test -p goose-provider-types --lib canonical — 17 passed.

OpenCode Go (/zen/go/v1) already ships as opencode_go.json, but the main Zen gateway (https://opencode.ai/zen/v1) was missing a bundled definition (see issue aaif-goose#8381). Add opencode_zen.json following the same pattern, with catalog_provider_id opencode matching the canonical registry. Lists the models Zen serves over /chat/completions (DeepSeek, GLM, Kimi, MiniMax, Qwen, MiMo); GPT/Grok (/responses), Claude (/messages) and Gemini (Google wire format) use other endpoints and are excluded so the OpenAI-compatible engine only surfaces models it can serve.
map_provider_name aliased opencode_go to opencode-go but had no arm for opencode_zen, so canonicalization looked up opencode_zen/<model> instead of opencode/<model> and missed the 85 real opencode/* records (context limits, costs, reasoning). Add opencode_zen -> opencode, mirroring opencode_go, plus a parallel test.
@michaelneale
michaelneale force-pushed the feat/opencode-zen-provider branch from 5dcef55 to fe06145 Compare August 24, 2026 07:24
@michaelneale

Copy link
Copy Markdown
Collaborator

🤖 Rebased feat/opencode-zen-provider onto latest main (no code changes — commits fe06145/3d545a72e are your originals, authorship preserved). The two CI failures (schema-check, desktop-lint) were a broken ui/pnpm-lock.yaml on the old base, fixed on main by #11386. All checks now green. — Galadriel (agent for @michaelneale)

@michaelneale michaelneale left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@michaelneale
michaelneale added this pull request to the merge queue Aug 24, 2026
Merged via the queue into aaif-goose:main with commit bd16fbf Aug 24, 2026
28 checks passed
@vincenzopalazzo

Copy link
Copy Markdown
Contributor Author

@michaelneale Thanks for merging. I am wondering if we should take a different approach here on adding models and have some sort of skill built into Goose to set up a model?

I need to be honest, it is overwhelming now for non-tech people choose the right provider :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants