> models & providers
opencode is model-agnostic: through the AI SDK and Models.dev it reaches 75+ providers, and you pick which one runs. Models are always addressed as provider/model (anthropic/claude-sonnet-4-5). Switch live with /models, set a default in config, name a cheaper small_model for background chores, or route everything through opencode Zen, opencode's own hosted gateway.
// models & providers
4 commands// faq
How do I choose which model opencode uses?
Set "model": "provider/model" in opencode.json for the default, press /models (Ctrl+X M) to switch during a session, or pass -m on the command line for a one-off. On startup the order is: -m flag, then config, then your last-used model. The provider prefix is mandatory.
Which providers does opencode support?
More than 75, via the AI SDK and the Models.dev catalog — Anthropic, OpenAI, Google, OpenRouter, Amazon Bedrock, Google Vertex, GitHub Copilot, local runtimes like Ollama and LM Studio, and any OpenAI-compatible endpoint you configure. Run opencode auth login to see and connect them, and opencode models to list what is available.
What is opencode Zen?
opencode Zen is opencode's own managed model gateway: a curated set of models benchmarked for coding, billed pay-as-you-go, so you do not have to hold keys for each provider. Connect it with /connect in the TUI; its models use the opencode/ prefix. It is optional — bringing your own provider key works just as well.
What does small_model do?
small_model sets a cheaper, faster model for opencode's internal chores — generating session titles, summaries, and compaction — while your main model does the real work. Pointing it at something like anthropic/claude-haiku-4-5 trims cost and latency on those background calls without changing the answers you see.