Cheaper subagents
Keep Claude Opus for the conversation and send subagents to DeepSeek V4.1 Flash. You need an OpenCode key.
Do this for me on this machine: send my subagents to DeepSeek V4.1 Flash through OpenCode while Opus keeps the main loop. This is superclaude's own guide. Read all of it as raw Markdown first, without summarizing it: curl -fsSL "https://superclaude.io/docs/custom-profiles.md" Then: 1. Tell me in a few lines what you are going to change. 2. Do every step yourself: run the commands, edit the files, check each result. 3. Stop only for what needs me: a browser sign-in, a choice between options, a secret to paste. 4. Finish by showing it works, and tell me the one command I will use from now on. Other superclaude pages, if you need them: https://superclaude.io/llms.txt
-
Save your OpenCode key
printf '%s\n' '<your-opencode-key>' > ~/.opencode-go chmod 600 ~/.opencode-goThe background gateway reads this file on every request, so a new key takes effect without restarting anything.
-
Add the profile
A profile maps each Claude role to a model. This one keeps
opuson your Claude Code login, so sign in to Claude Code first, and sendssonnetandhaikuto OpenCode. Ifsc profiles claude-flashalready lists it (the configscwrites on first run has it), skip to step 3. Otherwise open~/.superclaude/config.tomland add the table:sc edit config[profiles.claude-flash] opus = { slug = "anthropic/opus" } sonnet = { slug = "opencode/deepseek-v4.1-flash", reasoning = { effort = "high" } } haiku = { slug = "opencode/deepseek-v4.1-flash", reasoning = { effort = "low" } }The profile names two endpoints (the URL, format and key for Anthropic and OpenCode). Both must exist in the same file.
-
Check the routing
sc profiles claude-flashPROFILE ROLE MODEL EFFORT SAMPLING ──────────────────────────────────────────────────────────────────── claude-flash opus anthropic/opus sonnet opencode/deepseek-v4.1-flash high haiku opencode/deepseek-v4.1-flash low -
Launch with it
sc -u claude-flash <project> <agent>scchecks the profile before Claude Code opens, then prints:sc: profile `claude-flash` → hybrid per-role routing (passthrough roles first-party to api.anthropic.com; gateway roles via the daemon gateway)
- The status line shows an Opus model. If it shows Sonnet, the main loop is on DeepSeek: run
/model opus, or launch with-m opus. - After the first subagent or background request reaches DeepSeek, the status line adds a
gw:claude-flashchip. From the third gateway turn on, it also shows the prompt-cache hit rate, marked!below 60%.
My config has no opencode endpoint
Make sure config.toml has both endpoint tables:
[endpoints.anthropic]
url = "https://api.anthropic.com"
format = "anthropic-messages"
auth = "passthrough"
[endpoints.opencode]
url = "https://opencode.ai/zen/go"
format = "openai-compat"
auth = "bearer"
key_file = "~/.opencode-go"The config.toml that sc writes on first run already has the opencode table. Edit it to match rather than adding a second one. passthrough sends a role to Anthropic unchanged on your own login, with no key stored (details).
Make it my default profile
Set default_profile = "claude-flash" at the top of config.toml, and a bare sc uses it. sc -u direct then returns to plain Claude Code for one launch.
Recommended profile walkthrough
Why the rows are written the way they are:
| Value | Why |
|---|---|
anthropic/opus | Keeps the main loop on Claude. Anthropic receives Claude Code’s own model id, so opus here is only a label. |
deepseek-v4.1-flash | OpenCode’s id for DeepSeek V4.1 Flash: a reasoning model with tool calling and a 1M-token context. |
effort = "high" on sonnet | DeepSeek’s own default level. It applies only to a request that names no level; Claude Code sends its own level on most requests, and that wins. |
effort = "low" on haiku | Light thinking for Claude Code’s background requests, such as session titles, which name no level. |
no temperature or params | Both rows think, and DeepSeek ignores temperature while thinking. |
The gateway reads the role from the model name on each request. Claude Code sends its own model ids, so in this profile:
| Request | Answered by |
|---|---|
| The main loop, on Opus | Claude Opus, on your login |
| A subagent that inherits the main loop’s model, or asks for Opus | Claude Opus |
| A subagent that asks for Sonnet | DeepSeek V4.1 Flash |
| A subagent that asks for Haiku, and Claude Code’s background requests | DeepSeek V4.1 Flash |
| A Fable request | Claude, on your login, because the profile maps no fable row |
-m sonnet or /model sonnet | the main loop moves to DeepSeek |
A subagent definition’s model field decides where it runs. One with model: haiku goes to DeepSeek; one that inherits stays on Opus.
sc adds no permission flag to this launch. The main loop is Claude, so Claude Code’s permission checks work as in a plain session.
Cost: main-loop turns use your Claude plan as in plain Claude Code. sonnet and haiku requests never reach Anthropic; they draw on your OpenCode plan. The status line shows a dollar figure only for an endpoint with a rates table (gateway reference). sc usage lists the opencode endpoint as usage not queryable via API key — see opencode.ai console, because OpenCode’s spend is on its console, not in sc.
Check a profile before launching
sc profiles <name>
sc profiles -v <name>
sc profiles --role opusThe listing prints one row per configured role with its model, effort and sampling. A role reached by inheritance shows ↑ next to its name. A row that says unresolved: names what is wrong: a missing endpoint or a slug without a /. A role the profile does not map, such as an unwritten fable, gets no row. -v adds each row’s wire format, auth and the exact thinking fields it sends by default, and every endpoint with masked keys. --role shows one tier across every profile.
On any profile other than direct, sc starts the daemon and waits until the profile is ready, so a missing key or an unreachable endpoint fails before Claude Code starts (what the check covers). For a check of any profile without an interactive session, add a print-mode prompt:
sc -u <name> <project> <agent> -p "Reply with the single word ok."To test the DeepSeek leg on its own, put the main loop on the sonnet row for one print-mode prompt:
sc -u claude-flash <project> <agent> -m sonnet -p "Reply with the single word ok."Edits to config.toml apply on the next request. A key read from a ${VAR} is the exception: the daemon expands it in its own environment (details).
My launch or a subagent fails
| Message or symptom | Fix |
|---|---|
reading endpoint key_file | ~/.opencode-go does not exist. Repeat step 1. |
has no keys | The key file is empty. |
unreachable | The daemon cannot connect to https://opencode.ai. |
A subagent fails with 401 | The key is wrong or revoked. OpenCode’s model list is public, so the launch check cannot reject a bad key; the first DeepSeek request does. |
-i/--incognito is not supported with the hybrid per-role routing profile | Incognito refuses hybrid profiles. Drop -i. |
config.toml fails to parse | Look for a second [endpoints.opencode] or [endpoints.anthropic] table. |
no profile <name> — available: ... | The name after -u matches no [profiles.<name>] table. |
profile <name> defines no fable role | A full-gateway profile got a Fable request. Add fable = { slug = "<endpoint>/<model-id>" }, or switch Claude Code off Fable. |
slug <slug> is not <endpoint>/<model-id> | The slug has no /. Prefix it with an endpoint name. |
targets endpoint <name>, which has no [endpoints.<name>] | Define the endpoint, or fix the prefix. |
has auth=oauth but no signed-in identities | Run sc auth <endpoint>. |
A request returns 400 | Check params for a field the model rejects, and the row’s format against what the endpoint speaks. |
Write your own profile
A profile is a [profiles.<name>] table in config.toml. Each role is one inline table with a required slug:
[profiles.my-profile]
opus = { slug = "<endpoint>/<model-id>" }
sonnet = { slug = "<endpoint>/<model-id>" }
haiku = { slug = "<endpoint>/<model-id>" }| Field | What it does |
|---|---|
slug | <endpoint>/<model-id>. Required. Split at the first /, so openrouter/deepseek/<model> is endpoint openrouter, model deepseek/<model>. |
format, auth | Override the endpoint’s wire format or auth for this one model. |
reasoning | { effort = "<level>" }: off, low, medium, high or max. A default for requests that name no level. |
temperature | Sent on every request for this role. |
params | Extra request fields such as top_p or top_k, sent on every request as written. |
Pick endpoints from the support matrix.
Roles and inheritance#
| Role | Required | If you leave it out |
|---|---|---|
opus | yes | The profile does not resolve, and sonnet and haiku have nothing to inherit. |
sonnet | no | It uses the opus row. |
haiku | no | It uses the sonnet row, or opus if that is missing too. |
fable | no | Full gateway: a Fable request fails with an error naming the row to add. Hybrid: a Fable request stays on Anthropic with your login. |
fable, the tier above Opus, never inherits, so a Fable request is not quietly answered by a model you picked for another tier. The launch check skips a role the profile does not map.
On a full gateway, sc sets Claude Code’s per-tier model variables to labels shaped <profile> · <model-id> · <role>, and the gateway classifies each request’s model name by substring: haiku first, then fable or mythos, then opus, and anything else is sonnet. That is why the warning above exists. In a hybrid, Claude Code sends its own claude-* model ids, which classify cleanly.
Reasoning effort#
The effort is a default, not an override. Claude Code sends its own level on most requests, and a subagent’s level can differ from its parent’s. The gateway uses the request’s level when there is one, and the row’s level only when the request names none. A request asking for low gets low even where the row says max.
Model families share no common reasoning parameter, so the gateway picks the field from the model id:
| Model id contains | What the gateway sends |
|---|---|
deepseek | thinking on or off, plus reasoning_effort: max for max and for xhigh, low for low (sc 0.2.2 and later; earlier sends high), high for medium and high. A request that disables thinking turns it off. |
glm, mimo | thinking on or off; no levels |
minimax | thinking on or off, plus reasoning_split when on, so the reasoning streams separately |
kimi | thinking on or off, keeping earlier reasoning across tool calls |
qwen | enable_thinking, plus a thinking_budget from 2,048 to 32,768 tokens by level |
anything else, on openai-compat | nothing, because a wrong field returns a 400 |
anything, on openai-responses | reasoning.effort (details) |
On anthropic-messages, MiniMax and Qwen models get their own field. For any other model the request’s own thinking settings pass through untouched, and only a row’s reasoning rewrites them (Anthropic and Claude explains why that matters for Claude).
The schema also accepts reasoning = { budget_tokens = <n> }, but it is not wired through. A row that sets budget_tokens without effort prints a note at launch saying it is ignored.
Sampling#
temperature is a field of its own. Everything else goes in params, which sc copies into the request as written:
[profiles.tuned]
opus = { slug = "opencode/deepseek-v4-pro", temperature = 0.7, params = { top_p = 0.95, top_k = 40 } }Unlike effort, sampling is dictated: the row’s temperature and params go on every request for that role and replace what Claude Code sent. params is applied last, so its keys win over anything set before them.
- A sampling key placed directly on the row, such as
top_p = 0.9, is ignored. Onlytemperatureis a row field. - The Codex service rejects sampling fields. On an endpoint whose OAuth provider is
codex, the gateway removestemperatureandtop_pbefore sending, even if the row sets them. paramskeys are not checked against the model. An endpoint’son_unsupported_paramkey is parsed but not enforced yet, so a field the model rejects reaches it and fails there.
Sampling matters on a row with thinking off. This variant keeps Sonnet on Claude and sends only Haiku traffic to DeepSeek:
[profiles.claude-flash-quiet]
opus = { slug = "anthropic/opus" }
haiku = { slug = "opencode/deepseek-v4.1-flash", reasoning = { effort = "off" }, temperature = 1.0 }1.0 is DeepSeek’s recommended temperature for V4.1 Flash, and DeepSeek applies it only while thinking is off. DeepSeek applies top_p only while thinking is on, from 0.95 to 1.0. effort = "off" is a default: a Haiku request that names a level still thinks, and then temperature has no effect.
Worked examples#
Each example assumes its endpoints exist in the same file.
One model for every role, the shipped fast profile. Writing only opus would give the same result through inheritance:
[profiles.fast]
opus = { slug = "opencode/deepseek-v4-flash" }
sonnet = { slug = "opencode/deepseek-v4-flash" }
haiku = { slug = "opencode/deepseek-v4-flash" }Tiered by role, with a per-model wire override, is the research profile on Any OpenAI-compatible API. Two subscriptions in one profile is on Grok. A hybrid that keeps Claude on the main loop is the steps at the top of this page, and one that moves only Haiku traffic is the variant under Sampling.