TejasLamba2006

Cc Subagent Models — AI skill for Claude Code

AI community

Patch Claude Code's Agent tool to use any gateway model (9Router, LiteLLM, OpenRouter) per subagent call.

How to install Cc Subagent Models

This entry records only its repository, not the path inside it, so there is no exact command to give. Open TejasLamba2006/cc-subagent-models and copy the folder into ~/.claude/skills/, or the file into ~/.claude/agents/.

What Cc Subagent Models does

Patch Claude Code's Agent tool to use any gateway model (9Router, LiteLLM, OpenRouter) per subagent call.

Alternatives in AI

  • Zen MCP Server — The power of Claude Code + Gemini / OpenAI / Grok / OpenRouter / Ollama / Custom Model working as one 11.3k ★
  • Open Multi Agent — TypeScript multi-agent orchestration engine — one runTeam() call from goal to result 5.8k ★
  • Axonhub — ⚡️ Open-source AI Gateway — Use any SDK to call 100+ LLMs 3.2k ★

README

cc-subagent-models

If you run Claude Code through a gateway like 9Router, LiteLLM, or OpenRouter, you already have access to dozens of models. The problem is that Claude Code's built-in `Agent` tool won't let you use them for subagents.

Inside Claude Code, the `model` field on the `Agent` tool is locked to a hardcoded Zod enum (`["sonnet", "opus", "haiku"]` or `["sonnet", "opus", "haiku", "fable"]`). Even if you bypass the schema, the internal model resolver checks the string against an allowlist and drops unknown model IDs right back to the parent session model.

`cc-subagent-models` patches Claude Code once so the lead model can pick any model on your gateway per subagent call. You can send file searches to a fast free Qwen model, unit tests to GLM, and hard debugging to DeepSeek Reasoner without changing your main session model.

npx cc-subagent-models sync --gateway http://localhost:20128/v1/models
npx cc-subagent-models patch --mode free

How it works

Instead of baking a static model list into `cli.js`, the patcher injects a small runtime helper (`globalThis.__ccSubagentModelSchema`) and rewrites the subagent model resolver to pass non-Anthropic model strings straight through to `req.body.model`.

Every time you start `claude`, that helper reads `~/.claude/subagent-models.json` on the fly. When you add a provider in 9Router or edit your routing hints, you do not need to re-patch Claude Code. The next session picks up the new list automatically.

It works on both installation formats:

  1. Standard npm cli.js bundles (@anthropic-ai/claude-code).
  2. Bun-compiled native binaries (~/.local/bin/claude or claude.exe) when tweakcc (node-lief) is present in your local cache.

Before writing anything, the patcher saves a `.cc-backup` copy of your installation and runs `node --check` on JS bundles. If the syntax check fails, it restores the backup immediately.


Quick start

1. Curate your subagent models (or sync from your g