ErrorAuth
OpenAI API key invalid or quota exceeded
OpenClaw uses the OpenAI API (or other LLM providers) for AI responses. If your API key is wrong, expired, or has no credits, all AI features will fail.
Symptoms
- •
Invalid API key provided in error logs - •
Error: insufficient_quota - •
AI responses fail silently or return errors - •
401 Unauthorized from api.openai.com
Causes
- •Wrong API key copied into the .env file
- •API key was revoked or expired
- •OpenAI account has no billing method or credits left
- •Using a project-scoped key that doesn't have the right permissions
Solution
Verify your API key
Go to platform.openai.com/api-keys and check that:
- The key exists and is not revoked
- It starts with
sk- - It has the correct permissions (Full Access or at least Chat Completions)
Test the key directly
curl https://api.openai.com/v1/models \
-H "Authorization: Bearer YOUR_API_KEY"
If you get a list of models, the key works. If you get a 401 or 429, the key is invalid or out of credits.
Check billing
Go to platform.openai.com/settings/organization/billing and:
- Add a payment method if you haven't
- Check your usage — you may have hit a spending limit
- Add credits if your balance is $0
Update the key in OpenClaw
Edit your .env file:
OPENAI_API_KEY=sk-your-new-key-here
Then restart:
docker compose down
docker compose up -d
Using a different LLM provider?
If you're using Anthropic, Groq, or a local model, the env variable name will be different (ANTHROPIC_API_KEY, etc.). Check the OpenClaw docs for your provider's setup.