Repository navigation
v0.2.0 — Resilient model selection & new Providers API
Highlights
- Resilient model selection by default.
OpenCode.Configure().Launch()now auto-picks a free-tier model from the opencode provider at launch time, so your code no longer breaks when upstream renames or versions a model. - Capability-based model selection. Pick models by predicate (
WithModel(selector)) or by free tier (WithAnyFreeModel(provider)) instead of hardcoding a stringly-typed model id. - New
Providersconstants class with 20 well-known upstream provider ids (Providers.OpenCode,Providers.Anthropic,Providers.OpenAI, ...), giving you IntelliSense and compile-time typo protection.
Breaking Changes for users upgrading from 0.1.x
WithModel(string) is now [Obsolete]
.WithModel("opencode/deepseek-v4-flash-free") // CS0618 warningThe overload is kept for backward compatibility but emits a compile-time warning. Migration: drop the call entirely (the new default is already resilient), or switch to a capability-based overload:
.Launch() // uses the default free-model selection
// or
.WithAnyFreeModel() // explicit free-tier, default provider
.WithAnyFreeModel(Providers.Anthropic) // explicit free-tier, custom provider
.WithModel(m => m.Id.EndsWith("-free")) // custom predicateDefault model at Launch() changed
If you previously called OpenCode.Configure().Launch() without specifying a model, the opencode server's default was used. As of 0.2.0 the SDK auto-picks the first free-tier model from the opencode provider. To restore the previous behaviour, pin a model explicitly with WithModel(...).
New Features
WithModel(Func<ModelInfo, bool> selector, string provider = Providers.OpenCode)— pick the first model from a provider that matches a caller-supplied predicate. Resolution happens atLaunch()time viaOpenCodeClient.Models.List().WithAnyFreeModel(string provider = Providers.OpenCode)— convenience that resolves to the first model whose id ends with-free. Use it when you want to switch the free-model default to a non-opencode provider.Providersconstants class —OpenCode,Anthropic,OpenAI,GitHubCopilot,GoogleVertex,AmazonBedrock,Azure,DeepSeek,Groq,OpenRouter,Ollama,LMStudio,Cerebras,Minimax,MoonshotAI,NVIDIA,HuggingFace,Helicone,VercelGateway,XAI. For providers not listed, pass the raw id as a string — the server is the source of truth and you can discover all currently connected providers viaOpenCodeClient.Providers.List().
Bug Fixes
- CI:
dotnet testinci.ymlis now scoped to the unit-test project, so PR builds no longer fail on opencode-dependent integration tests. Integration tests run on a daily schedule and viaworkflow_dispatch. - Integration tests: opencode server is now started in the same step as the test run, so it survives the GitHub Actions step boundary that was killing it mid-test.
Models.List: removed a no-op ternary (provider != null ? "/config/providers" : "/config/providers") with identical branches and a meaningless$interpolation.- Release workflow:
gh release createnow hascontents: writeso the GitHub release step no longer 403s.
Tooling & CI
- New scheduled integration tests (daily) for NuGet package + free-model availability — surfaces upstream model churn before users do.
- Added Dependabot, CodeQL,
.editorconfig,.gitattributes.
Documentation
- READMEs (EN + ZH) updated to drop hardcoded model ids and use
Providers.OpenCode. - Fixed a pre-existing duplicate
### 多轮对话section inREADME.zh.md.
Full diff: v0.1.3...v0.2.0