TALOS

Workflows / 02 Delegate

claude_x

Cheaper models as native Claude Code subagents.

claude_x is a drop-in launcher for Claude Code. It registers workers that run on a third-party model, DeepSeek today, as ordinary subagents. They appear in the agent panel, use Claude Code's own tools, permissions and hooks, and can be steered mid-run like any other subagent. The main agent stays on Claude.

  • v0.1
  • private preview
Claude Code, unmodified
The official CLI, started with its own flags.
Main agent on Claude
Only the work you delegate goes to the cheaper model.
Standard library only
One small Python package, nothing hosted.
Nothing left behind
No files in ~/.claude. Run plain claude to stop.

How it works

claude_x starts a small gateway on your machine, then launches the official Claude Code pointed at it. Every model request passes through the gateway, which routes it by model name. Below is one delegation, end to end.

One delegation: the main agent hands a task to a worker; the gateway sends each request to the right provider.
Claude Code · official, unmodified
Main agentClaude · plans and reviews
ds-flash · ds-proworkers, registered as native subagents
ToolsRead · Edit · Bash · Grep run here, on your machine
model requestsstreamed replies
Gateway127.0.0.1 · per-session tokenroutes on the request's model name · logs worker cost
claude-*byte for byte
Anthropicmain agent, your own plan or key
worker modelidentifiers removed, checked
Third-party providerany Anthropic-compatible endpoint · DeepSeek today
  1. You talk to the main agent as usual. Its model calls pass through the gateway to Anthropic byte for byte, on your own plan or key.

  2. The main agent hands a well-specified task to ds-flash. Workers are registered for this session through Claude Code's own agent definitions, so they appear in the agent panel like any subagent.

  3. The worker's request names a non-Claude model. The gateway sees that name and takes the third-party lane. Claude model names can never be rerouted.

  4. Account identifiers, billing tags and the memory index are removed, and a final scan refuses the request if any survive. Then it goes out with the provider's own key.

  5. The reply streams back. The worker model only chooses the next tool call; Claude Code runs Read, Edit and Bash on your machine, under your permission rules.

  6. The worker reports back and the main agent reviews the result before relying on it. The gateway logs the worker's tokens and cost at the provider's real prices.

What it does

Native subagents
Workers come in through Claude Code's own agent definitions, not an MCP server, so permissions, hooks, the agent panel and steering mid-run all work as usual.
Private by default
Only a short list of headers is forwarded to the third party. Account identifiers and the memory index are removed, and a final scan refuses any request where one survives.
Workers stay workers
Workers cannot start subagents of their own, so a delegated task cannot fan out into more Claude work. Provider errors come back clearly marked and fail fast instead of retrying.
Real costs
Each worker request is written to a local ledger with its tokens and cost at the provider's prices, including cache reads and peak hours.

Use it

Use it like claude
claude_x             # same flags as claude, plus the workers> @ds-flash add type hints in src/utils and run the tests claude_x --x-usage   # what the workers cost today and this weekclaude               # plain claude, nothing left behind

Guarantees

  • The gateway listens on 127.0.0.1 only and answers only requests that carry this session's random token.
  • Claude model names cannot be rerouted. They always go to Anthropic, unchanged.
  • The provider key is read per request, never written by claude_x, and sent only to its own provider.
  • A worker request in which any account identifier survives is refused and never sent.
  • Tools run on your machine, under Claude Code's own permission rules.
  • Nothing is installed into ~/.claude, and plain claude is untouched.

Limits and next

Limits today
Only Anthropic-compatible endpoints, and DeepSeek is the only provider tested. Claude Code's own cost display prices workers as a Claude model; claude_x --x-usage shows the real spend. Workers are reachable from the main session only.
Next
More providers behind the same gateway.