agent: Add Opencode Zen provider - #49589
Merged
Merged
Conversation
|
We require contributors to sign our Contributor License Agreement, and we don't have @ripgrim on file. You can sign our CLA at https://zed.dev/cla. Once you've signed, post a comment here that says '@cla-bot check'. |
Author
|
@cla-bot check |
|
The cla-bot has been summoned, and re-checked this pull request! |
Contributor
Contributor
|
We need this!!! |
📏 PR Size: 1148 lines changed (Size XL)Please note: this PR exceeds the 400 LOC soft limit.
|
benbrandt
enabled auto-merge (squash)
March 23, 2026 11:03
AmaanBilwar
pushed a commit
to AmaanBilwar/zed
that referenced
this pull request
Mar 23, 2026
Before you mark this PR as ready for review, make sure that you have: - [x] Added a solid test coverage and/or screenshots from doing manual testing - [x] Done a self-review taking into account security and performance aspects - [x] Aligned any UI changes with the [UI checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist) Per Opencode's website: > Zen gives you access to a curated set of AI models that OpenCode has tested and benchmarked specifically for coding agents. No need to worry about inconsistent performance and quality, use validated models that work. > - [x] Testing select models and consulting their teams > - [x] Working with providers to ensure they're delivered properly > - [x] Benchmarking all model-provider combinations we recommend There are so many models available, but only a few work well with coding agents. Most providers configure them differently with varying results. The models under the Zen umbrella typically have a more reliable token(s) per second speed with minimal outages. The opencode ecosystem has improved my workflow if not many others' ! Release Notes: - Added [Opencode Zen](https://opencode.ai/zen) to list of providers --------- Co-authored-by: Ben Brandt <benjamin.j.brandt@gmail.com> Co-authored-by: Bennet Bo Fenner <bennetbo@gmx.de>
Contributor
|
For other curious people, OpenCode Go can also be used by configuring the Go API URL and by configuring a Custom Model for MiniMax M2.7, MiMo V2 Pro, and GLM 5.1 (the other Go models are also available in Zen and are included in the default provider config): Attempting to use non-Go models will fail with an |
5 tasks
pull Bot
pushed a commit
to esinanturan/zed
that referenced
this pull request
Apr 24, 2026
**TL;DR**: add support for OpenCode Go (flat-rate monthly subscription) along the already-implemented OpenCode Zed (pay-as-you-go billing). > [!WARNING] > This code was written by LLMs, under the supervision of a so-called developer that never wrote Rust profesionally and that spends more time in Pages&Keynote than in an IDE. Self-Review Checklist: - [x] I've reviewed my own diff for quality, security, and reliability - [x] Unsafe blocks (if any) have justifying comments - [x] The content is consistent with the [UI/UX checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist) - [ ] Tests cover the new/changed behavior - [x] Performance impact has been considered and is acceptable ## Background OpenCode offers a few different ways to access models: - **free access to 3 models**, with feedback and data used to improve the model. These models use the OpenCode Zen API endpoints, but have different usage limits (200 requests per 5 hours) and have a different privacy policy. Some people disable or block the free models, some people are super-excited to have access to LLMs for free, and some people like using the free models to test new LLMs (at launch MiMo-V2 had 2 free weeks of usage, for example). - **pay-as-you-go access to 30 models** as part of the [OpenCode Zen](https://opencode.ai/zen) subscription. These models use the same OpenCode Zen API endpoints. - **flat-rate monthly access to 7 models** as part of the [OpenCode Go](https://opencode.ai/go) subscription. These models use the OpenCode Zen API endpoints with an extra `/go` appended to the path. There are 5-hour, weekly, and monthly usage limits and, additionally, users can toggle a switch in the OpenCode Console to use Zen models with their pay-as-you-go billing after the Go limits are hit. There's also a currently-paused [OpenCode Black](https://opencode.ai/black) flat-rate subscription with way higher usage limits and with access to more models, with $100 and $200 monthly plans. The whole thing is a bit messy, but it's great value and highly reliable LLM access! <br> zed-industries#49589 added support for OpenCode Zen by implementing a new `opencode` provider. OpenCode Go [could be used by overriding the API URL](zed-industries#49589 (comment)), but that is a terrible user experience: some models have to be manually added, the model list always shows the 30-something OpenCode Zen models, and free models cannot be used at all. I was annoyed by the experience of using OpenCode Go with Zed and this past week I had to test a bunch of LLMs and providers and harnesses, so I took this on as a test case 🙂 ## Implementation This PR makes the OpenCode provider more general (not just for Zen) and adds an `OpenCodeModelSubscription` concept which is then used to implement support for OpenCode Go. The free models are also broken out into their own subscription for a prettier model list. For a better user experience, the different subscriptions can be enabled or disabled, both in the settings file and in the UX: <img width="434" height="176" alt="Screenshot showing the OpenCode provider configuration, with the newly added toggles" src="https://github.com/user-attachments/assets/3520e114-00c8-4794-84bf-35cd72d9c57e" /> The code was written by LLMs, but I do understand it and I did a bunch of "manual" iterations and "manual" tweaks. Still, my Rust experience is non-existent so **I won't feel offended if y'all reject this PR**! I did consider alternatives (adding a new `opencode-go` provider and renaming this to `opencode-zen`, for example, or adding support for custom API URLs in OpenCode custom models which would've been the smallest code change but a terrible user experience, and so on) but all alternatives would have been, in my opinion, a worse user experience. **Tests I did**: - confirmed OpenCode Go models work as expected - confirmed OpenCode Zen Free models work as expected - confirmed I get an error when trying to use OpenCode Zen models since I don't have that subscription - confirmed the subcription toggles work as expected (model are shown/hidden, settings file is updated) **Notes**: - this PR is best reviewed commit-by-commit. I did not create a separate PR for the model updates to minimize delays - my exeprience with Rust is roughly zero, but I tried to strike a balance between idiomatic Rust and easy-to-read code - users of the OpenCode provider might have to do some re-configuration after this PR is merged since the model identifiers now include the subscription, eg `claude-haiku-4-5` is now `zen/claude-haiku-4-5`. Since this is a relatively new provider and the impact is small, I preffered that rather than adding complex migration/mapping logic. - does changing the provider name from "OpenCode Zen" to "OpenCode" break anything for y'all at Zed? - does changing the telemetry id from `"opencode/<model-id>"` to `"opencode/<subscription>/<model-id>"` break anything for y'all at Zed? --- Release Notes: - OpenCode provider: add support for OpenCode Go --------- Co-authored-by: Ben Brandt <benjamin.j.brandt@gmail.com>
piper-of-dawn
pushed a commit
to piper-of-dawn/zed
that referenced
this pull request
Apr 25, 2026
Before you mark this PR as ready for review, make sure that you have: - [x] Added a solid test coverage and/or screenshots from doing manual testing - [x] Done a self-review taking into account security and performance aspects - [x] Aligned any UI changes with the [UI checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist) Per Opencode's website: > Zen gives you access to a curated set of AI models that OpenCode has tested and benchmarked specifically for coding agents. No need to worry about inconsistent performance and quality, use validated models that work. > - [x] Testing select models and consulting their teams > - [x] Working with providers to ensure they're delivered properly > - [x] Benchmarking all model-provider combinations we recommend There are so many models available, but only a few work well with coding agents. Most providers configure them differently with varying results. The models under the Zen umbrella typically have a more reliable token(s) per second speed with minimal outages. The opencode ecosystem has improved my workflow if not many others' ! Release Notes: - Added [Opencode Zen](https://opencode.ai/zen) to list of providers --------- Co-authored-by: Ben Brandt <benjamin.j.brandt@gmail.com> Co-authored-by: Bennet Bo Fenner <bennetbo@gmx.de>
ebaah46
pushed a commit
to ebaah46/zed
that referenced
this pull request
May 6, 2026
**TL;DR**: add support for OpenCode Go (flat-rate monthly subscription) along the already-implemented OpenCode Zed (pay-as-you-go billing). > [!WARNING] > This code was written by LLMs, under the supervision of a so-called developer that never wrote Rust profesionally and that spends more time in Pages&Keynote than in an IDE. Self-Review Checklist: - [x] I've reviewed my own diff for quality, security, and reliability - [x] Unsafe blocks (if any) have justifying comments - [x] The content is consistent with the [UI/UX checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist) - [ ] Tests cover the new/changed behavior - [x] Performance impact has been considered and is acceptable ## Background OpenCode offers a few different ways to access models: - **free access to 3 models**, with feedback and data used to improve the model. These models use the OpenCode Zen API endpoints, but have different usage limits (200 requests per 5 hours) and have a different privacy policy. Some people disable or block the free models, some people are super-excited to have access to LLMs for free, and some people like using the free models to test new LLMs (at launch MiMo-V2 had 2 free weeks of usage, for example). - **pay-as-you-go access to 30 models** as part of the [OpenCode Zen](https://opencode.ai/zen) subscription. These models use the same OpenCode Zen API endpoints. - **flat-rate monthly access to 7 models** as part of the [OpenCode Go](https://opencode.ai/go) subscription. These models use the OpenCode Zen API endpoints with an extra `/go` appended to the path. There are 5-hour, weekly, and monthly usage limits and, additionally, users can toggle a switch in the OpenCode Console to use Zen models with their pay-as-you-go billing after the Go limits are hit. There's also a currently-paused [OpenCode Black](https://opencode.ai/black) flat-rate subscription with way higher usage limits and with access to more models, with $100 and $200 monthly plans. The whole thing is a bit messy, but it's great value and highly reliable LLM access! <br> zed-industries#49589 added support for OpenCode Zen by implementing a new `opencode` provider. OpenCode Go [could be used by overriding the API URL](zed-industries#49589 (comment)), but that is a terrible user experience: some models have to be manually added, the model list always shows the 30-something OpenCode Zen models, and free models cannot be used at all. I was annoyed by the experience of using OpenCode Go with Zed and this past week I had to test a bunch of LLMs and providers and harnesses, so I took this on as a test case 🙂 ## Implementation This PR makes the OpenCode provider more general (not just for Zen) and adds an `OpenCodeModelSubscription` concept which is then used to implement support for OpenCode Go. The free models are also broken out into their own subscription for a prettier model list. For a better user experience, the different subscriptions can be enabled or disabled, both in the settings file and in the UX: <img width="434" height="176" alt="Screenshot showing the OpenCode provider configuration, with the newly added toggles" src="https://github.com/user-attachments/assets/3520e114-00c8-4794-84bf-35cd72d9c57e" /> The code was written by LLMs, but I do understand it and I did a bunch of "manual" iterations and "manual" tweaks. Still, my Rust experience is non-existent so **I won't feel offended if y'all reject this PR**! I did consider alternatives (adding a new `opencode-go` provider and renaming this to `opencode-zen`, for example, or adding support for custom API URLs in OpenCode custom models which would've been the smallest code change but a terrible user experience, and so on) but all alternatives would have been, in my opinion, a worse user experience. **Tests I did**: - confirmed OpenCode Go models work as expected - confirmed OpenCode Zen Free models work as expected - confirmed I get an error when trying to use OpenCode Zen models since I don't have that subscription - confirmed the subcription toggles work as expected (model are shown/hidden, settings file is updated) **Notes**: - this PR is best reviewed commit-by-commit. I did not create a separate PR for the model updates to minimize delays - my exeprience with Rust is roughly zero, but I tried to strike a balance between idiomatic Rust and easy-to-read code - users of the OpenCode provider might have to do some re-configuration after this PR is merged since the model identifiers now include the subscription, eg `claude-haiku-4-5` is now `zen/claude-haiku-4-5`. Since this is a relatively new provider and the impact is small, I preffered that rather than adding complex migration/mapping logic. - does changing the provider name from "OpenCode Zen" to "OpenCode" break anything for y'all at Zed? - does changing the telemetry id from `"opencode/<model-id>"` to `"opencode/<subscription>/<model-id>"` break anything for y'all at Zed? --- Release Notes: - OpenCode provider: add support for OpenCode Go --------- Co-authored-by: Ben Brandt <benjamin.j.brandt@gmail.com>
kathbigra
pushed a commit
to kathbigra/zed
that referenced
this pull request
May 10, 2026
**TL;DR**: add support for OpenCode Go (flat-rate monthly subscription) along the already-implemented OpenCode Zed (pay-as-you-go billing). > [!WARNING] > This code was written by LLMs, under the supervision of a so-called developer that never wrote Rust profesionally and that spends more time in Pages&Keynote than in an IDE. Self-Review Checklist: - [x] I've reviewed my own diff for quality, security, and reliability - [x] Unsafe blocks (if any) have justifying comments - [x] The content is consistent with the [UI/UX checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist) - [ ] Tests cover the new/changed behavior - [x] Performance impact has been considered and is acceptable ## Background OpenCode offers a few different ways to access models: - **free access to 3 models**, with feedback and data used to improve the model. These models use the OpenCode Zen API endpoints, but have different usage limits (200 requests per 5 hours) and have a different privacy policy. Some people disable or block the free models, some people are super-excited to have access to LLMs for free, and some people like using the free models to test new LLMs (at launch MiMo-V2 had 2 free weeks of usage, for example). - **pay-as-you-go access to 30 models** as part of the [OpenCode Zen](https://opencode.ai/zen) subscription. These models use the same OpenCode Zen API endpoints. - **flat-rate monthly access to 7 models** as part of the [OpenCode Go](https://opencode.ai/go) subscription. These models use the OpenCode Zen API endpoints with an extra `/go` appended to the path. There are 5-hour, weekly, and monthly usage limits and, additionally, users can toggle a switch in the OpenCode Console to use Zen models with their pay-as-you-go billing after the Go limits are hit. There's also a currently-paused [OpenCode Black](https://opencode.ai/black) flat-rate subscription with way higher usage limits and with access to more models, with $100 and $200 monthly plans. The whole thing is a bit messy, but it's great value and highly reliable LLM access! <br> zed-industries#49589 added support for OpenCode Zen by implementing a new `opencode` provider. OpenCode Go [could be used by overriding the API URL](zed-industries#49589 (comment)), but that is a terrible user experience: some models have to be manually added, the model list always shows the 30-something OpenCode Zen models, and free models cannot be used at all. I was annoyed by the experience of using OpenCode Go with Zed and this past week I had to test a bunch of LLMs and providers and harnesses, so I took this on as a test case 🙂 ## Implementation This PR makes the OpenCode provider more general (not just for Zen) and adds an `OpenCodeModelSubscription` concept which is then used to implement support for OpenCode Go. The free models are also broken out into their own subscription for a prettier model list. For a better user experience, the different subscriptions can be enabled or disabled, both in the settings file and in the UX: <img width="434" height="176" alt="Screenshot showing the OpenCode provider configuration, with the newly added toggles" src="https://github.com/user-attachments/assets/3520e114-00c8-4794-84bf-35cd72d9c57e" /> The code was written by LLMs, but I do understand it and I did a bunch of "manual" iterations and "manual" tweaks. Still, my Rust experience is non-existent so **I won't feel offended if y'all reject this PR**! I did consider alternatives (adding a new `opencode-go` provider and renaming this to `opencode-zen`, for example, or adding support for custom API URLs in OpenCode custom models which would've been the smallest code change but a terrible user experience, and so on) but all alternatives would have been, in my opinion, a worse user experience. **Tests I did**: - confirmed OpenCode Go models work as expected - confirmed OpenCode Zen Free models work as expected - confirmed I get an error when trying to use OpenCode Zen models since I don't have that subscription - confirmed the subcription toggles work as expected (model are shown/hidden, settings file is updated) **Notes**: - this PR is best reviewed commit-by-commit. I did not create a separate PR for the model updates to minimize delays - my exeprience with Rust is roughly zero, but I tried to strike a balance between idiomatic Rust and easy-to-read code - users of the OpenCode provider might have to do some re-configuration after this PR is merged since the model identifiers now include the subscription, eg `claude-haiku-4-5` is now `zen/claude-haiku-4-5`. Since this is a relatively new provider and the impact is small, I preffered that rather than adding complex migration/mapping logic. - does changing the provider name from "OpenCode Zen" to "OpenCode" break anything for y'all at Zed? - does changing the telemetry id from `"opencode/<model-id>"` to `"opencode/<subscription>/<model-id>"` break anything for y'all at Zed? --- Release Notes: - OpenCode provider: add support for OpenCode Go --------- Co-authored-by: Ben Brandt <benjamin.j.brandt@gmail.com>
jasonsmithio
pushed a commit
to paddleboarddev/paddleboard
that referenced
this pull request
May 31, 2026
**TL;DR**: add support for OpenCode Go (flat-rate monthly subscription) along the already-implemented OpenCode Zed (pay-as-you-go billing). > [!WARNING] > This code was written by LLMs, under the supervision of a so-called developer that never wrote Rust profesionally and that spends more time in Pages&Keynote than in an IDE. Self-Review Checklist: - [x] I've reviewed my own diff for quality, security, and reliability - [x] Unsafe blocks (if any) have justifying comments - [x] The content is consistent with the [UI/UX checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist) - [ ] Tests cover the new/changed behavior - [x] Performance impact has been considered and is acceptable ## Background OpenCode offers a few different ways to access models: - **free access to 3 models**, with feedback and data used to improve the model. These models use the OpenCode Zen API endpoints, but have different usage limits (200 requests per 5 hours) and have a different privacy policy. Some people disable or block the free models, some people are super-excited to have access to LLMs for free, and some people like using the free models to test new LLMs (at launch MiMo-V2 had 2 free weeks of usage, for example). - **pay-as-you-go access to 30 models** as part of the [OpenCode Zen](https://opencode.ai/zen) subscription. These models use the same OpenCode Zen API endpoints. - **flat-rate monthly access to 7 models** as part of the [OpenCode Go](https://opencode.ai/go) subscription. These models use the OpenCode Zen API endpoints with an extra `/go` appended to the path. There are 5-hour, weekly, and monthly usage limits and, additionally, users can toggle a switch in the OpenCode Console to use Zen models with their pay-as-you-go billing after the Go limits are hit. There's also a currently-paused [OpenCode Black](https://opencode.ai/black) flat-rate subscription with way higher usage limits and with access to more models, with $100 and $200 monthly plans. The whole thing is a bit messy, but it's great value and highly reliable LLM access! <br> zed-industries/zed#49589 added support for OpenCode Zen by implementing a new `opencode` provider. OpenCode Go [could be used by overriding the API URL](zed-industries/zed#49589 (comment)), but that is a terrible user experience: some models have to be manually added, the model list always shows the 30-something OpenCode Zen models, and free models cannot be used at all. I was annoyed by the experience of using OpenCode Go with Zed and this past week I had to test a bunch of LLMs and providers and harnesses, so I took this on as a test case 🙂 ## Implementation This PR makes the OpenCode provider more general (not just for Zen) and adds an `OpenCodeModelSubscription` concept which is then used to implement support for OpenCode Go. The free models are also broken out into their own subscription for a prettier model list. For a better user experience, the different subscriptions can be enabled or disabled, both in the settings file and in the UX: <img width="434" height="176" alt="Screenshot showing the OpenCode provider configuration, with the newly added toggles" src="https://github.com/user-attachments/assets/3520e114-00c8-4794-84bf-35cd72d9c57e" /> The code was written by LLMs, but I do understand it and I did a bunch of "manual" iterations and "manual" tweaks. Still, my Rust experience is non-existent so **I won't feel offended if y'all reject this PR**! I did consider alternatives (adding a new `opencode-go` provider and renaming this to `opencode-zen`, for example, or adding support for custom API URLs in OpenCode custom models which would've been the smallest code change but a terrible user experience, and so on) but all alternatives would have been, in my opinion, a worse user experience. **Tests I did**: - confirmed OpenCode Go models work as expected - confirmed OpenCode Zen Free models work as expected - confirmed I get an error when trying to use OpenCode Zen models since I don't have that subscription - confirmed the subcription toggles work as expected (model are shown/hidden, settings file is updated) **Notes**: - this PR is best reviewed commit-by-commit. I did not create a separate PR for the model updates to minimize delays - my exeprience with Rust is roughly zero, but I tried to strike a balance between idiomatic Rust and easy-to-read code - users of the OpenCode provider might have to do some re-configuration after this PR is merged since the model identifiers now include the subscription, eg `claude-haiku-4-5` is now `zen/claude-haiku-4-5`. Since this is a relatively new provider and the impact is small, I preffered that rather than adding complex migration/mapping logic. - does changing the provider name from "OpenCode Zen" to "OpenCode" break anything for y'all at Zed? - does changing the telemetry id from `"opencode/<model-id>"` to `"opencode/<subscription>/<model-id>"` break anything for y'all at Zed? --- Release Notes: - OpenCode provider: add support for OpenCode Go --------- Co-authored-by: Ben Brandt <benjamin.j.brandt@gmail.com>
5 tasks
Zenor27
pushed a commit
to Zenor27/zed
that referenced
this pull request
Jul 4, 2026
Before you mark this PR as ready for review, make sure that you have: - [x] Added a solid test coverage and/or screenshots from doing manual testing - [x] Done a self-review taking into account security and performance aspects - [x] Aligned any UI changes with the [UI checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist) Per Opencode's website: > Zen gives you access to a curated set of AI models that OpenCode has tested and benchmarked specifically for coding agents. No need to worry about inconsistent performance and quality, use validated models that work. > - [x] Testing select models and consulting their teams > - [x] Working with providers to ensure they're delivered properly > - [x] Benchmarking all model-provider combinations we recommend There are so many models available, but only a few work well with coding agents. Most providers configure them differently with varying results. The models under the Zen umbrella typically have a more reliable token(s) per second speed with minimal outages. The opencode ecosystem has improved my workflow if not many others' ! Release Notes: - Added [Opencode Zen](https://opencode.ai/zen) to list of providers --------- Co-authored-by: Ben Brandt <benjamin.j.brandt@gmail.com> Co-authored-by: Bennet Bo Fenner <bennetbo@gmx.de>
jonx
pushed a commit
to jonx/zed-aros
that referenced
this pull request
Jul 17, 2026
Before you mark this PR as ready for review, make sure that you have: - [x] Added a solid test coverage and/or screenshots from doing manual testing - [x] Done a self-review taking into account security and performance aspects - [x] Aligned any UI changes with the [UI checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist) Per Opencode's website: > Zen gives you access to a curated set of AI models that OpenCode has tested and benchmarked specifically for coding agents. No need to worry about inconsistent performance and quality, use validated models that work. > - [x] Testing select models and consulting their teams > - [x] Working with providers to ensure they're delivered properly > - [x] Benchmarking all model-provider combinations we recommend There are so many models available, but only a few work well with coding agents. Most providers configure them differently with varying results. The models under the Zen umbrella typically have a more reliable token(s) per second speed with minimal outages. The opencode ecosystem has improved my workflow if not many others' ! Release Notes: - Added [Opencode Zen](https://opencode.ai/zen) to list of providers --------- Co-authored-by: Ben Brandt <benjamin.j.brandt@gmail.com> Co-authored-by: Bennet Bo Fenner <bennetbo@gmx.de>
jonx
pushed a commit
to jonx/zed-aros
that referenced
this pull request
Jul 17, 2026
**TL;DR**: add support for OpenCode Go (flat-rate monthly subscription) along the already-implemented OpenCode Zed (pay-as-you-go billing). > [!WARNING] > This code was written by LLMs, under the supervision of a so-called developer that never wrote Rust profesionally and that spends more time in Pages&Keynote than in an IDE. Self-Review Checklist: - [x] I've reviewed my own diff for quality, security, and reliability - [x] Unsafe blocks (if any) have justifying comments - [x] The content is consistent with the [UI/UX checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist) - [ ] Tests cover the new/changed behavior - [x] Performance impact has been considered and is acceptable ## Background OpenCode offers a few different ways to access models: - **free access to 3 models**, with feedback and data used to improve the model. These models use the OpenCode Zen API endpoints, but have different usage limits (200 requests per 5 hours) and have a different privacy policy. Some people disable or block the free models, some people are super-excited to have access to LLMs for free, and some people like using the free models to test new LLMs (at launch MiMo-V2 had 2 free weeks of usage, for example). - **pay-as-you-go access to 30 models** as part of the [OpenCode Zen](https://opencode.ai/zen) subscription. These models use the same OpenCode Zen API endpoints. - **flat-rate monthly access to 7 models** as part of the [OpenCode Go](https://opencode.ai/go) subscription. These models use the OpenCode Zen API endpoints with an extra `/go` appended to the path. There are 5-hour, weekly, and monthly usage limits and, additionally, users can toggle a switch in the OpenCode Console to use Zen models with their pay-as-you-go billing after the Go limits are hit. There's also a currently-paused [OpenCode Black](https://opencode.ai/black) flat-rate subscription with way higher usage limits and with access to more models, with $100 and $200 monthly plans. The whole thing is a bit messy, but it's great value and highly reliable LLM access! <br> zed-industries#49589 added support for OpenCode Zen by implementing a new `opencode` provider. OpenCode Go [could be used by overriding the API URL](zed-industries#49589 (comment)), but that is a terrible user experience: some models have to be manually added, the model list always shows the 30-something OpenCode Zen models, and free models cannot be used at all. I was annoyed by the experience of using OpenCode Go with Zed and this past week I had to test a bunch of LLMs and providers and harnesses, so I took this on as a test case 🙂 ## Implementation This PR makes the OpenCode provider more general (not just for Zen) and adds an `OpenCodeModelSubscription` concept which is then used to implement support for OpenCode Go. The free models are also broken out into their own subscription for a prettier model list. For a better user experience, the different subscriptions can be enabled or disabled, both in the settings file and in the UX: <img width="434" height="176" alt="Screenshot showing the OpenCode provider configuration, with the newly added toggles" src="https://github.com/user-attachments/assets/3520e114-00c8-4794-84bf-35cd72d9c57e" /> The code was written by LLMs, but I do understand it and I did a bunch of "manual" iterations and "manual" tweaks. Still, my Rust experience is non-existent so **I won't feel offended if y'all reject this PR**! I did consider alternatives (adding a new `opencode-go` provider and renaming this to `opencode-zen`, for example, or adding support for custom API URLs in OpenCode custom models which would've been the smallest code change but a terrible user experience, and so on) but all alternatives would have been, in my opinion, a worse user experience. **Tests I did**: - confirmed OpenCode Go models work as expected - confirmed OpenCode Zen Free models work as expected - confirmed I get an error when trying to use OpenCode Zen models since I don't have that subscription - confirmed the subcription toggles work as expected (model are shown/hidden, settings file is updated) **Notes**: - this PR is best reviewed commit-by-commit. I did not create a separate PR for the model updates to minimize delays - my exeprience with Rust is roughly zero, but I tried to strike a balance between idiomatic Rust and easy-to-read code - users of the OpenCode provider might have to do some re-configuration after this PR is merged since the model identifiers now include the subscription, eg `claude-haiku-4-5` is now `zen/claude-haiku-4-5`. Since this is a relatively new provider and the impact is small, I preffered that rather than adding complex migration/mapping logic. - does changing the provider name from "OpenCode Zen" to "OpenCode" break anything for y'all at Zed? - does changing the telemetry id from `"opencode/<model-id>"` to `"opencode/<subscription>/<model-id>"` break anything for y'all at Zed? --- Release Notes: - OpenCode provider: add support for OpenCode Go --------- Co-authored-by: Ben Brandt <benjamin.j.brandt@gmail.com>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Before you mark this PR as ready for review, make sure that you have:
Per Opencode's website:
There are so many models available, but only a few work well with coding agents. Most providers configure them differently with varying results.
The models under the Zen umbrella typically have a more reliable token(s) per second speed with minimal outages. The opencode ecosystem has improved my workflow if not many others' !
Release Notes: