Problem
Hermes Agent (and likely other ACP clients) cannot select a specific model per session when using OpenCode via ACP. Each opencode acp process spawns a new session, but the model is always read from opencode.json at startup. There is no way for the ACP client to tell OpenCode which model to use for a given session.
The OpenCode TUI supports model switching via the /model command, but this is only accessible interactively.
What We Tried
--model flag on opencode acp: Not supported. The ACP command only accepts --print-logs.
OPENCODE_MODEL env var: Not respected. OpenCode reads from opencode.json exclusively.
- Text hint in prompt: Hermes includes
"Hermes requested model hint: openai/gpt-5.5" in the prompt text, but this is just text -- OpenCode ignores it and uses the config file model.
session/set_config with configId: "model": Returns "Method not found" in v1.15.13.
- Config file swap before spawn: Works but is racy for parallel sessions and fragile (requires write access, file locking, cleanup on crash).
Proposed Solution
The ACP session lifecycle should support model selection. The source code shows partial implementation (setModel/getModel on ACPSessionManager, PR #3358), but the session/set_config method is not yet exposed in the released ACP protocol.
Option A: session/new with model parameter
{
"method": "session/new",
"params": {
"cwd": "/project",
"mcpServers": [],
"model": "openai/gpt-5.5"
}
}
Cleanest approach -- client specifies the model at session creation time, no extra round-trip needed.
Option B: session/set_config after session/new
{
"method": "session/set_config",
"params": {
"sessionId": "ses_...",
"configId": "model",
"value": "openai/gpt-5.5"
}
}
Matches the existing configId/value pattern already used in the TUI.
Option C: CLI argument
opencode acp --model openai/gpt-5.5
Simplest for CLI users but less flexible than protocol-level support.
Use Case
Hermes Agent runs model routing: complex tasks go to GPT-5.5, medium tasks to GLM-5-turbo, simple tasks to MiniMax-M2.7. Each delegate_task spawns a fresh opencode acp process. Without per-session model selection, all tasks use whatever model is in opencode.json.
Currently working around this by temporarily swapping opencode.json before each spawn, which is fragile and not parallel-safe.
Environment
- OpenCode: 1.15.13
- OS: Windows 10 (Git Bash)
- ACP client: Hermes Agent (Python)
Problem
Hermes Agent (and likely other ACP clients) cannot select a specific model per session when using OpenCode via ACP. Each
opencode acpprocess spawns a new session, but the model is always read fromopencode.jsonat startup. There is no way for the ACP client to tell OpenCode which model to use for a given session.The OpenCode TUI supports model switching via the
/modelcommand, but this is only accessible interactively.What We Tried
--modelflag onopencode acp: Not supported. The ACP command only accepts--print-logs.OPENCODE_MODELenv var: Not respected. OpenCode reads fromopencode.jsonexclusively."Hermes requested model hint: openai/gpt-5.5"in the prompt text, but this is just text -- OpenCode ignores it and uses the config file model.session/set_configwithconfigId: "model": Returns"Method not found"in v1.15.13.Proposed Solution
The ACP session lifecycle should support model selection. The source code shows partial implementation (
setModel/getModelonACPSessionManager, PR #3358), but thesession/set_configmethod is not yet exposed in the released ACP protocol.Option A:
session/newwith model parameter{ "method": "session/new", "params": { "cwd": "/project", "mcpServers": [], "model": "openai/gpt-5.5" } }Cleanest approach -- client specifies the model at session creation time, no extra round-trip needed.
Option B:
session/set_configaftersession/new{ "method": "session/set_config", "params": { "sessionId": "ses_...", "configId": "model", "value": "openai/gpt-5.5" } }Matches the existing
configId/valuepattern already used in the TUI.Option C: CLI argument
Simplest for CLI users but less flexible than protocol-level support.
Use Case
Hermes Agent runs model routing: complex tasks go to GPT-5.5, medium tasks to GLM-5-turbo, simple tasks to MiniMax-M2.7. Each
delegate_taskspawns a freshopencode acpprocess. Without per-session model selection, all tasks use whatever model is inopencode.json.Currently working around this by temporarily swapping
opencode.jsonbefore each spawn, which is fragile and not parallel-safe.Environment