How do I add models from other providers like OpenRouter or ZAI

OpenRouter (pay‑per‑token; many models):
{
agents: {
defaults: {
model: { primary: "openrouter/anthropic/claude-sonnet-4-5" },
models: { "openrouter/anthropic/claude-sonnet-4-5": {} },
},
},
env: { OPENROUTER_API_KEY: "sk-or-..." },
}
Z.AI (GLM models):
{
agents: {
defaults: {
model: { primary: "zai/glm-4.7" },
models: { "zai/glm-4.7": {} },
},
},
env: { ZAI_API_KEY: "..." },
}
If you reference a provider/model but the required provider key is missing, you’ll get a runtime auth error (e.g. No API key found for provider "zai").
No API key found for provider after adding a new agent
This usually means the new agent has an empty auth store. Auth is per-agent and stored in:
~/.openclaw/agents/<agentId>/agent/auth-profiles.json
Fix options:
Run openclaw agents add <id> and configure auth during the wizard.
Or copy auth-profiles.json from the main agent’s agentDir into the new agent’s agentDir.
Do not reuse agentDir across agents; it causes auth/session collisions.