I use my own API key in private projects, and it seems to work like this:

# .env file
ANTHROPIC_API_KEY=sk-...

In the project:

# .claude/settings.json
{
  "apiKeyHelper": "source .env && echo $ANTHROPIC_API_KEY"
}

Then invoke claude in inside the project root and verify with /status command:

Claude Code v1.0.85
  L Session ID: 69...
...
 Account
  L Auth Token: apiKeyHelper
  L API Key: apiKeyHelper

Source: https://github.com/anthropics/claude-code/issues/441#issuecomment-3207226042

If someone get this error: Error getting API key from apiKeyHelper (in settings or ~/.claude.json): /bin/sh: 1: source: not found

That error comes from the fact that your shell (likely /bin/sh) doesn’t recognize the source command — it’s a Bash built-in, not POSIX-standard.

Here's the fix (Force bash):

{ "apiKeyHelper": "bash -c 'source .env && echo $ANTHROPIC_API_KEY'" }

Never teach people to put a secret key in a non-popular env var convention file. Always put it in the popular environment variable file.

Answer from ImBIOS on Stack Overflow
🌐
Claude
docs.claude.com › en › api › admin-api › apikeys › get-api-key
Get API Key - Claude Docs
{ "created_at": "2024-10-30T23:58:27.427722Z", "created_by": { "id": "user_01WCz1FkmYMm4gnmykNKUu3Q", "type": "user" }, "id": "apikey_01Rj2N8SVvo6BePZj99NhmiT", "name": "Developer Key", "partial_key_hint": "sk-ant-api03-R2D...igAA", "status": "active", "type": "api_key", "workspace_id": "wrkspc_01JwQvzr7rXLA5AGx3HKfFUJ" } ... curl "https://api.anthropic.com/v1/organizations/api_keys/apikey_01Rj2N8SVvo6BePZj99NhmiT" \ --header "anthropic-version: 2023-06-01" \ --header "content-type: application/json" \ --header "x-api-key: $ANTHROPIC_ADMIN_KEY"
🌐
Apideck
apideck.com › blog › how-to-get-your-claude-anthropic-api-key
How to Get Your Claude (Anthropic) API Key
Configure model access: Specify which Claude models this key can access (Claude 3 Opus, Claude 3 Sonnet, etc.) Critical Security Notice: Your API key will only be displayed once. Copy it immediately and store it in a secure location.
🌐
Alexcodes
alexcodes.app › docs › keys › adding-claude-anthropic-api-key
Adding your API Key for Claude (Anthropic) - Alex Sidebar
To use Claude’s models (such as Claude 3.5 Sonnet and Claude 3.7 Sonnet) in Xcode with Alex Sidebar without paying a subscription for Alex, you’ll need an Anthropic API key.
🌐
Nightfall AI
nightfall.ai › ai-security-101 › anthropic-claude-api-key
Anthropic Claude API Key: The Essential Guide | Nightfall AI Security 101
The header should be named "Authorization" and the value should be "Bearer " followed by your API key. Anthropic Claude API keys are sensitive information and should be treated with care.
🌐
Anthropic
docs.anthropic.com › en › docs › get-started
Get started with Claude - Claude Docs
Learn common patterns for the Messages API. ... Explore Claude's advanced features and capabilities. ... Discover Anthropic client libraries.
🌐
Anthropic
anthropic.com › learn › build-with-claude
Anthropic Academy: Claude API Development Guide
Set up your developer account and generate API keys on the Anthropic Console. Use our quickstart guide to make your first API call · Get started with Claude Code with npm install -g @anthropic-ai/claude-code
🌐
Claude
support.claude.com › en › articles › 12304248-managing-api-key-environment-variables-in-claude-code
Managing API Key Environment Variables in Claude Code | Claude Help Center
To verify if an API key is set as an environment variable, run /status in Claude Code. This will show you which authentication method is currently active. To check your environment variable directly, run one of these commands in a terminal (outside of Claude Code): ... For zsh (default on macOS): bash # Add to shell config file echo 'export ANTHROPIC_API_KEY="your-api-key-here"' >> ~/.zshrc # Apply changes source ~/.zshrc For bash: bash # Add to shell config file echo 'export ANTHROPIC_API_KEY="your-api-key-here"' >> ~/.bash_profile # Apply changes source ~/.bash_profile
Find elsewhere
🌐
Reddit
reddit.com › r/claudeai › do i need to pay for both claude and anthropic to use the api key?
r/ClaudeAI on Reddit: Do I need to pay for both Claude and Anthropic to use the API key?
October 30, 2024 -

