How to Get a Claude API Key: Two Different Paths
If you want to call Claude from your own code, you need an API key, and there are two genuinely different ways to get one. The first is signing up for the Anthropic Console, adding billing, and generating a key tied to pay-as-you-go credits. The second is using a tool like SubToAPI that turns a Claude subscription you already pay for (Pro, Max, or Team) into an HTTPS API key without setting up a separate billing account.
Which path makes sense depends on what you're optimizing for: raw access to every model and feature the moment it ships, or reusing a subscription you already have so you don't pay for API usage twice. Below is how each one actually works.
Option 1: Get a Claude API Key from the Anthropic Console
This is the official route and the one most documentation assumes you're taking.
- Go to the Anthropic Console and create an account (or sign in with an existing one).
- Add a payment method under billing — the API is metered per token, separate from any Claude.ai subscription you might have.
- Open the API Keys section and click Create Key. Give it a name so you can identify it later if you rotate keys.
- Copy the key immediately. Anthropic shows it once; if you lose it, you'll need to generate a new one.
- Store it somewhere safe — an environment variable, a secrets manager, or your CI/CD provider's encrypted variables. Never commit it to a repository.
A basic call looks like this:
curl https://api.anthropic.com/v1/messages \
-H "x-api-key: $ANTHROPIC_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-H "content-type: application/json" \
-d '{
"model": "claude-3-5-sonnet-20241022",
"max_tokens": 1024,
"messages": [{"role": "user", "content": "Explain quantum tunneling in two sentences."}]
}'
This works well if you want direct, first-party access with no intermediary, full control over rate limits and model availability, and you're comfortable managing a separate billing relationship from your personal or team Claude subscription.
The tradeoff is that API usage is billed independently. If you or your team already pay €20–€200/month for Claude Pro, Max, or Team, the console key adds a second, usage-based bill on top of that.
Option 2: Turn Your Existing Claude Subscription into an API Key
If you (or your team) already have a Claude subscription and just want programmatic access without opening a second billing account, SubToAPI gives you an application API key — formatted like sub_live_... — that talks to Claude on top of the access you're already paying for.
The setup is short:
- Sign up at /signup and connect the Claude account tied to your subscription.
- Generate an application key from your dashboard. Keys start with
sub_live_so they're easy to distinguish from other secrets in your codebase. - Call the SubToAPI endpoint the same way you'd call any Messages-style API:
curl https://api.subtoapi.app/v1/messages \
-H "Authorization: Bearer $SUBTOAPI_KEY" \
-H "content-type: application/json" \
-d '{
"model": "claude-3-5-sonnet-20241022",
"max_tokens": 1024,
"messages": [{"role": "user", "content": "Summarize this changelog in three bullet points."}]
}'
Or in JavaScript:
const res = await fetch("https://api.subtoapi.app/v1/messages", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.SUBTOAPI_KEY}`,
"content-type": "application/json",
},
body: JSON.stringify({
model: "claude-3-5-sonnet-20241022",
max_tokens: 1024,
messages: [{ role: "user", content: "Summarize this changelog." }],
}),
});
const data = await res.json();
Streaming, tool use, and usage metadata work the same way you'd expect from a Messages-compatible API — see /docs/streaming and /docs/tools for the request shapes. The full request/response reference is at /docs/messages, and /docs/quickstart walks through the first call end to end.
This path makes sense if you already have a Claude subscription and don't want a second metered bill, you're building for a small team and want per-seat API keys with usage visibility in one dashboard instead of juggling console + subscription accounts, or you want to prototype quickly without setting up separate API billing first. Plans start at Solo €9, with Team (€19/seat) and Scale (€49/seat) tiers for multi-key setups — details are on /pricing. New accounts get a free trial so you can test the key generation and request flow before committing.
Picking Between the Two
Neither option is strictly better — they solve different problems. If you have no existing Claude subscription and just want direct API access, the Anthropic Console is the right first stop. If you're already paying for Claude and want to avoid a second bill, or you need multiple team members each holding their own scoped key without setting up separate console accounts, generating a key through SubToAPI is the faster path.
Either way, treat the key like any other production secret: keep it out of version control, rotate it if it's ever exposed, and scope separate keys per environment (development, staging, production) so a leak in one place doesn't compromise everything.
questions
Do I need a credit card to get a Claude API key? Through the Anthropic Console, yes — API usage is billed per token and requires a payment method on file before you can make live calls. Through SubToAPI, you sign up at /signup and start with a free trial before choosing a paid plan.
Can I use one Claude API key across multiple apps? Yes, but it's better practice to generate separate keys per app or environment. That way you can track usage and revoke access individually if one integration is compromised or deprecated.
What's the difference between a Claude API key and a SubToAPI key? A Claude API key (from the Anthropic Console) is billed per token against its own account. A SubToAPI key (sub_live_...) routes requests through your existing Claude subscription, so you're not paying for API usage separately — see /docs for how requests are authenticated and billed.