Docs/Guides/Use your own API key
Use your own API key
Get an OpenRouter or OpenAI API key, give it to your assistant on HolaClaw Desktop or HolaClaw Server, and replace it later.
- Desktop
- Server
- AI providers
- Security
HolaClaw sells no model access of its own. When your assistant uses a cloud model, it calls the provider with your API key, and the provider bills you directly for what you use. This guide gets you a key, hands it to your assistant, and shows where the key is kept and how to replace it.
Which key you need
| Provider | Desktop | Server | Where to get a key |
|---|---|---|---|
| OpenRouter | Yes | Yes | openrouter.ai/keys |
| OpenAI | No | Yes | platform.openai.com/api-keys |
| Another OpenAI-compatible service | No | Yes | the service's console |
OpenRouter is the simplest place to start: one key reaches many models from many providers. If you already pay for ChatGPT, you can use that plan instead of a key, with a sign-in rather than a key. See Choose a provider or Providers and models.
Step 1: Get a key
OpenRouter
- Sign up or sign in at openrouter.ai.
- Add credits to your account, so requests can be billed.
- Open openrouter.ai/keys and create a key. It starts with
sk-or-.
OpenAI (Server only)
- Sign in at platform.openai.com and set up billing.
- Create a key at platform.openai.com/api-keys.
Copy the key once and keep it somewhere safe, such as a password manager. Both services show it only when you create it.
Set a spending limit
Both OpenRouter and OpenAI let you cap what a key or an account can spend. Set one before you hand the key to an assistant that runs on its own.
Step 2: Give the key to your assistant
- Create a new assistant.
- Under Provider, select OpenRouter.
- Paste the key into the OpenRouter API Key field.
- Click Finish setup.
The provider is fixed once the assistant is created. An assistant created with Local or ChatGPT cannot switch to OpenRouter: create a new one.
On a new installation, holaclaw init asks for the key without echoing it:
holaclaw init --provider openrouterUse --provider openai for an OpenAI key. In the container, run it as docker exec -it holaclaw holaclaw init …. The installation guides cover the rest of init.
On an installation that already runs, store the key with holaclaw auth set. It reads the key from stdin, so it never lands in your shell history:
read -rs KEY && printf %s "$KEY" | holaclaw auth set providers.openrouter api_key; unset KEYproviders.openrouter is the name of the provider's table in config.toml. To add a provider that is not configured yet, start with the snippet in Providers and models.
Where the key is kept
The key is stored inside the assistant's virtual machine, on your Mac, in the same auth.toml file HolaClaw Server uses. The app never shows it again after you save it. Messages go from your Mac to OpenRouter and the model's provider, and nowhere else.
Every secret lives in one file, auth.toml, in the secrets directory, with mode 0600. Never put a key in config.toml or another file you edit: holaclaw check treats a literal key there as an error. See Secrets for each deployment's directory, and for reading the key from an environment variable instead.
A backup includes auth.toml only when you ask for it with --include-secrets.
Replace the key
Replace a key when you rotate it, when it leaks, or when the provider revokes it.
- Make sure the assistant is running.
- Open the assistant's Settings and find Your OpenRouter key.
- Paste the new key into Update OpenRouter key and click Save key.
Run the same auth set command with the new key, then restart the daemon:
read -rs KEY && printf %s "$KEY" | holaclaw auth set providers.openrouter api_key; unset KEYholaclaw auth list shows which secrets are stored, without their values.
After replacing it, delete the old key in the provider's console so it stops working everywhere.
Next steps
- Providers and models: pick another model on the same key.
- Configure your first local model: run without a key at all.
- Privacy and data: what reaches the provider.
Was this page helpful?
