Choosing the model in OpenCode: /models and the provider/model format

Coding with AIOpenCode·· 8 views· 3 min read

In OpenCode there are three ways to choose the model: /models while you work, the model line in the file for startup, and --model for a single run. They all use the same name: the provider, a slash and the catalogue id.

The provider/model format

The name has two parts. The first is the provider id you gave in the file (api in our examples). The second is the model id, exactly as it is in the catalogue. OpenCode cuts at the first slash, so the slash already in the model id is not a problem.

Provider in the file Model in the catalogue Name in OpenCode
api moonshotai/kimi-k2.7-code api/moonshotai/kimi-k2.7-code
api zai-org/glm-5.2 api/zai-org/glm-5.2

Use the id, not the name shown in the list (Kimi K2.7 Code). Capital letters count.

/models: changing while you work

Type /models in OpenCode and choose. The choice applies to the current session and does not change the file. In a new session, OpenCode goes back to the model in the file.

The list only shows the models in the models block. If one is missing, add it: see adding more models to OpenCode.

model: the model at startup

"model": "api/moonshotai/kimi-k2.7-code"

The line goes at the top level of the file, outside "provider". With it, OpenCode starts with the model you chose, as long as the provider is set up. Without it, OpenCode picks the newest model it has available, which may be from another provider. If the line is in both the global and the project file, the project one counts.

--model: a single run

opencode run --model api/zai-org/glm-5.2 "Explain what this project does"

opencode run sends a request without opening the interface. --model changes the model for that run only; the file stays the same.

Which model to choose

For coding, use a text model that supports tools:

Model Context What for
moonshotai/kimi-k2.7-code 262,144 tokens Built for coding: the starting point for everyday work.
deepseek-ai/deepseek-v4-pro 1,048,576 tokens Strong reasoning, for big changes and hard bugs.
zai-org/glm-5.2 1,048,576 tokens Made for agents: handles tools well in long tasks.
deepseek-ai/deepseek-v4-flash 1,048,576 tokens Fast and cheap, for background tasks and short questions.

The price of each model is in the Models tab of All in One AI. With a Coding Plan, the Plan tab shows the models that spend points: see OpenCode and the Coding Plan.

Want to pick between our models in OpenCode? Visit the Coding with AI page.

See Coding with AI

SEE ALSO

Adding more models to OpenCode: the models block and the id with the slash

OpenCode with All in One AI: creating opencode.json from scratch, the key and the models

OpenCode and the Coding Plan: points, credits and what is left

Coding with AI in All in One AI

RECOMMENDED PRODUCT

Web hosting with cPanel

Domain and SSL included, daily backups and the panel you already know. from 396,00 MT/mo (3-year plan, with coupon)

See plans
Was this answer helpful? Your answer helps us improve this article.