Initial commit: homelab infrastructure wiki
- Full Obsidian vault content - Host configs (ice, grizzley, ubuntu, proxmox, truenas, panda, hyte) - Media stack documentation - Traefik HA setup - Automation scripts - Bachelor party planning
This commit is contained in:
135
homelab/raw/articles/opencode/docs/models.md
Normal file
135
homelab/raw/articles/opencode/docs/models.md
Normal file
@@ -0,0 +1,135 @@
|
||||
---
|
||||
type: agent-doc
|
||||
agent: OpenCode
|
||||
source: https://opencode.ai/docs/models/
|
||||
scraped: 2026-04-28T21:02:05.883345+00:00
|
||||
content_hash: 694788f0
|
||||
---
|
||||
# Models
|
||||
|
||||
Configuring an LLM provider and model.
|
||||
|
||||
OpenCode uses the AI SDK and Models.dev to support 75+ LLM providers and it supports running local models.
|
||||
|
||||
---
|
||||
|
||||
## Providers
|
||||
|
||||
Most popular providers are preloaded by default. If youâve added the credentials for a provider through the /connect command, theyâll be available when you start OpenCode.
|
||||
|
||||
Learn more about providers.
|
||||
|
||||
---
|
||||
|
||||
## Select a model
|
||||
|
||||
Once youâve configured your provider you can select the model you want by typing in:
|
||||
|
||||
```
|
||||
/models
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Recommended models
|
||||
|
||||
There are a lot of models out there, with new models coming out every week.
|
||||
|
||||
However, there are only a few of them that are good at both generating code and tool calling.
|
||||
|
||||
Here are several models that work well with OpenCode, in no particular order. (This is not an exhaustive list nor is it necessarily up to date):
|
||||
|
||||
- GPT 5.2
|
||||
- GPT 5.1 Codex
|
||||
- Claude Opus 4.5
|
||||
- Claude Sonnet 4.5
|
||||
- Minimax M2.1
|
||||
- Gemini 3 Pro
|
||||
|
||||
---
|
||||
|
||||
## Set a default
|
||||
|
||||
To set one of these as the default model, you can set the model key in your OpenCode config.
|
||||
|
||||
```
|
||||
{ "$schema": "https://opencode.ai/config.json", "model": "lmstudio/google/gemma-3n-e4b"}
|
||||
```
|
||||
|
||||
Here the full ID is provider_id/model_id. For example, if youâre using OpenCode Zen, you would use opencode/gpt-5.1-codex for GPT 5.1 Codex.
|
||||
|
||||
If youâve configured a custom provider, the provider_id is key from the provider part of your config, and the model_id is the key from provider.models.
|
||||
|
||||
---
|
||||
|
||||
## Configure models
|
||||
|
||||
You can globally configure a modelâs options through the config.
|
||||
|
||||
```
|
||||
{ "$schema": "https://opencode.ai/config.json", "provider": { "openai": { "models": { "gpt-5": { "options": { "reasoningEffort": "high", "textVerbosity": "low", "reasoningSummary": "auto", "include": ["reasoning.encrypted_content"], }, }, }, }, "anthropic": { "models": { "claude-sonnet-4-5-20250929": { "options": { "thinking": { "type": "enabled", "budgetTokens": 16000, }, }, }, }, }, },}
|
||||
```
|
||||
|
||||
Here weâre configuring global settings for two built-in models: gpt-5 when accessed via the openai provider, and claude-sonnet-4-20250514 when accessed via the anthropic provider. The built-in provider and model names can be found on Models.dev.
|
||||
|
||||
You can also configure these options for any agents that you are using. The agent config overrides any global options here. Learn more.
|
||||
|
||||
You can also define custom variants that extend built-in ones. Variants let you configure different settings for the same model without creating duplicate entries:
|
||||
|
||||
```
|
||||
{ "$schema": "https://opencode.ai/config.json", "provider": { "opencode": { "models": { "gpt-5": { "variants": { "high": { "reasoningEffort": "high", "textVerbosity": "low", "reasoningSummary": "auto", }, "low": { "reasoningEffort": "low", "textVerbosity": "low", "reasoningSummary": "auto", }, }, }, }, }, },}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Variants
|
||||
|
||||
Many models support multiple variants with different configurations. OpenCode ships with built-in default variants for popular providers.
|
||||
|
||||
### Built-in variants
|
||||
|
||||
OpenCode ships with default variants for many providers:
|
||||
|
||||
Anthropic:
|
||||
|
||||
- high - High thinking budget (default)
|
||||
- max - Maximum thinking budget
|
||||
|
||||
OpenAI:
|
||||
|
||||
Varies by model but roughly:
|
||||
|
||||
- none - No reasoning
|
||||
- minimal - Minimal reasoning effort
|
||||
- low - Low reasoning effort
|
||||
- medium - Medium reasoning effort
|
||||
- high - High reasoning effort
|
||||
- xhigh - Extra high reasoning effort
|
||||
|
||||
Google:
|
||||
|
||||
- low - Lower effort/token budget
|
||||
- high - Higher effort/token budget
|
||||
|
||||
### Custom variants
|
||||
|
||||
You can override existing variants or add your own:
|
||||
|
||||
```
|
||||
{ "$schema": "https://opencode.ai/config.json", "provider": { "openai": { "models": { "gpt-5": { "variants": { "thinking": { "reasoningEffort": "high", "textVerbosity": "low", }, "fast": { "disabled": true, }, }, }, }, }, },}
|
||||
```
|
||||
|
||||
### Cycle variants
|
||||
|
||||
Use the keybind variant_cycle to quickly switch between variants. Learn more.
|
||||
|
||||
---
|
||||
|
||||
## Loading models
|
||||
|
||||
When OpenCode starts up, it checks for models in the following priority order:
|
||||
|
||||
1. The --model or -m command line flag. The format is the same as in the config file: provider_id/model_id.
|
||||
2. The model list in the OpenCode config. opencode.json{ "$schema": "https://opencode.ai/config.json", "model": "anthropic/claude-sonnet-4-20250514"} The format here is provider/model.
|
||||
3. The last used model.
|
||||
4. The first model using an internal priority.
|
||||
Reference in New Issue
Block a user