Richard Kovacs
  • Home
  • Projects
  • Media
  • Blog
  • Snippets
  • Quiz
Richard Kovacs

Software engineer, indie hacker, speaker.

Find me at

X (Formerly Twitter)LinkedInThreads

© 2026 Richard Kovacs. All rights reserved.

Back to all snippets

How to Configure Claude Code with a Custom API Key

R
Richard Kovacs
Jan 9, 20261 min read
How to Configure Claude Code with a Custom API Key cover image

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 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:

.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.