I just paid for the Pro version of Claude. Downloaded Cursor and when I went to add the 'API key', it seems like I also need to pay for Anthropic?

I am a little confused. First time doing the Cursor IDE setup. I am a Rider dev.

I want to be able to use Cursor without any limitations. Not bragging but money is not a concern. I make enough as a Software Consultant to afford those memberships.

Also, I heard about bolt.new or something along those lines? I checked it out but it seems towards opinionated out-of-the-box frontend applications.

Any advice?

Thanks!!!

🌐
Zapier
zapier.com › productivity › app tips
Claude API: How to get a key and use the API
July 8, 2024 - You have credits and an API key: you're ready to call Claude. To help you visualize how this works, I'm going to use Postman—an API design platform—to ask for a text generation task. You can use code, an ... After logging in to the dashboard, on the Send an API Request tab, click the New Request button. Anthropic ...
🌐
Anthropic
docs.anthropic.com › claude › reference › getting-started-with-the-api
API Overview - Claude Docs
You can use the Workbench to try out the API in the browser and then generate API keys in Account Settings. Use workspaces to segment your API keys and control spend by use case. Anthropic provides official SDKs that simplify API integration by handling authentication, request formatting, error ...
🌐
Reddit
reddit.com › r/claudeai › claude code with api key?
r/ClaudeAI on Reddit: Claude Code with API key?
April 11, 2025 -

I'm a bit confused about how claude code work for payment. I've been logging in with my personal account and paying for credits but now I have an API key from my employer which I'd like to use. I also have a Claude Desktop subscription from my employer, but when I log in with that for Claude Code I'm still prompted to pay for my own credits and I don't see how to enter my API key.

I must be misunderstanding something - does anyone have any tips?

🌐
Obot
obot.ai › home › learning center › anthropic claude api: a practical guide
Anthropic Claude API: A Practical Guide | Obot AI
October 7, 2024 - ... import anthropic # Initialize the Claude client client = anthropic.Anthropic() # Send a basic message to Claude message = client.messages.create( model="claude-3-5-sonnet-20240620", max_tokens=1024, messages=[ {"role": "user", "content": "Hey, Claude"} ], ) # Print the response ...
🌐
Social Intents
help.socialintents.com › social intents knowledge base › ai chatbots › how to find your anthropic claude api key
How to Find Your Anthropic Claude API Key - Social Intents Knowledge Base
In this article, we're going to show you how to easily generate an Anthropic Claude API Key to quickly integrate the Claude AI models into your projects and applications.
🌐
Claude API Reference
platform.claude.com › docs › en › api › admin › api_keys › retrieve
Get Api Key - Claude API Reference
ID of the Workspace associated with the API key, or null if the API key belongs to the default Workspace. ... curl https://api.anthropic.com/v1/organizations/api_keys/$API_KEY_ID \ -H "X-Api-Key: $ANTHROPIC_ADMIN_API_KEY"
🌐
GitHub
github.com › anthropics › claude-code › issues › 441
How can I use my API key without signing in? · Issue #441 · anthropics/claude-code
March 11, 2025 - Or how can I use a separate user id/password to API key? I have an API key and I have a user account but Claude Code seems to require them to be connected in some way. I want to configure them inde...
Published   Mar 11, 2025