---
title: "Use your own API key"
description: "Get an OpenRouter or OpenAI API key, give it to your assistant on HolaClaw Desktop or HolaClaw Server, and replace it later."
updated: 2026-11-17
canonical: https://holaclaw.ai/docs/guides/use-your-own-api-key
---

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](https://openrouter.ai/keys) |
| **OpenAI** | No | Yes | [platform.openai.com/api-keys](https://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](/docs/desktop/choose-a-provider#chatgpt) or [Providers and models](/docs/server/providers-and-models#a-chatgpt-subscription).

## Step 1: Get a key

**OpenRouter**

1. Sign up or sign in at [openrouter.ai](https://openrouter.ai).
2. Add credits to your account, so requests can be billed.
3. Open [openrouter.ai/keys](https://openrouter.ai/keys) and create a key. It starts with `sk-or-`.

**OpenAI** (Server only)

1. Sign in at [platform.openai.com](https://platform.openai.com) and set up billing.
2. Create a key at [platform.openai.com/api-keys](https://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.

> [!TIP] 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

:::tabs
@tab Desktop
1. Create a new assistant.
2. Under **Provider**, select **OpenRouter**.
3. Paste the key into the **OpenRouter API Key** field.
4. 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.
@tab Server
On a new installation, `holaclaw init` asks for the key without echoing it:

```sh
holaclaw init --provider openrouter
```

Use `--provider openai` for an OpenAI key. In the container, run it as `docker exec -it holaclaw holaclaw init …`. The [installation guides](/docs/server/choose-a-deployment) 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:

```sh
read -rs KEY && printf %s "$KEY" | holaclaw auth set providers.openrouter api_key; unset KEY
```

`providers.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](/docs/server/providers-and-models#snippet-an-endpoint-with-an-api-key).
:::

## Where the key is kept

:::tabs
@tab Desktop
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.
@tab Server
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](/docs/server/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.

:::tabs
@tab Desktop
1. Make sure the assistant is running.
2. Open the assistant's **Settings** and find **Your OpenRouter key**.
3. Paste the new key into **Update OpenRouter key** and click **Save key**.

@tab Server
Run the same `auth set` command with the new key, then restart the daemon:

```sh
read -rs KEY && printf %s "$KEY" | holaclaw auth set providers.openrouter api_key; unset KEY
```

`holaclaw 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](/docs/server/providers-and-models): pick another model on the same key.
- [Configure your first local model](/docs/guides/configure-a-local-model): run without a key at all.
- [Privacy and data](/docs/concepts/privacy-and-data): what reaches the provider.

