TokenHot
HomeModelsConsoleDocumentationBlog
✓ English简体中文繁體中文日本語FrançaisРусскийTiếng Việt
TokenHot

One API. A model catalog. Usage-based billing.

Product

  • Models
  • Pricing
  • How It Works
  • Integration guides
  • About

Popular Models

  • gpt-6.1-terra
  • Kimi K3.1 Pro
  • gemini-4-argon
  • claude-haiku-5-5
  • DeepSeek V4.1 Flash
  • qwen3.8-flash
  • GPT Image 2.5 Flare
  • wan3.0-video-prime

Model Providers

  • OpenAI
  • Anthropic
  • Google
  • DeepSeek
  • Qwen
  • ByteDance
  • Doubao
  • MiniMax
  • Z.ai (GLM)

Resources

  • Docs
  • Blog
  • hi@tokenhot.ai
  • LLMs.txt

Trust & Support

  • Trust Center
  • Security & Data
  • Support
  • Privacy
  • Terms
  • Refund Policy

Find us on

Product HuntToolifyThere's An AI For That
© 2026 NEXORA AI PTE. LTD. · Tokenhot
HomeBlogClaude Code API Key: Choose the Right Login and Gateway Setup
API Guides

Claude Code API Key: Choose the Right Login and Gateway Setup

Separate Claude account login, Anthropic API keys, and Tokenhot gateway credentials. Configure CC Switch or a terminal session and diagnose auth conflicts.

Tokenhot Team
November 4, 20267 min read
Claude Code API Key: Choose the Right Login and Gateway Setup

A Claude Code API key setup depends on who issues your credential and where requests should go. For direct Anthropic API access, use an Anthropic Console key. For our Tokenhot gateway, use your Tokenhot key with our base URL and the bearer-token authentication field below. A Claude account login is a separate route.

This guide covers local Claude Code configuration using official documentation checked on November 3, 2026. It does not report a live Tokenhot connection test or guarantee compatibility with every model.

Choose your authentication route

Your intended route Credential and entry point What to keep distinct
Claude account Start claude and follow the official sign-in flow for your eligible account or subscription This uses account authentication; a Tokenhot key is not a Claude login
Direct Anthropic API Create a key in the Claude Console and set ANTHROPIC_API_KEY It is sent as X-Api-Key; direct API usage and your Claude subscription are separate billing routes
Tokenhot gateway Use a key from our API key console, with ANTHROPIC_BASE_URL and ANTHROPIC_AUTH_TOKEN The credential authenticates to our gateway; it does not become an Anthropic-issued key

For the official login and direct-key routes, follow Claude Code authentication. In interactive local sessions, Claude Code asks whether to use an environment API key and remembers the choice. Non-interactive -p runs use the key when present. Check /status before assuming which account will handle a request.

The rest of this page is for readers choosing Tokenhot. On an organization-managed machine, first check whether your administrator already controls the provider or login method.

Tokenhot connection settings

Setting Value
Base URL https://api.tokenhot.ai
API format for this direct setup Anthropic Messages
Credential variable ANTHROPIC_AUTH_TOKEN
Credential value Your Tokenhot API key
Model An exact model ID available to your account on an Anthropic Messages-compatible route

Use the root base URL shown above, without adding /v1 or /messages. Claude Code's Messages route calls /v1/messages beneath that base. ANTHROPIC_AUTH_TOKEN supplies the Authorization: Bearer header; ANTHROPIC_API_KEY supplies X-Api-Key. The names describe how the credential is sent, so they are not interchangeable settings. Gateway connection documentation, gateway protocol reference.

Option A: Configure CC Switch

CC Switch is a third-party configuration manager. Its current documentation describes direct provider switching as changing connection fields such as endpoint, key, and model. It is not an Anthropic endorsement of the configured service.

  1. If you need the app, use its official release page and select the package for your operating system.
  2. Back up the Claude Code settings you intend to change. User settings normally live in ~/.claude/settings.json; project and managed settings can also affect the result.
  3. Open the Claude Code page in CC Switch. Use its direct-provider workflow and add a custom provider named Tokenhot Claude.
  4. Enter the base URL and credential from the table above. Choose an Anthropic Messages-compatible setup and inspect the generated configuration before enabling it. Keep unrelated settings at their existing values.
  5. Enable the provider. Copy an Anthropic Messages-compatible model ID from our catalog, then start a fresh session with claude --model "YOUR_ANTHROPIC_MESSAGES_MODEL_ID", replacing the placeholder with that ID. Perform the checks below.

CC Switch also offers Routing and Aggregation modes. They have different behavior; selecting a tab alone is not the same as activating a mode. This guide's root-URL settings describe direct configuration. If your existing setup uses a local proxy address, inspect its routing configuration before replacing that address. CC Switch usage and provider management.

Option B: Configure a terminal session

For a session-only setup, set the two variables in the same terminal that starts Claude Code. Replace YOUR_ANTHROPIC_MESSAGES_MODEL_ID in the startup command with the exact compatible catalog ID you chose. The base URL does not select a model; --model makes the first request's selection explicit. Model selection. These examples prompt for your key rather than putting it in a command-history entry.

Bash on macOS or Linux:

export ANTHROPIC_BASE_URL="https://api.tokenhot.ai"
read -r -s -p "Tokenhot API key: " ANTHROPIC_AUTH_TOKEN
printf '\n'
export ANTHROPIC_AUTH_TOKEN
claude --model "YOUR_ANTHROPIC_MESSAGES_MODEL_ID"

PowerShell:

$env:ANTHROPIC_BASE_URL = "https://api.tokenhot.ai"
$tokenhotSecret = Read-Host "Tokenhot API key" -AsSecureString
$env:ANTHROPIC_AUTH_TOKEN = [System.Net.NetworkCredential]::new("", $tokenhotSecret).Password
Remove-Variable tokenhotSecret
claude --model "YOUR_ANTHROPIC_MESSAGES_MODEL_ID"

Shell variables apply to that terminal and programs launched from it. An editor opened from the Dock or Start menu may not inherit them. If you need persistent configuration, follow the official environment-variable guidance and choose the appropriate settings scope. Do not commit a real key into a project's settings file.

Verify the active route before doing real work

Inside Claude Code, run:

/status

For the direct Tokenhot route, check the Anthropic base URL, the active credential method, and the selected model. A switch-success message in CC Switch confirms a configuration action; it does not prove an upstream request succeeded.

Next, open a disposable project without private source and ask for a short text response without tools. A normal answer verifies that request. Follow with the streaming and tool-use behavior you actually need before moving to a production repository. See our source-code privacy guide before sending private material through a gateway.

Why your API key or login may be ignored

For an ordinary local CLI session outside a signed-in Claude apps gateway, the documented order starts with selected cloud-provider credentials, then ANTHROPIC_AUTH_TOKEN, then ANTHROPIC_API_KEY, followed by apiKeyHelper. Later OAuth-token and profile choices have more specific rules; not every saved profile overrides a working /login. A leftover bearer token can therefore take precedence over an Anthropic API key. There are exceptions: a signed-in Claude apps gateway and enforced gateway-login policies have their own behavior, and cloud sessions use subscription credentials. See the complete authentication precedence rules.

When the active route is unexpected, inspect variable names and settings locally without pasting their secret values into logs. Check your shell profile, user/project settings, CC Switch's active mode, and any administrator-managed configuration. Changing the key in one place may leave a different source active.

To return from CC Switch to official login, use its built-in official provider, restart the tool, and follow the login flow. If you configured the gateway manually, remove your gateway overrides from the scope where you added them, then verify /status again. Do not delete organization-managed settings or assume signing in automatically overrides existing credentials.

Choosing and mapping models

Use our model catalog to verify the exact model ID, account availability, and Anthropic Messages support. A model mapping changes which upstream model receives a request; it does not add capabilities to that model.

Claude Code documents model configuration through settings, command-line selection, and variables including ANTHROPIC_MODEL and the default Haiku, Sonnet, and Opus model variables. Map only the roles your setup needs, using the current model configuration reference. Do not copy a stale model ID or assume a separate “Thinking” field behaves the same across CC Switch versions.

A non-Claude model on a compatible gateway remains a third-party compatibility choice. It is not thereby an officially supported Claude model. Check tool calling, image inputs, reasoning behavior, and context limits for the actual model and client version.

Troubleshooting by symptom

Symptom First useful check
Authentication fails Confirm the intended route in /status, then the credential issuer, header field, and key validity
Claude account appears instead of Tokenhot Check whether the variables reached this process and whether managed login or another provider selection takes precedence
Model not found Compare the full requested model ID with the catalog and any active model mappings
Timeout or stalled streaming Review the exact network/request error and our streaming timeout guide
Invalid thinking signature Follow the thinking-signature troubleshooting guide
tool_result ordering error Follow the tool-result ordering guide

Keep the Claude Code and CC Switch versions, selected mode, redacted configuration, model ID, and error text together when asking for help. That makes it possible to separate a login conflict from a model or protocol failure.

Summary

Separate Claude account login, Anthropic API keys, and Tokenhot gateway credentials. Configure CC Switch or a terminal session and diagnose auth conflicts.

Back to Blog

Related Articles

Can You Send Private Source Code Through an AI API Gateway?

Can You Send Private Source Code Through an AI API Gateway?

October 28, 2026
Claude “Invalid Signature” in a Thinking Block: How to Debug It Safely

Claude “Invalid Signature” in a Thinking Block: How to Debug It Safely

October 5, 2026
Claude tool_result Ordering Errors: Fix the Messages Sequence

Claude tool_result Ordering Errors: Fix the Messages Sequence

October 5, 2026