/connect in the TUI, or configure it in Providers.
Choose a model
Open the model picker with/models or the default <leader>m keybind. The picker shows the models available from
providers connected to the current project.
Select a model to use it in the current session. Switching models updates that session without changing your config. Use
the catalog entries shown in the picker rather than guessing a provider or model name.
Per-run model
Select a model for one non-interactive run with--model or -m:
Variants
Variants are named request overlays for one model, commonly used for reasoning effort or token budgets. Available names are model-specific and are derived from current catalog metadata. Do not assume that names such aslow, high, or
max exist for every model; /variants shows the valid choices.
Use /variants to choose one for the current model, or press ctrl+t to cycle through available variants.
Configure
Default model
Setmodel in opencode.json or opencode.jsonc:
opencode.jsonc
Model settings
Provider and model entries can supply three kinds of request configuration:settingscontains provider-package options such asbaseURL,reasoningEffort, orthinkingConfig.headersadds HTTP request headers.bodyadds provider-specific fields to the request body.
settings and body objects are merged; later array and scalar values replace earlier values. Header
names are matched case-insensitively.
You can also map a friendly catalog ID to a different API model ID with modelID:
opencode.jsonc
openai/coding-default is the selectable catalog reference, while gpt-5.2 is sent to the provider. When adding a
model that is not already in the catalog, set accurate capabilities and limit values so OpenCode can expose tools and
enforce the correct context limits. Set disabled: true on a model entry to hide it from the available catalog.
Custom variants
Add a variant, or override a catalog variant with the same ID, under the model’svariants array:
opencode.jsonc
settings, headers, and body. Selecting one deeply overlays its values on the effective
provider and model configuration. An unknown variant fails model resolution instead of silently using the base model.
Local models
For an OpenAI-compatible server, define a provider package, endpoint, and at least one model:opencode.jsonc
apiKey to provider settings using an environment substitution such as
"apiKey": "{env:LOCAL_API_KEY}"; do not commit secrets.
Model references
Configuration and CLI options identify a model asprovider/model, with an optional #variant:
/, so model IDs may contain additional slashes. Provider and model IDs are
case-sensitive. Provider IDs cannot contain / or #, and model IDs cannot contain #.
The expanded config form is equivalent when generated or programmatic configuration is more convenient:
model fields accept both forms. Use the IDs shown by /models, not provider display names.
Caveats
- The selector object uses
model, while a provider catalog entry usesmodelIDfor the upstream API identifier. - The root
modelcurrently sets the default provider and model only. Although its selection shape accepts a variant, the V2 catalog default does not retain it; select a variant in the TUI, withopencode2 run, or on an agent or command. - Model options are provider-specific. A setting accepted by one provider package may be ignored or rejected by another.
- Catalog data, credentials, and config are location-scoped. A model available in one project may be unavailable in another.
- Configuration files are watched and normally reload automatically, but an in-flight model request keeps the settings with which it started.