ClaudeMods
☰
KO
● 0 명 접속 중 · 조회 0 회
후원프로젝트 제출
GitHub 저장소 · 작성자 arkadevbanerjee

model-router

일반 `claude` 세션 안에서 submux를 구동하는 Claude Code 플러그인.

arkadevbanerjee@arkadevbanerjee

arkadevbanerjee/submux/tree/main/claude-plugin/model-router

번역 완료

이 mod 소개

model-router

일반 claude 세션 안에서 submux를 구동하는 Claude Code 플러그인입니다. 별도 런처 없이 /model로 메인 루프, 각 서브에이전트 계층, 각 서브에이전트 유형의 모델, 제공자, effort를 바꿉니다.

설정

  1. submux serve를 실행하고(최상위 README 참조) ~/.claude/settings.json에서 Claude Code가 그쪽을 가리키게 합니다.

    { "env": { "ANTHROPIC_BASE_URL": "http://127.0.0.1:8787" } }
    
  2. 플러그인을 로드합니다. 같은 env 블록의 콜론으로 구분된 CLAUDE_CODE_PLUGIN_DIRS에 이 디렉터리를 추가합니다.

  3. 선택 사항으로 ~/.config/submux/routing-guide.md에 라우팅 가이드를 직접 작성합니다. 플러그인은 이를 모든 세션의 프롬프트에 추가합니다. routing-guide.example.md가 시작점입니다.

  4. 테스트를 실행합니다: claude plugin test claude-plugin/model-router.

하는 일

  • 실시간 카탈로그. 플러그인은 submux models를 읽고(각 upstream이 오늘 제공하는 모든 id를 구독별로 묶음), 기본 /model 선택기와 동일하게 유지합니다. 하드코딩된 값은 없습니다.
  • 라우트. 라우트 하나가 계층 하나(fable, opus, sonnet, haiku) 또는 서브에이전트 유형 하나에 모델, effort, 선택적 폴백 체인을 설정합니다.
  • 생성마다 고정. 서브에이전트의 라우트는 생성될 때 한 번 정해집니다. 이후 변경은 새 생성에만 도달하며 --now를 추가한 경우는 예외입니다.
  • 생성 태그. @MODEL:EFFORT로 끝나는 Agent 설명(예: fix fee rounding @gpt-6.1-sol:medium)은 그 생성 하나를 라우팅합니다.
  • 표시됨. 각 Agent 행에 실제 모델, effort, 제공자, 선택자가 표시됩니다. /model agents는 세션의 모든 서브에이전트를 나열합니다.
  • 선택 로그. 끝난 서브에이전트마다 JSON 한 줄을 ~/.local/state/model-router/picks.jsonl에 씁니다.
  • 결정권. 모델은 서브에이전트 라우트만 설정할 수 있습니다. 메인 루프, 계층, 프로필은 그대로 사용자가 관리합니다.

명령

/model                          메인 루프용 기본 선택기
/model ID                       메인 루프를 ID로 전환(기본 제공)
/model routes                   라우트 표와 실시간 모델
/model list                     제공자별 모델 id(id가 제공자를 선택)
/model agents                   이 세션의 모든 서브에이전트: 상태, 실제 모델, effort, 제공자, 선택자
/model sonnet ID [LVL]          계층: fable, opus, sonnet, haiku, nomodel; 또는 에이전트 유형(coder ID high)
/model sonnet LVL | sonnet off  effort만 | 규칙 삭제
/model --model ID --effort LVL  submux를 통한 메인 루프 라우트
/model --agent Explore=ID[:LVL] 서브에이전트 유형 하나(ID는 비워도 됨: --agent coder=:high)
/model --profile NAME           저장한 프로필 로드     --save NAME / --delete NAME
/model --default                현재 설정을 새 세션의 기본값으로 저장
/model --fallback TARGET=ID,ID  요청 실패 시 이 id들을 순서대로 시도(TARGET: 슬롯 또는 에이전트 유형)
/model ... --now                실행 중인 서브에이전트도 전환(기본값은 새 생성만)
/model --reset

모델이나 effort를 바꾸면 프롬프트 캐시가 모델별이므로 전체 컨텍스트를 한 번 다시 읽습니다.

설치

먼저 작성자의 README에서 marketplace와 플러그인 이름을 확인하세요. 저장소 구조에 따라 명령어가 달라질 수 있습니다.

claude plugin marketplace add arkadevbanerjee/submux
claude plugin install model-router
원문 / README

model-router

A Claude Code plugin that drives submux from inside a normal claude session. You switch model, provider and effort for the main loop, each subagent tier and each subagent type with /model, with no separate launcher.

Setup

  1. Run submux serve (see the top-level README) and point Claude Code at it in ~/.claude/settings.json:

    { "env": { "ANTHROPIC_BASE_URL": "http://127.0.0.1:8787" } }
    
  2. Load the plugin: add this directory to CLAUDE_CODE_PLUGIN_DIRS (colon-separated) in the same env block.

  3. Optional: write your own routing guide at ~/.config/submux/routing-guide.md. The plugin adds it to every session's prompt. routing-guide.example.md is a starting point.

  4. Run the tests: claude plugin test claude-plugin/model-router.

What it does

  • Live catalogue. The plugin reads submux models (every id each upstream serves today, grouped by subscription) and keeps the native /model picker equal to it. Nothing is hardcoded.
  • Routes. A route sets a model, an effort and an optional fallback chain for one tier (fable, opus, sonnet, haiku) or one subagent type.
  • Frozen per spawn. A subagent's route is decided once, when it spawns. Later changes reach new spawns only, unless you add --now.
  • Per-spawn tag. An Agent description that ends with @MODEL:EFFORT (for example fix fee rounding @gpt-6.1-sol:medium) routes that one spawn.
  • Visible. Each Agent row shows the real model, effort, provider and who picked it. /model agents lists every subagent of the session.
  • Pick log. One JSON line per finished subagent goes to ~/.local/state/model-router/picks.jsonl.
  • Who decides. The model may set subagent routes only. The main loop, the tiers and profiles stay yours.

Commands

/model                          built-in picker for the main loop
/model ID                       main loop to ID (built-in)
/model routes                   routes table plus live models
/model list                     model ids by provider (the id picks the provider)
/model agents                   every subagent this session: status, real model, effort, provider, who picked
/model sonnet ID [LVL]          a tier: fable, opus, sonnet, haiku, nomodel; or an agent type (coder ID high)
/model sonnet LVL | sonnet off  effort only | clear the rule
/model --model ID --effort LVL  main loop through submux, as a route
/model --agent Explore=ID[:LVL] one subagent type (ID may be empty: --agent coder=:high)
/model --profile NAME           load a saved profile     --save NAME / --delete NAME
/model --default                save current as default for new sessions
/model --fallback TARGET=ID,ID  try these ids in order when a request fails (TARGET: slot or agent type)
/model ... --now                also switch running subagents (default: new spawns only)
/model --reset

A model or effort change re-reads the whole context once, because the prompt cache is per model.

비슷한 프로젝트