cli providers take a model: provider prefix, {model}, -m occli/MODEL

A kind = cli provider now has a default model and a prefix
(provider = opencode), so -m occli/deepseek-v4.1-flash-free runs
"opencode run --model opencode/deepseek-v4.1-flash-free". {model} in cmd
marks where the model goes, otherwise --model is appended; a model that
already has a '/' is used as it is. sp_cli_command() builds the command for
-m, delegates and the cli plugin's pool fallback. Model names are limited to
letters, digits and ._:/@+- since the command goes through /bin/sh.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
lotherkandClaude Opus 5.5 committed 2026-11-13 20:08:16 +00:00
1 parent 05c8d936e7
commit 2c58dcfd2a
8 files changed
+125 -12

No files matched your search

+19
View File
@@ -71,6 +71,25 @@ pool claude { members = [claude-a, claude-b, anthropic-a] strategy = balance }
| `anthropic` | `https://api.anthropic.com/v1` (POSTs to `/messages`) | `sk-ant-oat...` as a Bearer token with the oauth beta (a Claude Code token); `sk-ant-api...` as `x-api-key` |
| `cli` | none; a program (`cmd`) | its own, from `env { }` |
A `cli` provider can take its model from `-m` like any other:
```
provider occli {
kind = cli
cmd = "opencode run" # {model} marks where the model goes
provider = opencode # prefix for a bare model name
model = big-pickle # the default
}
```
`-m occli` runs `opencode run --model opencode/big-pickle`,
`-m occli/deepseek-v4.1-flash-free` runs `... --model
opencode/deepseek-v4.1-flash-free`, and a model that already has a `/`
(`-m occli/opencode-go/kimi-k2`) is passed as it is. Without `{model}` in
`cmd` the model is appended as `--model`; without any model the command runs
unchanged. A model name may hold only letters, digits and `._:/@+-`, since the
command goes through `/bin/sh`.
A `kind = anthropic` provider is called directly, without the `claude` CLI:
tools become `tool_use` blocks, their observations `tool_result` blocks, and
the system prompt is sent as the top-level `system` field. One provider per