#Muti Models Agent

1 messages · Page 1 of 1 (latest)

ripe jungle
#

Hi I want my agent use multi-model in suit cases, like if the task is planning he use z-ai/glm-4.7 if coding use qwen/qwen-2.5-coder-32b-instruct if search use google/gemini-2.0-flash-001 for simple other action use z-ai/glm-4.7-flash... this way is so important to manage the cost and the quality needed for the tasks.
how can i set these options in current json in OpenClaw?
set each alias (planner, coder, manager, search...) replace to (defaults) that coming after agents or add theme inside models?
am search the documents ai.. do clear info found, and all my tries fails..
i need all keywords that in used like (planner, coder, search...)
and need json layout to set theme

and this is the stander one
"agents": {
"defaults": {
"models": {
"openrouter/auto": {
"alias": "OpenRouter"
},
"openrouter/z-ai/glm-4.7-flash": {}
},
"model": {
"primary": "openrouter/z-ai/glm-4.7-flash"
}
}
}

clear nexusBOT
#

To help others find answers, you can mark your question as solved via Right click solution message -> Apps -> âś… Mark Solution

ripe jungle
#

hi am just fix part of it by making multi-agent, each one with defferent model
this is my set for any one to just use it
"agents": { "defaults": { "model": { "primary": "openrouter/openai/gpt-oss-20b", "fallbacks": [ "openrouter/openai/gpt-oss-120b" ] }, "models": { "openrouter/qopenai/gpt-oss-20b": { "alias": "Manager" }, "openrouter/moonshotai/kimi-k2.5": { "alias": "planner" }, "openrouter/deepseek/deepseek-v3.2": { "alias": "coder" }, "openrouter/qwen/qwen3-coder": { "alias": "coder" }, "openrouter/qopenai/gpt-oss-120b": { "alias": "analyst" } }, "workspace": "/home/clawdbot/.openclaw/workspace", "compaction": { "mode": "safeguard" }, "maxConcurrent": 1, "subagents": { "maxConcurrent": 2 } }, "list": [ { "id": "ops", "model": { "primary": "openrouter/openai/gpt-oss-120b", "fallbacks": [ "openrouter/openai/gpt-oss-20b" ] } }, { "id": "Manager", "model": { "primary": "openrouter/openai/gpt-oss-120b", "fallbacks": [ "openrouter/openai/gpt-oss-20b" ] } }, { "id": "Planner", "model": { "primary": "openrouter/moonshotai/kimi-k2.5" } }, { "id": "coder1", "model": { "primary": "openrouter/deepseek/deepseek-v3.2" } }, { "id": "coder2", "model": { "primary": "openrouter/qwen/qwen3-coder" } } ] },

coarse vectorBOT
#

OpenClaw does not have built-in “roles”/keywords like planner, coder, search that automatically route to different models.

What is supported today is:

  1. Define your own aliases (you choose the alias names) in agents.defaults.models
  2. Manually switch per session with /model <alias> (or /<alias>), or start a new session with /new <alias>
  3. Use sub-agents (spawned work) with a different model, or multiple agents with different defaults (routed by bindings)

Docs (this is the key line): https://docs.openclaw.ai/help/faq#how-can-i-use-different-models-for-different-tasks


1) Where to put aliases (planner/coder/search/etc)

Put them inside agents.defaults.models.<modelRef>.alias (not inside models.providers).

Example (JSON5 layout):

#
{
  agents: {
    defaults: {
      // 1) allowlist + aliases live here
      models: {
        "openrouter/z-ai/glm-4.7": { alias: "planner" },
        "openrouter/qwen/qwen-2.5-coder-32b-instruct": { alias: "coder" },
        "openrouter/google/gemini-2.0-flash-001": { alias: "search" },
        "openrouter/z-ai/glm-4.7-flash": { alias: "fast" },
      },

      // 2) default model for normal chat
      model: {
        primary: "openrouter/z-ai/glm-4.7-flash",
        // optional:
#

2) “All keywords that are used”

There are only a few built-in shortcuts (and they only work if that model is present in your agents.defaults.models allowlist):

opus, sonnet, gpt, gpt-mini, gemini, gemini-flash

Everything else (like planner, coder, search) is your own alias name.

Config reference: https://docs.openclaw.ai/gateway/configuration#agentsdefaults


3) If you want automatic switching by task type

That exact “if task is coding → use model X” router isn’t a config feature yet.

Closest supported patterns:

#

If you tell me what surface you’re using (Discord channel vs DM vs Telegram, etc.), I can show the cleanest agents.list + bindings layout for your case.

#

Good workaround — multi-agent is the right hammer if you want real separation (different workspaces + different session stores) per “role”.

A few gotchas in your snippet that will bite people copying it:

  1. You accidentally remove isolation by forcing one shared workspace
  • You set:
    "workspace": "/home/clawdbot/.openclaw/workspace"
    
    under agents.defaults, so all agents inherit the same workspace unless you override per-agent.
  • Fix: either delete agents.defaults.workspace (let it default to ~/.openclaw/workspace-<agentId>), or set workspace per agent.
  1. Typos / mismatched model ids in the allowlist
  • Your primary is openrouter/openai/gpt-oss-20b but your models allowlist key is openrouter/qopenai/gpt-oss-20b (same for 120b).
  • If agents.defaults.models is present, it acts as the catalog/allowlist for /model and session overrides, so these mismatches cause confusion.
    • Make the keys match the exact provider/model you actually use.
#
  1. Duplicate aliases
  • You have two entries with "alias": "coder". Aliases are case-insensitive; one will win and the other basically disappears.
    • Use unique aliases like coder_ds and coder_qwen (or coder1/coder2).
  1. Multi-agent does nothing without routing (bindings)

Minimal pattern (route one Discord channel to one agent):

{
  bindings: [
    { agentId: "planner", match: { channel: "discord", peer: { kind: "channel", id: "1468644485595398268" } } },
  ]
}