feat: add support for OpenCode Go provider#284
Closed
jheronimus wants to merge 20 commits into
Closed
Conversation
jheronimus
force-pushed
the
opencode-go-support
branch
6 times, most recently
from
July 9, 2026 19:00
9e376a2 to
b4d3c74
Compare
Contributor
Author
|
@alejandro-ao hi! I have went on and worked on this PR again Gone:
Added:
What's still being added apart from the config data:
Tests: apart from normal tests passing I've been using this extension for a couple days now. I also supplied an opencode-go-support.md doc that lists the researched capabilities for all the models and all the features currently missing from Tau that this commit implements. Let me know if anything is still needed to merge this, please. |
jheronimus
force-pushed
the
opencode-go-support
branch
from
July 13, 2026 11:03
a5af08b to
26867e6
Compare
…erified model overrides against OpenCode source code, added a design doc
Drop the parallel ProviderModelOverride/ThinkingMode abstraction. Merge kind, always_thinking, thinking_default, and thinking_level_labels into the existing ModelCatalogMetadata / ProviderModelMetadata types, reusing upstream's thinking_level_map for api_value lookups. Deleted: - ThinkingMode, ProviderModelOverride dataclasses - catalog_model_override() lookup function - _CatalogThinkingMode, _CatalogModelOverride Pydantic models - All override→metadata converters and serializers - _thinking_mode(), _thinking_api_value() helpers (use _metadata_thinking_value instead) Net -100 Python lines compared to previous approach.
The fallback in _thinking_level_map_supports returned for levels not in the map, causing xhigh to be silently excluded from any model that had a non-empty thinking_level_map (e.g. ) even when the model didn't declare unsupported_thinking_levels. Separated the two call sites: - _metadata_supports_thinking_level (used to filter provider-level thinking_levels through model metadata) now returns True for levels not in the map, since unsupported levels are explicitly marked via entries (from unsupported_thinking_levels). - _thinking_level_map_supports (used when deriving levels purely from a map, no provider-level thinking_levels) retains the old stricter behaviour. Fixes the startup error:
Corrections verified against https://github.com/anomalyco/models.dev: - Fix north-mini-code-free context window (256000 → 200000) - Add missing 'minimal' to unsupported_thinking_levels for deepseek models - Add thinking_level_map entries: north-mini-code-free (off→none, high→high) - Simplify minimax-m3: toggle-only model with off→disabled, no adaptive mapping - Remove obsolete minimax-m3 thinking_level_labels (high→on) and unsupported levels - Update test expectations to match corrected TOML
Toggle-only models (minimax-m3, qwen3.7-*) with thinking_level_map entries leaked non-xhigh levels via _thinking_level_map_supports fallback (level != "xhigh"). Fixed by adding explicit unsupported_thinking_levels for all on-levels except 'high' (the canonical on-level). Also changed qwen thinking_default from medium to high for consistency with the new restricted level set.
…x-m3 high as 'on'
Upstream models.dev data confirms:
- minimax-m3: reasoning_options = [{ type: 'toggle' }] → toggle-only,
needs 'on' label for the 'high' level
- qwen3.6-plus/qwen3.7-plus/qwen3.7-max: reasoning_options = [{ type: 'toggle' },
{ type: 'budget_tokens', max = 262_144 }] → toggle + budget, all levels work
Remove unsupported_thinking_levels from Qwen models so users can select
different thinking budgets. Add thinking_level_labels for minimax-m3
so UI shows 'on' instead of 'high'.
Fixes the startup error where saved xhigh default was rejected for qwen3.6-plus:
now xhigh is actually available for Qwen models.
Minimax-m3 is a toggle-only model — the upstream models.dev data shows
reasoning_options = [{ type: 'toggle' }] with no budget_tokens support.
Previously, the 'on' state was sending {type: enabled, budget_tokens: 8192}
which caps the model's thinking to 8K tokens in a 1M context window.
Now uses adaptive thinking ({type: adaptive, display: summarized}) which
lets the model decide its own thinking depth with no budget limit.
Also fixes _build_messages_payload to include the required 'display' field
when thinking_type is 'adaptive' — the old code was sending incomplete
adaptive payloads missing the mandatory 'display' property.
The runtime swap in `_anthropic_provider_config_for_model` rebuilt an
`AnthropicProviderConfig` for models served via the Messages API (e.g.
minimax-m3, qwen3.7-max) but did not copy `provider.model_metadata` into
the new config. As a result, per-model `thinking_level_map` values such as
`{high = "adaptive"}` for minimax-m3 never reached the Anthropic adapter
and the wire payload fell back to budget-mode thinking
(`{type: enabled, budget_tokens: 8192}`) instead of `{type: adaptive}`.
This was the missing piece of the chain: the prior commit
`fix(anthropic): use adaptive thinking for toggle-only minimax-m3`
set the catalog map correctly, but the runtime swap then dropped it.
Add `model_metadata=provider.model_metadata` to the swapped config and
a unit test that pins the behavior for the opencode-go + minimax-m3 case.
`session-temp.jsonl` is a runtime scratch file written by the agent harness; it should not be tracked. Ignore it and remove the stale copy that was previously committed.
…-to-worst tiers Reorder the opencode-go provider's models list into two sections: opencode-go models first, free opencode-zen models second. Within each section families are alphabetical and ties within a family (e.g. Kimi 2.7 vs 2.6, Deepseek V4 Pro vs Flash, Qwen Max vs Plus) are ordered best to worst. Apply the same ordering to thinking_models.
jheronimus
force-pushed
the
opencode-go-support
branch
from
July 13, 2026 13:15
26867e6 to
c8f9da7
Compare
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.
Upd: needed to isolate the branch with this commit, hence had to reopen. The old PR is here.
This PR adds OpenCode Go as a provider along with all 13 models it currently offers.
The settings for each models are cross-referenced with Anomalyco's own model declarations.
Caveat: OpenCode Go serves different models through different API shapes. Because of that, the PR adds support for model-scoped provider overrides, like transport kind (Anthropic/OpenAI), thinking levels, defaults, display labels, API values, and always-on reasoning. The point is to keep the UI honest: we don't show thinking levels that can't actually be selected, or do something else entirely.
For example, Qwen models send Anthropic-style budgeted thinking and can explicitly disable reasoning, MiniMax M3 uses adaptive/disabled, while DeepSeek/GLM effort models expose only the supported high/max levels.
Always-reasoning models do not show a selector, and Tau sends no fake reasoning control for them.
I tried to keep the changes provider-agnostic, so they can be reused for other mixed-behavior catalogs. For example, DeepSeek R1 on OpenRouter.