# Model Switch

Switch the Manager Agent's own LLM model.

- Repository: https://github.com/agentscope-ai/AgentTeams (5913 stars)
- Category: AI and agents
- License: Apache-2.0
- Last updated: 2026-11-01
- Runs scripts: yes, review before use

## Install

Claude Code: `npx skills add agentscope-ai/AgentTeams --skill model-switch -g -a claude-code -y`
Codex: `npx skills add agentscope-ai/AgentTeams --skill model-switch -g -a codex -y`
Cursor: `npx skills add agentscope-ai/AgentTeams --skill model-switch -g -a cursor -y`
Gemini CLI: `npx skills add agentscope-ai/AgentTeams --skill model-switch -g -a gemini-cli -y`

## Description

Switch the Manager Agent's own LLM model. Use when the human admin requests changing the Manager's model.

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# Model Switch

Switch the Manager's own LLM model. The script tests connectivity first, then patches `openclaw.json`.

## Usage

```bash
bash /opt/agentteams/agent/skills/model-switch/scripts/update-manager-model.sh <MODEL_ID> [--context-window <SIZE>] [--no-reasoning]
```

Examples:
```bash
bash /opt/agentteams/agent/skills/model-switch/scripts/update-manager-model.sh claude-sonnet-4-6
bash /opt/agentteams/agent/skills/model-switch/scripts/update-manager-model.sh my-custom-model --context-window 300000
bash /opt/agentteams/agent/skills/model-switch/scripts/update-manager-model.sh deepseek-chat --no-reasoning
```

## What the script does

1. Strips any `agentteams-gateway/` prefix from the model name
2. Tests the model via `POST /v1/chat/completions` on the AI Gateway, exits with error if unreachable
3. If the model is already in the `models` array: refreshes its `reasoning` / `contextWindow` / `maxTokens` / `input` fields and switches `agents.defaults.model.primary`
4. If the model is new: adds it to the `models` array and switches primary
5. Always outputs `RESTART_REQUIRED`

Because step 3 rewrites the model's fields, re-running the script is the way to
correct an entry that was first written with wrong values, for example a model
that was added with the 150,000 default because nobody knew its real window:
run the script again with `--context-window <SIZE>` and the new value lands in
`openclaw.json`.

## After running the script

The script always outputs `RESTART_REQUIRED`. Run `openclaw gateway restart` to apply the change, then tell the human admin the switch is complete.

## Reasoning control

By default, reasoning (extended thinking) is enabled. To disable it, pass `--no-reasoning`.

## On failure

If the gateway test fails (non-200), the script outputs `ERROR: MODEL_NOT_REACHABLE` and exits. No changes are made to `openclaw.json`.

When you see this error, tell the human admin clearly:

The rest: https://github.com/agentscope-ai/AgentTeams/blob/HEAD/manager/agent/skills/model-switch/SKILL.md
