i keep getting this message in my chat on discord and the terminal: ⚠️ Agent failed before reply: No API key found for provider "xai". Auth store: /Users/andrewcrawshaw/.openclaw/agents/main/agent/auth-profiles.json (agentDir: /Users/andrewcrawshaw/.openclaw/agents/main/agent). Configure auth for this agent (openclaw agents add <id>) or copy auth-profiles.json from the main agentDir.
Logs: openclaw logs --follow
#My openclaw randomly stopped
1 messages · Page 1 of 1 (latest)
That error is exactly “model points to xai, but no xAI creds are available for this agent.”
First, can you paste this so we confirm version/state (important for weird auth bugs):
openclaw --version
openclaw models status --agent main
openclaw status --all
Then fix based on what you want:
If you do want xAI/Grok
openclaw models auth login --provider xai
openclaw gateway restart
openclaw models status --probe-provider xai
Alternative: put XAI_API_KEY=... in ~/.openclaw/.env, then restart gateway.
If you don’t want xAI
Your default/fallback model config is still routing to xai/*.
Switch to another configured provider and remove any xai/* fallbacks.
Docs:
- FAQ (includes this exact “No API key found for provider” case): https://docs.openclaw.ai/help/faq
- xAI provider setup: https://docs.openclaw.ai/providers/xai
- Models CLI: https://docs.openclaw.ai/cli/models
If you paste the three command outputs, I can tell you the exact next command(s) for your setup.
i dont want grok, i just started using it today so it looked like it messed everything up. Help we change it. BTW here's the output:
Config : ~/.openclaw/openclaw.json
Agent dir : ~/.openclaw/agents/main/agent
Default (defaults): xai/grok-beta
Fallbacks (0) (defaults): -
Image model (defaults): -
Image fallbacks (0) (defaults): -
Aliases (1) : opus -> anthropic/claude-opus-4-6
Configured models (1): anthropic/claude-opus-4-6
Auth overview
Auth store : ~/.openclaw/agents/main/agent/auth-profiles.json
Shell env : off
Providers w/ OAuth/tokens (0): -
- anthropic effective=profiles:~/.openclaw/agents/main/agent/auth-profiles.json | profiles=2 (oauth=0, token=0, api_key=2) | anthropic:default=sk-ant-a...aJsXbgAA, anthropic:openclaw-proxy=sk-ant-o...GM0_rQAA | env=sk-ant-a...aJsXbgAA | source=env: ANTHROPIC_API_KEY
Missing auth
- xai Run
openclaw configureor set an API key env var.
is that enough info you need?
Yep — that’s enough to diagnose.
Your main agent is trying to use provider xai, but there’s no xAI credential in that agent’s auth store.
Do this:
openclaw models auth login --provider xai
openclaw gateway restart
openclaw models status --probe-provider xai
If you don’t want to use xAI, then switch your default/fallback model away from xai/* instead.
If the above still fails, paste just these two outputs and I’ll give exact next commands:
openclaw --version
openclaw models status --agent main --plain
Docs:
neither of thgose lines worked
Got it — thanks. If those commands failed, I need the exact error text from your terminal (copy/paste), otherwise we’re guessing.
Use this quick fallback flow (works across versions):
openclaw --version
openclaw status --all
openclaw onboard --auth-choice xai-api-key
openclaw gateway restart
If you don’t want xAI at all, run onboarding without xAI and pick your actual provider/model instead.
Please paste output from at least:
openclaw --version
openclaw status --all
Then I’ll give you exact next commands for your version (no guesswork).
Docs:
Config : ~/.openclaw/openclaw.json
Agent dir : ~/.openclaw/agents/main/agent
Default : xai/grok-beta
Fallbacks (0) : -
Image model : -
Image fallbacks (0): -
Aliases (1) : opus -> anthropic/claude-opus-4-6
Configured models (1): anthropic/claude-opus-4-6
Auth overview
Auth store : ~/.openclaw/agents/main/agent/auth-profiles.json
Shell env : off
Providers w/ OAuth/tokens (0): -
- anthropic effective=profiles:~/.openclaw/agents/main/agent/auth-profiles.json | profiles=2 (oauth=0, token=0, api_key=2) | anthropic:default=sk-ant-a...aJsXbgAA, anthropic:openclaw-proxy=sk-ant-o...GM0_rQAA | env=sk-ant-a...aJsXbgAA | source=env: ANTHROPIC_API_KEY
Missing auth
- xai Run
openclaw configureor set an API key env var.
OAuth/token status
- none
andrewcrawshaw@Andrews-MacBook-Pro-3 ~ % bash
openclaw --version
openclaw models status --agent main --plain
The default interactive shell is now zsh.
To update your account to use zsh, please run chsh -s /bin/zsh.
For more details, please visit https://support.apple.com/kb/HT208050.
bash-3.2$ bash
The default interactive shell is now zsh.
To update your account to use zsh, please run chsh -s /bin/zsh.
For more details, please visit https://support.apple.com/kb/HT208050.
bash-3.2$ openclaw --version
openclaw models status --agent main --plain2026.3.2
bash-3.2$ openclaw models status --agent main --plain
hello?
Yep — I’m here. Let’s do the quickest fix.
Run this:
openclaw onboard
During onboarding, choose the provider you actually want to use (if you don’t use xAI, don’t pick xAI).
Then:
openclaw gateway restart
openclaw status
If you do want xAI specifically, use:
openclaw onboard --auth-choice xai-api-key
This error is just “current model route = xai, but no xAI key in auth store.”
If any command errors, paste the exact terminal output and I’ll give the next command immediately.
will this wipe out my current conversation and work history with my old system? I just want to get zai out and opus 4.6 back in
Great question — no, this does not wipe your conversation/work history unless you run onboarding with --reset (or --reset-scope full).
So for your case, don’t reset. Just switch models:
openclaw models set opus
openclaw models fallbacks clear
openclaw gateway restart
openclaw models status --plain
That gets xAI out of the routing path and puts you back on Opus (via alias opus).
If models set opus complains about Anthropic auth, run auth first: