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"
claudeMac 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 in | What you set | How you pay | Models |
|---|---|---|---|
| Claude subscriptionPro, Max or Ultra | Log in with your claude.ai account [3] | The plan, with its usage limits [1][3] | Claude models |
| Anthropic API keyClaude Console | ANTHROPIC_API_KEY, approved once [2][3] | Per token, on your Console account [1] | Claude models |
| Cloud providerBedrock, Agent Platform or Foundry | The provider's own variables [3] | Per token, on your cloud account [1] | Claude models |
| StraitlyAn LLM gateway | ANTHROPIC_BASE_URL and ANTHROPIC_AUTH_TOKEN [2] | Per token, from prepaid credits. No subscription, no minimum [5] | Claude and other labs, 117 models [6] |
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.
| Model | Released | Context | Type after /model |
|---|---|---|---|
| Claude Fable 5.2Anthropic | 9 Nov 2026 | 1M | claude-fable-5-2 |
| Claude Haiku 5.5Anthropic | 7 Oct 2026 | 1M | claude-haiku-5-5 |
| Claude Sonnet 5.5Anthropic | 28 Sep 2026 | 1M | claude-sonnet-5-5 |
| Claude Opus 5.5Anthropic | 22 Sep 2026 | 1M | claude-opus-5-5 |
| GPT-6.1 SolOpenAI | 29 Sep 2026 | 1.05M | gpt-6.1-sol |
| Gemini 4 NeonGoogle | 18 Nov 2026 | 1.05M | gemini-4-neon |
| Grok 4.7xAI | 21 Sep 2026 | 524K | grok-4.7 |
| DeepSeek V4.1 Flash 1017DeepSeek | 17 Oct 2026 | 1.05M | deepseek/deepseek-v4-1-flash-1017 |
| GLM-5.3-FlashZ.ai | 26 Aug 2026 | 1.05M | z-ai/glm-5.3-flash |
| Kimi K3Moonshot | 16 Jul 2026 | 1.05M | moonshotai/kimi-k3 |
| Qwen3.8 FlashQwen | 26 Aug 2026 | 1M | qwen/qwen3.8-flash |
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].
- 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].
Sources
Claude Code changes often. If something here is out of date, tell us at straitly.ai/contact.
- [1]Claude Code docs: other LLM gateways
- [2]Claude Code docs: connect to an LLM gateway
- [3]Claude Code docs: authentication
- [4]Claude Code docs: gateway compatibility guide
- [5]Straitly pricing
- [6]Straitly models
- [7]Straitly data retention
- [8]Use Claude Code with the Straitly API
- [9]Claude Code docs: model configuration
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.