#Trying to setup Qwen models via api key...

1 messages · Page 1 of 1 (latest)

steel flume
#

I just want to switch from openrouter qwen, to my own modelstudio keys.

I find the web gateway a bit confusing and difficult to change models (its not clear to me, maybe i'm misunderstanding the UI). So i am just editing openclaw.json instead.

Maybe i'm doing it wrong? Should i be re-running the onboarding? When i run openclaw model list i just see the model i have configured already.

So what is the best way to go about adding new models, or changing out my main model?

Here is what I did, but i think my json is incorrect:

  1. added bailian to auth:

{
"auth": {
"profiles": {
"openrouter:default": {
"provider": "openrouter",
"mode": "api_key"
},
"bailian:default": {
"provider": "bailian",
"mode": "api_key"
}
}
},

Swapped out witht he model i want:

"agents": {
"defaults": {
"model": "bailian/qwen3.5-plus",
"workspace": "/root/.openclaw/workspace",
"compaction": {
"mode": "safeguard"
},
"maxConcurrent": 4,
"subagents": {
"maxConcurrent": 8
}
}
},

Added the models included with my alibaba modelstudio coding plan:

"models": {
"providers": {
"bailian": {
"baseUrl": "https://dashscope.aliyuncs.com/compatible-mode/v1",
"apiKey": "YOUR_ALIBABA_API_KEY_HERE",
"api": "openai-completions",
"models": [
{"id": "qwen3.5-plus"},
{"id": "qwen3-max-2026-01-23"},
{"id": "qwen3-coder-next"},
{"id": "qwen3-coder-plus"},
{"id": "MiniMax-M2.5"},
{"id": "glm-5"},
{"id": "glm-4.7"},
{"id": "kimi-k2.5"}
]
}
}
}

This part is whats throwing errors when i try to gateway restart (part 3).

So my question is:

Am i doing this right, is editing the raw json the way to go?

and B, whats wrong with my JSON? Ignore exact } json syntax, i know i pasted them in here wrong.

errant trellisBOT
#

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

tender sandalBOT
#

Editing openclaw.json is totally a valid way to do this — but if you’re already finding the UI confusing, the least painful path is usually:

  • openclaw configure --section models (wizard, validates schema), and/or
  • openclaw models set <provider/model> (sets the default model cleanly),
  • and then use /model in chat to switch per-session without restarts.

Re-running full onboarding is not required just to switch providers/models. (It’s safe, just overkill.)

Docs: https://docs.openclaw.ai/help/faq#how-do-i-switch-models-without-wiping-my-config and https://docs.openclaw.ai/concepts/models


Why openclaw model list only shows the one model

In OpenClaw, there are two related concepts that people often mix up:

  1. models.providers = “how do I talk to this endpoint, what models exist there?”
  2. agents.defaults.models = the allowlist/catalog of models the agent is allowed to pick (this heavily affects what /model and models list show)
#

So if your agents.defaults.models only contains one entry, your picker/list will look like “only one model exists”, even if you added 10 definitions under models.providers.


What’s wrong with your JSON (Part 3)

Your models.providers.bailian.models entries are missing name.

In current OpenClaw config schema, each model definition is strict and requires:

{ id: "...", name: "..." }

If you only provide { "id": "qwen3.5-plus" }, gateway restart will fail with a validation error along the lines of “name is required”.

So this works:

#
models: {
  mode: "merge",
  providers: {
    bailian: {
      baseUrl: "https://dashscope.aliyuncs.com/compatible-mode/v1",
      api: "openai-completions",
      apiKey: "${BAILIAN_API_KEY}",
      models: [
        { id: "qwen3.5-plus", name: "Qwen 3.5 Plus" },
        { id: "qwen3-max-2026-01-23", name: "Qwen 3 Max (2026-01-23)" },
      ],
    },
  },
},
#

Docs: https://docs.openclaw.ai/concepts/model-providers


Two more important notes (based on your snippets)

1) agents.defaults.model should usually be primary/fallbacks

Depending on your version, agents.defaults.model: "provider/model" may still work, but the documented/modern format is:

agents: {
  defaults: {
    model: { primary: "bailian/qwen3.5-plus" },
  },
},
#

2) auth.profiles doesn’t contain the API key

auth.profiles is just describing profiles/order. The secret material is normally stored in per-agent auth-profiles.json or provided via env.

For API keys, simplest is: put it in ~/.openclaw/.env (or env: { ... }) and reference it via ${...} like above.


If you paste one thing, paste this

Can you paste:

  • openclaw --version
  • the exact config validation error you get on restart (the first ~20 lines is enough)

That’ll let me confirm whether it’s only the missing name fields, or if there’s a second schema mismatch in your file too.

steel flume
#

2026.2.24

Config invalid
File: ~/.openclaw/openclaw.json
Problem:

tender sandalBOT
#

That error is super specific: your model definitions need a name field.

In models.providers.<id>.models[], each entry is validated as:

{ id: "…", name: "…" }

So { "id": "qwen3.5-plus" } fails with exactly what you’re seeing (name is undefined).

Fix for your Part (3)

{
  models: {
    // optional but recommended if you already have other providers in models.json
#
    mode: "merge",

    providers: {
      bailian: {
        baseUrl: "https://dashscope.aliyuncs.com/compatible-mode/v1",
        api: "openai-completions",

        // don’t hardcode keys if you might ever share config
        apiKey: "${BAILIAN_API_KEY}",

        models: [
          { id: "qwen3.5-plus", name: "qwen3.5-plus" },
          { id: "qwen3-max-2026-01-23", name: "qwen3-max-2026-01-23" },
          { id: "qwen3-coder-next", name: "qwen3-coder-next" },
          { id: "qwen3-coder-plus", name: "qwen3-coder-plus" },
#
          { id: "MiniMax-M2.5", name: "MiniMax-M2.5" },
          { id: "glm-5", name: "glm-5" },
          { id: "glm-4.7", name: "glm-4.7" },
          { id: "kimi-k2.5", name: "kimi-k2.5" }
        ]
      }
    }
  }
}

Then put the key in ~/.openclaw/.env:

BAILIAN_API_KEY="…"
#

Switching your “main model” (Part 2)

On 2026.2.x the “modern” shape is:

agents: {
  defaults: {
    model: { primary: "bailian/qwen3.5-plus" }
  }
}

(Your string form might still work, but primary/fallbacks is the documented format.)

Is editing raw JSON “the way to go”?

It’s fine, but the easiest/cleanest workflow is usually:

  • openclaw models set bailian/qwen3.5-plus (updates just the model)