# How to Configure Claude Code with a Custom API Key


When starting Claude Code, it first looks impossible to set a custom API key. You have two options:

1. Claude account with subscription - Pro, Max, Team, or Enterprise
2. Anthropic Console account - API usage billing

However, there is a hidden, third option, which is [buried deep in the documentation](https://code.claude.com/docs/en/settings#available-settings) and is usually the most-wanted authentication method by developers working for companies, because they are usually granted an Anthropic API key only, without a Console account. Here's what you need to do.

Create a file named `settings.json` in one of the following locations:

- In your home directory
  - macOS: `~/.claude/settings.json`
  - Windows: `%USERPROFILE%\.claude\settings.json`
  - Linux: `~/.claude/settings.json`
- In your project directory's root
  - `./.claude/settings.json`

Add the following content to the file:

```json title=".claude/settings.json"
{
  "apiKeyHelper": "echo <the-api-key-you-want-to-use>"
}
```

This file is compatible with macOS, Windows, and Linux.

Restart Claude Code, and you should be able to use it without being asked to log in.


---

To find navigation and other pages on this website, fetch the llms.txt file at: https://richardkovacs.dev/llms.txt