
How to get a Claude API key
You can get a Claude API key from Anthropic's Claude Console for direct API access, or create an AI Prime Tech account for access through this independent gateway. Choose your provider first: its key, billing and base URL must match. The steps below cover both routes and show how to check a gateway key before sending a first request.
Choose where to get your Claude API key
An API key identifies the account or project that pays for requests. A Claude chat login and an API key serve different purposes. If you want the chat interface or subscription features, compare Claude API access and subscriptions before buying API usage.
| Route | Where to create a key | Billing and endpoint |
|---|---|---|
| Anthropic direct | Claude Console | Anthropic account and API billing; api.anthropic.com |
| AI Prime Tech | Create an account, then open API Keys in the dashboard | Gateway credits or an eligible timed plan; aiprimetech.io |
AI Prime Tech is independently operated and is not affiliated with or endorsed by Anthropic. Use the route that fits your integration, billing and support requirements; the accounts and keys are separate.
Get a key from the official Claude Console
- Sign in to the Claude Console and select the workspace you will use.
- Review the account's API billing and usage limits. Complete any setup the Console requires for your account.
- Open API keys, create a key for your application, and store it securely when it is displayed.
- Follow Anthropic's official quickstart for direct requests. Keep the official endpoint for this route; the gateway example below uses an AI Prime Tech key.
Create an AI Prime Tech key
- Register with AI Prime Tech and complete the verification shown during signup.
- Choose prepaid API credits for usage-based billing or review the timed Claude plans. Check the current offer, eligible models and limits before paying. If you want to evaluate the service first, the trial guide shows any current welcome offer and its conditions.
- Open API Keys in the dashboard and create a key for this application. Check the selected group and any key restrictions so they match the Claude access you purchased.
- Copy the key into a local environment variable or secret manager. Use a separate key for each application so you can identify usage and replace one key without changing every integration.
Key creation and payment do not prove an integration works. First check the model catalogue with that key, then make a small request to the model you intend to use.
Verify the key and available model IDs
On macOS, Linux or WSL, set your gateway key in the current terminal. Replace the placeholder with your own key locally; keep it out of shared scripts and screenshots.
export ANTHROPIC_API_KEY="YOUR_GATEWAY_KEY"On Windows PowerShell, use this environment-variable syntax:
$env:ANTHROPIC_API_KEY = "YOUR_GATEWAY_KEY"Request the model list. This is a catalogue request; it does not generate a model response. The following command is for a Bash-compatible shell:
curl --fail-with-body --silent --show-error \
https://aiprimetech.io/v1/models \
-H "Authorization: Bearer $ANTHROPIC_API_KEY"For PowerShell:
$headers = @{ Authorization = "Bearer $env:ANTHROPIC_API_KEY" }
(Invoke-RestMethod "https://aiprimetech.io/v1/models" -Headers $headers).data | Select-Object idA successful response lists model IDs available to the key. Choose a Claude model and copy its id exactly into CLAUDE_MODEL. Model access can depend on the key's group and permissions; a catalogue response alone does not guarantee that an upstream model will complete a request.
export CLAUDE_MODEL="PASTE_A_CLAUDE_MODEL_ID_FROM_THE_RESPONSE"
# PowerShell alternative:
# $env:CLAUDE_MODEL = "PASTE_A_CLAUDE_MODEL_ID_FROM_THE_RESPONSE"Before connecting an agent, confirm the key uses the group for your chosen access. The agent setup checklist connects that check to the appropriate tool guide.
Make your first Python request
Install the Anthropic Python SDK in your project's environment, save the example as test_claude.py, and run it from the terminal where you set the key and model. This request uses your selected model and is subject to your account's billing or plan.
python -m pip install anthropicimport os
import anthropic
# Set CLAUDE_MODEL to an exact Claude model ID returned for your key.
client = anthropic.Anthropic(
api_key=os.environ["ANTHROPIC_API_KEY"],
base_url="https://aiprimetech.io",
)
message = client.messages.create(
model=os.environ["CLAUDE_MODEL"],
max_tokens=64,
messages=[{"role": "user", "content": "Reply with hello."}],
)
for block in message.content:
if block.type == "text":
print(block.text)python test_claude.pyFor this SDK, the gateway base URL is https://aiprimetech.io without /v1; the SDK constructs the Messages API path. Clients using the OpenAI-compatible format generally use https://aiprimetech.io/v1. See the Anthropic Python SDK guide or OpenAI-compatible API guide for the format your application needs.
After the response arrives, check the dashboard's request and usage details. For the CLI, continue with Claude Code API key setup; for an IDE, follow the Cursor guide.
If your Claude API key does not work
| Symptom | What to check |
|---|---|
| 401 or API_KEY_REQUIRED | Confirm the environment variable is set in this terminal and the request sends the key to its issuing provider. |
| 403 or access denied | Check the key's status, selected group, account permissions and requested model. |
| Model not found or unsupported model | Copy the exact ID from your key's model list. If it is listed but still fails, contact support with the request error and ID, without the key. |
| Insufficient balance or no eligible plan | Check the dashboard balance, plan period and the key's access group. |
| 404 or an HTML response | Check the hostname, API format and path. Do not duplicate /v1 when a client adds it itself. |
| 429, 500 or 529 | Inspect the response, reduce concurrency where needed and follow the API error guide. |
Where to find and manage your key
Open API Keys in the dashboard of the provider that issued the key. Follow its available copy, reveal and revoke controls. If you cannot retrieve a usable secret, create a replacement and revoke the old key after updating your application.
Keep keys out of source control, public issues and browser-side JavaScript. If a key is exposed, replace it and review its usage. A browser session cookie is not a substitute for an API key.
Is a Claude API key free?
Creating a key and paying for model usage are separate steps. Anthropic's current account terms are shown in its Console. On AI Prime Tech, the trial guide shows any available welcome offer; the top-up page and plans page show the ongoing paid options.
Check eligibility and the offer shown at signup. A temporary credit or trial does not provide indefinitely free usage.
Frequently asked questions
How do I get a Claude API key?
Where do I find my Claude API key?
Can I get a free Claude API key?
Does a Claude Pro or Max subscription pay for this gateway?
Which model ID should I use?
Get an API key — no Anthropic account or waitlist required.
Get your API keyAI Prime Tech is an independent API gateway. It is not affiliated with, endorsed by, or a reseller of Anthropic. Claude and related model names are trademarks of their respective owners.