# Multi-Model Configuration

Agent Network supports running agents with different AI models within the same network. All models share the same communication protocol and can message each other seamlessly.

## Supported Models

| Model | Runtime | Strengths | Cost |
|------|---------|------|------|
| **Claude Sonnet (latest line)** | `claude-agent-sdk` | Best-in-class reasoning, long context (see [Anthropic Models](https://docs.anthropic.com/claude/docs/models-overview)) | Mid-High |
| **Claude Opus (latest line)** | `claude-agent-sdk` | Complex tasks, creative writing (same link) | Very high |
| **Claude Code** | `claude-code-cli` | Terminal-style agent; spawns the local `claude` binary, reuses your Claude Max subscription | Subscription |
| **Codex (codex-sdk)** | `codex-sdk` | Strong code generation, tool use | Medium |
| **MiniMax (latest line)** | `claude-agent-sdk` | ✅ verified — low cost, high throughput (look up the latest model id at [platform.minimaxi.com](https://platform.minimaxi.com)) | Very low |
| **InternLM Intern-S2-Preview** (`anet node create` vendor-picker default, **only after you pick `claude-agent-sdk` runtime** — since v0.9.2 the wizard is runtime-first per [#133](https://github.com/sleep2agi/agent-network/issues/133)) | `claude-agent-sdk` | ✅ verified — domestic model, scientific reasoning; the first option in the vendor picker (`chat.intern-ai.org.cn`, bare hostname) | Low |
| **InternLM Intern-S1-Pro** | `claude-agent-sdk` | ✅ verified — domestic model, scientific reasoning (Intern-S1-Pro is the current product line; no version suffix appended) | Low |
| **Xiaomi MiMo** | `claude-agent-sdk` | ✅ verified — `mimo-v2.5-pro` (default) / v2.5 / v2-pro / v2-omni / v2.5-tts-voicedesign[^mimo-tts-en], low cost (Xiaomi, `token-plan-cn.xiaomimimo.com/anthropic`; look up model id at [platform.xiaomimimo.com](https://platform.xiaomimimo.com)) | Low |

[^mimo-tts-en]: `mimo-v2.5-tts-voicedesign` is a **TTS (voice-design) model** — Anthropic Messages text requests are unlikely to be supported by the vendor on that model; use one of the first four (`mimo-v2.5-pro` / `mimo-v2.5` / `mimo-v2-pro` / `mimo-v2-omni`) for chat. Since v0.10.10 the wizard ships the full 5-model preset matching Xiaomi's official lineup.
| **OpenRouter (multi-model gateway)** | `claude-agent-sdk` | one API key, all upstream models (GPT-4 / Claude / Gemini / Llama, etc.); unified billing. Reachable via the `custom` vendor with `openrouter.ai/api/v1` + `ANTHROPIC_AUTH_TOKEN`. | Upstream pass-through |
| **xAI Grok Build** | `grok-build-acp` | ACP-protocol cross-agent collaboration via the local `grok` binary; selectable from the `anet node create` 4-way runtime picker (since v0.10.8 / v0.10.11) — [detailed runtime guide ↗](https://github.com/sleep2agi/agent-network/blob/main/docs/grok-build-runtime.md). Auth: `grok auth login` done + `XAI_API_KEY` env (runtime prereq). | Medium |

> Verification model (post-#104-B): cli.ts no longer uses the old "`MODEL_PRESETS` + `[UNVERIFIED]` tag" scheme — it's now a single [`VENDORS` list (in cli.ts, grep `const VENDORS`)](https://github.com/sleep2agi/agent-network/blob/main/agent-network/bin/cli.ts), and **being in the list means verified-with-real-call**. **Providers that haven't passed verification (DeepSeek / GLM / Kimi) are intentionally NOT in the list** — reach them via the `custom` vendor below (any Anthropic-compatible API works through `custom`). Full detail: [runtimes — Verified vs not](/en/guide/runtimes#verified-vs-not).

::: tip Any Anthropic-compatible provider works
The table above lists common providers, but `claude-agent-sdk` integrates with **any** service that supports the Anthropic Messages API via `ANTHROPIC_BASE_URL`. Providers not listed (self-hosted vLLM, SiliconFlow, Qwen Anthropic-compatible endpoint, etc.) work the same way — point `ANTHROPIC_BASE_URL` at their Anthropic-compatible endpoint and set the API key via `ANTHROPIC_AUTH_TOKEN`. See "Configuration" below.
:::

## Configuration

### Claude (Overseas)

Two equivalent ways to run Claude — pick whichever auth you already have.

```bash
# Option 1: Anthropic API Key (claude-agent-sdk runtime)
# --model: pick the latest id from [Anthropic Models](https://docs.anthropic.com/claude/docs/models-overview)
ANTHROPIC_API_KEY=sk-ant-xxx \
anet node create reasoning-master --runtime claude-agent-sdk --model <anthropic-model-id>

# Option 2: Claude Code CLI (claude-code-cli runtime, requires a Claude Max subscription)
anet node create all-rounder --runtime claude-code-cli

anet node start reasoning-master
```

| Environment Variable | Description |
|---------|------|
| `ANTHROPIC_API_KEY` | Anthropic API key (Option 1: `claude-agent-sdk`) |
| (not needed) | Option 2 reuses local `claude auth login` credentials (`claude-code-cli`) |

### Codex SDK

Codex (codex-sdk) uses the OpenAI Codex SDK and requires an OpenAI account.

```bash
# Log in first
codex auth login

# Create and start a Codex agent
# --model: pick the latest id from OpenAI Codex docs
anet node create code-assistant --runtime codex-sdk --model <codex-model-id> --tools Read,Write,Edit,Bash,Glob,Grep
anet node start code-assistant
```

| Environment Variable | Description |
|---------|------|
| (not needed) | Uses `codex auth login` credentials |

### MiniMax (claude-agent-sdk)

MiniMax integrates via the Anthropic-compatible API, using `ANTHROPIC_BASE_URL` to route to MiniMax.

```bash
# Create and start a MiniMax agent
# --model: pick the latest id from MiniMax console (see Model Mapping tip below for Claude-name fallback)
ANTHROPIC_BASE_URL=https://api.minimaxi.com/anthropic \
ANTHROPIC_AUTH_TOKEN=your-minimax-api-key \
anet node create minimax-bot --runtime claude-agent-sdk --model <minimax-model-id>
anet node start minimax-bot
```

::: tip Model Mapping (Anthropic-compat fallback)
MiniMax's Anthropic-compatible API also accepts Claude model names as aliases — useful if you want to swap Anthropic for MiniMax with zero `--model` change. Mapping targets may shift as Anthropic releases new model ids; check [MiniMax docs](https://platform.minimaxi.com) for the currently supported alias list.
:::

| Environment Variable | Value |
|---------|-----|
| `ANTHROPIC_BASE_URL` | `https://api.minimaxi.com/anthropic` |
| `ANTHROPIC_AUTH_TOKEN` | MiniMax API Key |

### InternLM (claude-agent-sdk)

```bash
# Note: bare hostname, NO /anthropic suffix — unlike MiniMax et al.
ANTHROPIC_BASE_URL=https://chat.intern-ai.org.cn \
ANTHROPIC_AUTH_TOKEN=your-intern-key \
anet node create intern --runtime claude-agent-sdk --model intern-s1-pro
anet node start intern
```

| Environment Variable | Value |
|---------|-----|
| `ANTHROPIC_BASE_URL` | `https://chat.intern-ai.org.cn` (bare hostname, no `/anthropic`) |
| `ANTHROPIC_AUTH_TOKEN` | InternLM API Key |

### Xiaomi MiMo (claude-agent-sdk)

Xiaomi's MiMo platform exposes an Anthropic-compatible endpoint, with a reasoning-focused lineup at competitive prices. Since **v0.10.10** the `anet node create` wizard ships the full **5-model preset** matching Xiaomi's official lineup. Look up the current model ids at [platform.xiaomimimo.com](https://platform.xiaomimimo.com).

| Model id | Notes |
|---|---|
| `mimo-v2.5-pro` | Wizard default — pro-tier reasoning |
| `mimo-v2.5` | Base v2.5 |
| `mimo-v2-pro` | Previous-gen pro |
| `mimo-v2-omni` | Multi-modal omni |
| `mimo-v2.5-tts-voicedesign` | **TTS voice-design model** — Anthropic Messages text requests are unlikely to be supported by the vendor on this model; use one of the four above for text chat |

```bash
ANTHROPIC_BASE_URL=https://token-plan-cn.xiaomimimo.com/anthropic \
ANTHROPIC_AUTH_TOKEN=your-mimo-api-key \
anet node create mimo-bot --runtime claude-agent-sdk --model mimo-v2.5-pro
anet node start mimo-bot
```

| Environment Variable | Value |
|---------|-----|
| `ANTHROPIC_BASE_URL` | `https://token-plan-cn.xiaomimimo.com/anthropic` |
| `ANTHROPIC_AUTH_TOKEN` | Xiaomi MiMo API Key (sign up at [platform.xiaomimimo.com](https://platform.xiaomimimo.com)) |

### OpenRouter (claude-agent-sdk)

OpenRouter is a multi-model gateway — one API key, all upstream models (GPT-4, Claude, Gemini, Llama, etc.) with unified billing.

```bash
ANTHROPIC_BASE_URL=https://openrouter.ai/api/v1 \
ANTHROPIC_AUTH_TOKEN=your-openrouter-api-key \
anet node create multi-bot --runtime claude-agent-sdk --model anthropic/claude-sonnet-4
anet node start multi-bot
```

| Environment Variable | Value |
|---------|-----|
| `ANTHROPIC_BASE_URL` | `https://openrouter.ai/api/v1` |
| `ANTHROPIC_AUTH_TOKEN` | OpenRouter API Key (sign up at [openrouter.ai](https://openrouter.ai)) |
| `--model` | `provider/model` format (e.g. `anthropic/claude-sonnet-4`, `openai/gpt-4o`); full list at [openrouter.ai/models](https://openrouter.ai/models) |

## ANTHROPIC_BASE_URL Mechanism {#how-anthropic-base-url-works}

The `claude-agent-sdk` runtime uses the `ANTHROPIC_BASE_URL` environment variable to route requests to compatible API endpoints. This is the core model-mapping mechanism:

```mermaid
graph LR
    AN[Agent Node<br/>claude-agent-sdk] -->|ANTHROPIC_BASE_URL| API{API Router}
    API -->|api.anthropic.com| Claude[Claude API]
    API -->|api.minimaxi.com| MM[MiniMax API]
    API -->|chat.intern-ai.org.cn| IS[InternLM API]
    API -->|api.deepseek.com| DS[DeepSeek API]
```

### Configuration Reference

| Provider | ANTHROPIC_BASE_URL | Model Parameter |
|------|-------------------|-----------|
| Anthropic (native) | (unset) | Latest from [Anthropic Models](https://docs.anthropic.com/claude/docs/models-overview) |
| MiniMax | `https://api.minimaxi.com/anthropic` | Latest from [MiniMax platform](https://platform.minimaxi.com) (or use any Claude model id via the mapping tip above) |
| InternLM | `https://chat.intern-ai.org.cn` (bare hostname, no `/anthropic`) | Latest from [Intern platform](https://chat.intern-ai.org.cn) |
| DeepSeek | `https://api.deepseek.com/anthropic` | Latest from [DeepSeek platform](https://platform.deepseek.com) |
| Xiaomi MiMo | `https://token-plan-cn.xiaomimimo.com/anthropic` | Latest from [Xiaomi MiMo platform](https://platform.xiaomimimo.com) |

## Vendor adapter (behavior-correction layer, v0.9.1+)

The Anthropic-compatible protocol **only standardizes the wire format**; it **does not guarantee behavioral parity**. Each vendor's RLHF fine-tuning takes its own path, so the same `tools` + `tool_choice: "auto"` payload produces **behavioral divergence** across vendors:

- ✅ MiniMax / Anthropic native: emits `tool_use` content blocks cleanly, works out of the box
- ❌ InternLM intern-s2-preview: defaults to verbose "Thinking Process" text, **does not emit** `tool_use` blocks (forcing `tool_choice` is rejected with `-20077`)

From [v0.9.1](/en/changelog#v0-9-1-patch-130-intern-tool-calling-hotfix-promoted-2026-05-15-stable) ([#130 hotfix](https://github.com/sleep2agi/agent-network/issues/130)) onward, agent-node ships a **vendor adapter** that detects `ANTHROPIC_BASE_URL` and prepends a system-prompt bias to nudge vendor behavior back to Anthropic-standard.

**Current adapter (intern) trigger**: URL matches the regex `/intern-ai\.org\.cn|chat\.intern-ai/i` ([`agent-node/src/cli.ts`](https://github.com/sleep2agi/agent-network/commit/4cd0024)) — the "InternLM" example above (`ANTHROPIC_BASE_URL=https://chat.intern-ai.org.cn`) triggers it automatically.

**Five user-visible side effects** (must-read + opt-out path):
1. Loses Intern's Thinking Process transparency (model skips thinking)
2. Detection fragility (self-hosted lmdeploy / proxy / aggregator endpoints don't match the regex)
3. Silent injection (the bias is implicitly prepended; can be confusing while debugging)
4. Forced tool-calling style (net positive for multi-agent coordination, drag on single-agent report generation)
5. Fewer tokens out = less explainability

See [Vendor Adapters](/en/concepts/vendor-adapters) for the full mechanism + per-side-effect migration hints + future polish gaps.

**Opt-out**: `anet node start <alias> --prompt "your system prompt"` — `--prompt` **replaces** rather than appends, so the vendor bias is no longer prepended and the model reverts to its native RLHF.

## Mixed Deployment in Practice

A typical mixed deployment scenario: commander uses Codex, code tasks go to Codex (codex-sdk), text tasks go to MiniMax.

### docker-compose.yml

```yaml
services:
  server:
    image: commhub-server
    ports:
      - "9200:9200"

  commander:
    image: agent-node
    environment:
      - ALIAS=commander
      - RUNTIME=codex-sdk
      - MODEL=<codex-model-id>  # latest id from OpenAI Codex docs
      - COMMHUB_URL=http://server:9200
      - SYSTEM_PROMPT=You are the commander. Receive tasks and dispatch them. Route code tasks to the code team and text tasks to the writing team.

  coder-1:
    image: agent-node
    environment:
      - ALIAS=coder-1
      - RUNTIME=codex-sdk
      - MODEL=<codex-model-id>
      - COMMHUB_URL=http://server:9200
      - TOOLS=Read,Write,Edit,Bash,Glob,Grep

  writer-1:
    image: agent-node
    environment:
      - ALIAS=writer-1
      - RUNTIME=claude-agent-sdk
      - MODEL=<minimax-model-id>  # or any Claude model id via the MiniMax mapping fallback (see tip above)
      - ANTHROPIC_BASE_URL=https://api.minimaxi.com/anthropic
      - ANTHROPIC_AUTH_TOKEN=${MINIMAX_API_KEY}
      - COMMHUB_URL=http://server:9200
```

### Task Dispatch Strategy

The commander uses its system prompt to determine how to route tasks:

```
You are the commander. Receive messages and intelligently dispatch tasks:
- Code tasks (file I/O / commands / code) → dispatch to coder-1 through coder-5
- Text tasks (translation / analysis / writing) → dispatch to writer-1 through writer-5
- Use commhub_send_task to dispatch
- Use commhub_get_all_status to check who's online
```

## Model Selection Guide

| Scenario | Recommended Model | Rationale |
|------|---------|------|
| Architecture design | Claude Opus | Best-in-class reasoning |
| Code implementation | Codex (codex-sdk) | Strong code + tool use |
| Code review | Claude Sonnet | High accuracy |
| Translation / Summarization | MiniMax | Low cost, high throughput |
| Data processing | MiniMax | Batch processing, low cost |
| Scientific reasoning | InternLM Intern | Domestic model, strong in specialized domains |
| General conversation | DeepSeek | Excellent value |

## Cost Optimization

### Strategy 1: Tiered Models

```
Complex tasks (10%) → Claude Opus (~$15/M tokens order-of-magnitude)
Medium tasks (30%)  → Codex (codex-sdk) (~$5/M tokens)
Simple tasks (60%)  → MiniMax (~$0.3/M tokens)
```

> Numbers above are order-of-magnitude estimates as of 2026-05; provider pricing changes — check the provider's official rate card before sizing a budget.

### Strategy 2: Budget Controls

agent-node supports `--max-budget <usd>` per task. It's not surfaced as an `anet node create` flag — set it via `config.json` `flags.maxBudgetUsd`:

```jsonc
// ~/.anet/nodes/architect/config.json
{
  "alias": "architect",
  "runtime": "claude-agent-sdk",
  "model": "claude-sonnet-4-6",
  "flags": {
    "maxBudgetUsd": 1.0          // cap at $1 per task
  }
}
```

Or pass it directly when launching agent-node manually:

```bash
agent-node --max-budget 1.0 --alias architect --runtime claude-agent-sdk --hub http://127.0.0.1:9200
```

### Strategy 3: Batch with Low-Cost Models

Distribute repetitive tasks in bulk to low-cost models:

```bash
# Create and start 5 MiniMax agents for batch translation
for i in 1 2 3 4 5; do
  ANTHROPIC_BASE_URL=https://api.minimaxi.com/anthropic \
  ANTHROPIC_AUTH_TOKEN=$MINIMAX_KEY \
  anet node create "translator-${i}" --runtime claude-agent-sdk --model <minimax-model-id>
  anet node start "translator-${i}" &
done
```

## Next steps

**Use it now**:

**Configure and tune**:
- Where does the cost go? See the cost comparison in [One-shot install](/en/guide/one-shot-install)
- Persist multiple API keys? See [Agent Node -- config.json env field](/en/guide/agent-node)
- Rate-limit errors? Most providers have concurrency caps -- see [FAQ](/en/faq)

**Dig deeper**:
- Why does `ANTHROPIC_BASE_URL` work across all domestic models? See [How ANTHROPIC_BASE_URL works](#how-anthropic-base-url-works) above
- Difference between runtimes? See [Runtimes](/en/guide/runtimes) -- `claude-agent-sdk` / `codex-sdk` / `claude-code-cli`
