Models
opencode_modelList available models, read the default, and assign models per session, project, global config, or agent. Session assignment switches the API immediately; config edits preserve JSONC comments.
Instructions
List models, read the default, and assign models at four levels: session (immediate API switch), project (opencode.json in the workspace), global (~/.config/opencode/opencode.json), agent (agents..model). Session assignment wins for that conversation; project/global change the default for new sessions. Config edits preserve JSONC comments and are verified against model/default.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"action": "<action>"
},
"name": "opencode_model"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| type | No | Filter for action=list | |
| agent | No | Agent id for scope=agent | |
| model | No | Required for action=set | |
| scope | No | Default: session when sessionID is given, otherwise project | |
| action | Yes | ||
| directory | No | ||
| sessionID | No | For scope=session |