Using Claude with OpenClaw
API key or Claude CLI login, and what each one costs you
OpenClaw supports Anthropic’s Claude two ways: an API key with usage-based billing, or reuse of an existing Claude Code login through the installed executable on the same machine. They look interchangeable at onboarding and are not: one bills per token, the other draws on your subscription’s limits, and the docs are careful about who owns the login. Here is the difference, the setup for each, and the caveat that matters.
Route one: an API key
Create a key in the Anthropic console, run onboarding and choose the API key route, or pass the key on the command line, then list the provider’s models to verify. Billing is pay-as-you-go, which the docs call preferable for shared automation or predictable production spend, and an admin key additionally shows thirty days of actual provider cost in the Control UI’s usage page.
Route two: the Claude CLI login
If Claude Code is installed and logged in as the Gateway user, onboarding can choose the Claude CLI route. Agent turns then go through the installed executable; OpenClaw never reads, stores, refreshes or forwards the native login tokens, and Claude owns the login lifecycle. Consecutive turns reuse a warm subprocess, and if it ends or the Gateway restarts, the next turn resumes the persisted session. The route expects OpenClaw and the Claude login on the same host; Docker can persist a container home for it, other container installs cannot.
Claude Code owns its existing login and subscription; OpenClaw does not persist or refresh that login.
The caveat
Usage through the CLI route draws from the signed-in subscription’s limits, and the docs say plainly that Anthropic’s support articles can change that behaviour without an OpenClaw release. A subscription is a fine way to try things; it is not a budget for an always-on agent that answers at three in the morning. What OpenClaw costs has the arithmetic of what an agent actually spends.
The options onboarding shows you
- Detected access: onboarding finds an existing Claude Code login or an API key in the environment, presents the choices, and activates only the one you pick after a real completion succeeds.
- A setup token: run the token command on any machine with Claude Code, then paste it as an Anthropic setup token during onboarding, for a Gateway host that has no Claude login of its own.
- Managed credits: on a host that includes AI usage, no Anthropic account at all on day one.
On Diali
Every plan includes a monthly balance of Diali AI credits spent across the managed models, and you can bring your own Anthropic key from the vault instead. Either way the key lives in the vault, not in a config file, and the spend is visible per assistant. Hosted OpenClaw on Diali is the assistant; the AI credit calculator estimates what a month costs before you start.
- An API key bills per token and is the docs’ choice for anything unattended.
- A CLI login is your subscription’s limits, on the same host, owned by Claude.
- Either way, keep the key out of prompts and config files.
Stop reading about it, build one
Set up an agent, pick a channel, and have it working inside the app you already keep open.
