Claude Code API

Claude Code runs on any gateway that speaks Anthropic's Messages format. To use Straitly, set ANTHROPIC_BASE_URL to https://api.straitly.ai and ANTHROPIC_AUTH_TOKEN to your Straitly key. That key replaces your claude.ai login, so you pay per token from prepaid credits and the plan's usage limits stop applying [1][2][5].

Updated

export ANTHROPIC_BASE_URL="https://api.straitly.ai"
export ANTHROPIC_AUTH_TOKEN="sk-YOUR_KEY"
claude

Mac or Linux terminal. Windows, settings.json and a one-paste setup are in the setup guide [8].

Can I use Claude Code without a Claude subscription?

Yes. Each of the last three ways skips it. Setting only the base URL is not enough: without a key, a saved claude.ai login still signs each request [1].

Way inWhat you setHow you payModels
Claude subscriptionPro, Max or UltraLog in with your claude.ai account [3]The plan, with its usage limits [1][3]Claude models
Anthropic API keyClaude ConsoleANTHROPIC_API_KEY, approved once [2][3]Per token, on your Console account [1]Claude models
Cloud providerBedrock, Agent Platform or FoundryThe provider's own variables [3]Per token, on your cloud account [1]Claude models
StraitlyAn LLM gatewayANTHROPIC_BASE_URL and ANTHROPIC_AUTH_TOKEN [2]Per token, from prepaid credits. No subscription, no minimum [5]Claude and other labs, 117 models [6]

What changes when Claude Code runs on an API key?

Your terminal, commands and projects stay the same. These five details, all from Anthropic's Claude Code docs, are worth knowing first.

Staying with Anthropic instead? See how to get a Claude API key and what each model costs on Claude API pricing.

  1. Leave /v1 off the base URL

    Claude Code adds /v1/messages itself, so the base URL is the root, https://api.straitly.ai [4][8].

  2. Use ANTHROPIC_AUTH_TOKEN

    It is sent as a bearer token and takes over at once. ANTHROPIC_API_KEY is sent as x-api-key and asks once for approval [2].

  3. The base URL alone changes nothing on the bill

    Without a key, your saved claude.ai login still signs the requests, and the plan's limits and billing apply [1].

  4. Two features need a claude.ai login

    Remote Control and voice dictation are off while a gateway key is set [2].

  5. Going back takes one step

    Claude Code keeps your claude.ai login saved. Remove the two variables and the next session uses your plan again [1].

Which models can I pick in Claude Code through Straitly?

Any Straitly model ID works after /model [8]. Here is a current pick from 8 labs, from the live catalog, that takes tool calls and has 200K tokens of context or more.

ModelReleasedContextType after /model
Claude Fable 5.2Anthropic9 Nov 20261Mclaude-fable-5-2
Claude Haiku 5.5Anthropic7 Oct 20261Mclaude-haiku-5-5
Claude Sonnet 5.5Anthropic28 Sep 20261Mclaude-sonnet-5-5
Claude Opus 5.5Anthropic22 Sep 20261Mclaude-opus-5-5
GPT-6.1 SolOpenAI29 Sep 20261.05Mgpt-6.1-sol
Gemini 4 NeonGoogle18 Nov 20261.05Mgemini-4-neon

From the live catalog on 25 November 2026 [6]. Claude models use Claude Code's dashed names [8][9]; other labs use the Straitly ID as shown [8]. Prices are on each model's page and on Pricing. Anthropic supports only Claude models through a gateway [1].

See all 117 models

What else do people ask about the Claude Code API?

Ask a question
  • Claude Code is a coding tool, not an API of its own. It calls a model API in Anthropic's Messages format: Anthropic's, a cloud provider's, or a gateway's such as Straitly. ANTHROPIC_BASE_URL picks which one, and Claude Code posts to /v1/messages on it [4].
  • No. While a gateway credential is set, requests carry it in place of your claude.ai login and the subscription's usage limits do not apply [1]. You pay Straitly per token from prepaid credits instead [5]. Your claude.ai login stays saved, so removing the two variables takes you back to your plan.
  • Through Straitly, yes: type /model followed by a Straitly model ID, like the ones in the table above. Anthropic's docs say it does not support non-Claude models through any gateway [1], so Claude models are the supported path.
  • No. Zero data retention is on by default for every account and key: prompts and completions are never written to disk or logs and never used for training. Only billing metadata is kept: timestamp, model, key, token counts, latency, status and the amount charged [7].
  • You pay per token at each model's rate, from prepaid credits. Nothing is added on top, and there is no subscription and no minimum. A failed request costs nothing [5]. Each model's current price is on Pricing and on its own page under Models.

Sources

Claude Code changes often. If something here is out of date, tell us at straitly.ai/contact.

  1. [1]Claude Code docs: other LLM gatewayscode.claude.com, checked 21 November 2026
  2. [2]Claude Code docs: connect to an LLM gatewaycode.claude.com, checked 21 November 2026
  3. [3]Claude Code docs: authenticationcode.claude.com, checked 21 November 2026
  4. [4]Claude Code docs: gateway compatibility guidecode.claude.com, checked 21 November 2026
  5. [5]Straitly pricingstraitly.ai/pricing, checked 21 November 2026
  6. [6]Straitly modelsstraitly.ai/models, checked 25 November 2026
  7. [7]Straitly data retentionstraitly.ai/docs/data-retention, checked 21 November 2026
  8. [8]Use Claude Code with the Straitly APIstraitly.ai/integrations/claude-code, checked 21 November 2026
  9. [9]Claude Code docs: model configurationcode.claude.com, checked 21 November 2026
What each source says
Claude Code docs: other LLM gateways
Any gateway with a supported API format works. A gateway credential replaces the claude.ai subscription login and its usage limits, and is billed per token. Anthropic does not support non-Claude models through a gateway.
Claude Code docs: connect to an LLM gateway
ANTHROPIC_BASE_URL plus ANTHROPIC_AUTH_TOKEN (bearer) or ANTHROPIC_API_KEY (x-api-key); Remote Control and voice dictation are off while a gateway credential is active.
Claude Code docs: authentication
Log in with a Claude Pro, Max or Ultra subscription, Claude for Teams or Enterprise, the Claude Console, or a cloud provider.
Claude Code docs: gateway compatibility guide
An Anthropic Messages gateway is set with ANTHROPIC_BASE_URL; Claude Code posts to /v1/messages on it.
Straitly pricing
Billed per token from prepaid credits. Nothing is added on top. A failed request costs nothing. No subscription and no minimum.
Straitly models
Every model on Straitly with its ID, context window, capabilities and price, from the live catalog.
Straitly data retention
Zero data retention on by default for every account and key; prompts and completions never written to disk or logs and never used for training; only billing metadata is kept.
Use Claude Code with the Straitly API
The full setup: key, environment variables, settings.json, a one-paste setup for Mac, Linux and Windows, and how to undo it.
Claude Code docs: model configuration
Claude Code names Claude models with dashes, as in /model claude-fable-5-2, and sends a typed model ID as written.

Start with one request.

Prepaid, per token, no subscription and no minimum.