# OpenClaw: 'No API key found for provider "anthropic"'

- Fix ID: AGT-12
- Exact error: `No API key found for provider "anthropic"`
- Status: Partially verified (CI: pending, no CI results exist yet)
- Last verified: 2026-10-26
- Platforms: OpenClaw
- Versions: os=Debian 13 (container); node=26.12.1; openclaw=2026.10.7 (157d8c2)
- Repro: https://stucktoshipped.com/repros/AGT-12/ (file hashes only; files are in the paid repro bundle)
- Canonical: https://stucktoshipped.com/fixes/openclaw/no-api-key-found-for-provider/

## In brief
OpenClaw can't find a credential where the gateway looks for it. The full fix shows the two places a key can live, how to make the gateway pick it up, and how to tell 'key missing' from 'key wrong'.

## Symptom
You sent your agent a message, from the dashboard, a chat app, or `openclaw agent`, and it fails with:

```
No API key found for provider "anthropic". Auth store: ~/.openclaw/agents/main/agent/openclaw-agent.sqlite
(agentDir: ...). Configure an API key (openclaw models auth paste-api-key --provider anthropic;
add --agent <id> for a non-default agent) ...
```
The same happens for `openai`, local or custom providers, and so on.

## Why it happens
OpenClaw can't find a credential for the model's provider. The usual causes:
1. **You never added one.**
2. **You exported it in your terminal** (`export ANTHROPIC_API_KEY=...`), but the gateway runs as a background service that doesn't see your shell's variables.
3. **The key was saved for a different agent.** Older versions kept credentials per agent. In our test on 2026.10.7, a newly added agent *did* use the main agent's key.

## What we could not test
- A real key and a successful reply (this is why the status is "partially verified").
- OAuth or subscription logins (`models auth login`).
- A gateway running as a systemd or launchd service (the shell-env case). Our test machine has no systemd.
- Older versions, Ollama and custom providers.

## Full fix (paid)
The step-by-step fix, commands and test record are paid content and are not in this file. Price: $4 per fix (planned launch price; checkout not open yet). SHA-256 of the full fix: 577c41960b57dfe96a29514df0a0513702ab67f4fe4ddb048293d4dcac2e9f9a. How to buy: https://stucktoshipped.com/pricing/ and https://stucktoshipped.com/products.json

## Sources
- [GitHub #63752: No API key found for provider anthropic despite valid auth-profiles.json](https://github.com/openclaw/openclaw/issues/63752)
- [GitHub #26916: auth-profiles docs show wrong field names](https://github.com/openclaw/openclaw/issues/26916)
- [GitHub #28927: ollama wrongly requires API key](https://github.com/openclaw/openclaw/issues/28927)
- [Discord archive (answeroverflow)](https://www.answeroverflow.com/m/1481639984476852401)

## How this page was made
Drafted by an AI agent and reproduced on our test machine on 2026-10-26. No warranty; test on a copy first.
