Cheaper subagents

Keep Claude Opus for the conversation and send subagents to DeepSeek V4.1 Flash. You need an OpenCode key.

  1. Save your OpenCode key

    printf '%s\n' '<your-opencode-key>' > ~/.opencode-go
    chmod 600 ~/.opencode-go

    The background gateway reads this file on every request, so a new key takes effect without restarting anything.

  2. Add the profile

    A profile maps each Claude role to a model. This one keeps opus on your Claude Code login, so sign in to Claude Code first, and sends sonnet and haiku to OpenCode. If sc profiles claude-flash already lists it (the config sc writes on first run has it), skip to step 3. Otherwise open ~/.superclaude/config.toml and 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.

  3. Check the routing

    sc profiles claude-flash
      PROFILE       ROLE    MODEL                         EFFORT  SAMPLING
      ────────────────────────────────────────────────────────────────────
      claude-flash  opus    anthropic/opus
                    sonnet  opencode/deepseek-v4.1-flash  high
                    haiku   opencode/deepseek-v4.1-flash  low
  4. Launch with it

    sc -u claude-flash <project> <agent>

    sc checks 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-flash chip. 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.

Check a profile before launching
sc profiles <name>
sc profiles -v <name>
sc profiles --role opus

The 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 symptomFix
reading endpoint key_file~/.opencode-go does not exist. Repeat step 1.
has no keysThe key file is empty.
unreachableThe daemon cannot connect to https://opencode.ai.
A subagent fails with 401The 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 profileIncognito refuses hybrid profiles. Drop -i.
config.toml fails to parseLook 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 roleA 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 identitiesRun sc auth <endpoint>.
A request returns 400Check 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>" }
FieldWhat it does
slug<endpoint>/<model-id>. Required. Split at the first /, so openrouter/deepseek/<model> is endpoint openrouter, model deepseek/<model>.
format, authOverride 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.
temperatureSent on every request for this role.
paramsExtra request fields such as top_p or top_k, sent on every request as written.

Pick endpoints from the support matrix.

Roles and inheritance#

RoleRequiredIf you leave it out
opusyesThe profile does not resolve, and sonnet and haiku have nothing to inherit.
sonnetnoIt uses the opus row.
haikunoIt uses the sonnet row, or opus if that is missing too.
fablenoFull 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 containsWhat the gateway sends
deepseekthinking 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, mimothinking on or off; no levels
minimaxthinking on or off, plus reasoning_split when on, so the reasoning streams separately
kimithinking on or off, keeping earlier reasoning across tool calls
qwenenable_thinking, plus a thinking_budget from 2,048 to 32,768 tokens by level
anything else, on openai-compatnothing, because a wrong field returns a 400
anything, on openai-responsesreasoning.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. Only temperature is a row field.
  • The Codex service rejects sampling fields. On an endpoint whose OAuth provider is codex, the gateway removes temperature and top_p before sending, even if the row sets them.
  • params keys are not checked against the model. An endpoint’s on_unsupported_param key 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.

Next: Codex (ChatGPT subscription)

View as Markdown