Claude API Access: Create a Key and Test Your First Request

Want to test one controlled Claude-compatible request? Create a BetterToken account and API key, follow the current Docs, and verify the response, token usage, and cost in Workspace before building a larger integration.

A Claude-compatible API connection needs three separate pieces: a provider account, an API key issued by that provider, and the endpoint required by the protocol. In this guide, you create a BetterToken API key. It is not an official Anthropic API key, even though the request uses the Anthropic Messages format.

1. Create your BetterToken API key

  1. Sign in to BetterToken Workspace.
  2. Create a new API key for the documented Claude-compatible key group.
  3. Copy the key once and store it in a secret manager or a local environment file that is excluded from Git.
  4. Open the current API documentation and the pricing page to confirm the current model ID and availability.

Do not paste the key into source code, a prompt, a screenshot, a support message, or a public repository. BetterToken users work through their own accounts and keys; the service does not issue an Anthropic Console key or sell access to a shared Claude.ai account.

2. Use the Anthropic-compatible endpoint

For the Anthropic SDK or Claude Code, the BetterToken Base URL is:

https://www.bettertoken.ai

Do not add /v1 to that Base URL. For a raw HTTP Messages request, the full resource path is different:

POST https://www.bettertoken.ai/v1/messages

The distinction matters: SDKs append the resource path, while a raw curl command needs the complete URL. OpenAI-compatible tools use another Base URL and should follow their own setup guide.

3. Send the first request

Set the BetterToken key in a local environment variable. The variable name follows the Anthropic SDK convention, but its value is still your BetterToken API key.

export ANTHROPIC_API_KEY="your_bettertoken_api_key"
export ANTHROPIC_BASE_URL="https://www.bettertoken.ai"
export CLAUDE_MODEL_ID="YOUR_MODEL_ID"

curl --fail-with-body "$ANTHROPIC_BASE_URL/v1/messages" \
  -H "x-api-key: $ANTHROPIC_API_KEY" \
  -H "anthropic-version: 2023-06-01" \
  -H "content-type: application/json" \
  -d "{
    \"model\": \"$CLAUDE_MODEL_ID\",
    \"max_tokens\": 64,
    \"messages\": [{\"role\": \"user\", \"content\": \"Return only the word pong.\"}]
  }"

Replace the two placeholders only in your local shell. Use an exact current model ID from BetterToken Docs or the pricing page; model names and availability can change.

4. Verify the response and usage record

A successful request returns HTTP 200 and a JSON message object. Check:

  • type is message;
  • content contains the model response;
  • usage contains input and output token counts.

The official Anthropic Messages reference defines the protocol shape. That reference does not make a BetterToken-issued key an Anthropic key; it only documents the compatible request and response format.

Next, open BetterToken Workspace and match the request by time. Confirm the model, status, input/output/cache tokens where applicable, and corresponding cost. Workspace is for usage metadata and billing records; do not assume that it stores the complete prompt or response.

5. Fix common first-request errors

  • 404 or incorrect route: raw HTTP uses /v1/messages; /messages alone is incomplete.
  • 400: check anthropic-version, content-type, model ID, max_tokens, and the messages array.
  • 401 or 403: check the BetterToken key, key group, Base URL, and accidental whitespace. Do not send the key to support.
  • 429: read the response body, respect the indicated delay, and inspect concurrent requests and current limits before retrying.
  • No Workspace record: verify that the request used the BetterToken Base URL rather than another provider left in your environment.

If another provider's values remain in the shell, clear them before starting over:

unset ANTHROPIC_API_KEY
unset ANTHROPIC_BASE_URL
unset CLAUDE_MODEL_ID

Then set the three values again from the current BetterToken setup information and send one request—not a retry loop.

BetterToken API access vs Anthropic API and Claude subscriptions

These paths are independent:

  • an official Anthropic API key comes from Anthropic Console and uses Anthropic's official endpoint and billing;
  • a BetterToken API key comes from your BetterToken account and uses BetterToken's compatible endpoint and billing;
  • a Claude subscription is a user plan and does not automatically provide API balance;
  • a shared account or shared key does not give you reliable ownership, recovery, or usage attribution.

Choose the route that matches your application, region, payment method, and account requirements. Regional access and billing options can vary, so check the current terms of each provider rather than relying on an old setup article.

Next step

After the minimal request succeeds, move the key into your application's secret store, set a finite timeout, and add bounded retries only for temporary failures. Review the current BetterToken Docs, then keep Workspace open while you test the first real integration.

Related articles