# How to Use Claude Code API Without a Subscription: Pay-As-You-Go Setup and Cost Math > Run Claude Code locally, in VS Code, or in GitHub Actions without a Claude Pro, Max, or Ultra plan using BeatAPI pay-as-you-go billing at 50% off official rates. - Canonical HTML: https://beatapi.io/blog/claude-code-api-without-subscription - Markdown: https://beatapi.io/blog/claude-code-api-without-subscription.md - Entity: BeatAPI (https://beatapi.io) — unified capability layer for AI agents - Published: 2026-11-21 - Author: BeatAPI Team (https://beatapi.io/about) - Language: en - Category: Tutorial - Topic cluster: AI Agent & MCP Integration (Pillar Hub: https://beatapi.io/integrations) - Reading time: 11 min read - All blog posts for agents: https://beatapi.io/blog/llms.txt --- **You can run Claude Code locally in the terminal, in VS Code or JetBrains, in GitHub Actions, and through the Agent SDK without a Claude Pro ($20/month), Max ($100/month), or Ultra ($200/month) subscription.** Point Claude Code at BeatAPI's native Anthropic Messages endpoint (`POST /v1/messages`) by setting `ANTHROPIC_BASE_URL` to `https://api.beatapi.io` and `ANTHROPIC_AUTH_TOKEN` to your BeatAPI API key, then restart Claude Code. Every turn bills per token from a prepaid USD balance—with no recurring seat fee and no 5-hour or weekly subscription caps interrupting long sessions. Before switching away from a monthly plan, keep two boundaries in mind. First, **no subscription does not mean free**, and environment credentials never unlock Anthropic's hosted surfaces: Claude Code on the Web, mobile, Slack, Remote Control, and voice dictation remain locked to a claude.ai subscription login. Second, moving from a Claude subscription to API billing drops Claude Code's default main-conversation prompt cache lifetime from **1 hour to 5 minutes**, which can inflate your first week's bill if you pause between prompts without adjusting your workflow.

Quick answer

- **Two environment variables replace a Claude subscription locally:** BeatAPI exposes the native Anthropic Messages format at `POST /v1/messages` with no translation proxy required; setting `ANTHROPIC_BASE_URL=https://api.beatapi.io` (without `/v1`) and `ANTHROPIC_AUTH_TOKEN` takes precedence over any saved claude.ai subscription login. - **Half-price real-time token rates on current Claude models:** Running [Claude Sonnet 5.5](/claude-sonnet-5-5-api), [Claude Opus 5.5](/claude-opus-5-5-api), [Claude Fable 5.2](/claude-fable-5-2-api), or [Claude Haiku 5.5](/claude-haiku-5-5-api) in Claude Code through BeatAPI cuts base input, output, and cache-write rates by 50% compared with Anthropic's official API list prices (Sonnet 5.5 cache reads are $0.10 per million tokens on both; cache reads on the other three models are also 50% off on BeatAPI). - **When pay-as-you-go beats a monthly plan:** Anthropic's enterprise deployment data puts average API spend at roughly $13 per active developer day and $150–250 per month; pay-as-you-go typically wins for intermittent coding, project sprints, CI/CD automation, and overflow past subscription weekly limits, whereas heavy full-time interactive coding often favors a flat subscription. - **Local core features stay intact; hosted features stay on claude.ai:** The CLI, IDE extensions, subagents, hooks, skills, `CLAUDE.md`, checkpoints, sandboxing, and local MCP servers work identically over BeatAPI, while cloud sessions, Remote Control, `/voice`, `/schedule`, and claude.ai connectors require a subscription.

How Claude Code runs without a subscription

**Installing the Claude Code client is free and does not require a paid claude.ai plan; whichever credential Claude Code detects at startup determines whether you pay via a monthly subscription or per-token API billing.** Anthropic's [Claude Code authentication documentation](https://code.claude.com/docs/en/authentication) explicitly supports pay-as-you-go API authentication alongside Pro, Max, Ultra, Team, and Enterprise subscriptions—covering Anthropic's own Console, enterprise cloud providers (Amazon Bedrock, Google Cloud's Agent Platform, and Microsoft Foundry), and compatible LLM gateways. In practice, those subscription-free routes split along three trade-offs—token price, setup friction, and whether one balance covers the rest of your agent stack: - **Pay-as-you-go through BeatAPI (recommended for most individual developers, small teams, and CI):** BeatAPI serves Claude models natively at `POST /v1/messages`, so Claude Code connects with two environment variables and zero cloud IAM plumbing. You fund a prepaid USD wallet with no monthly commitment, pay 50% of Anthropic's real-time list rates on base input, output, and cache writes across current Claude 5.5 and 5.2 models, track spend per key via the dashboard and `GET /v1/usage`, and can optionally attach [BeatAPI's remote MCP server for Claude Code](/claude-code) to give the same agent live web search, SEO data, and social data under one balance. - **When first-party Console or cloud billing still makes sense:** Choose Anthropic Console directly if your workflow strictly requires first-party Console Analytics APIs, server-side Anthropic Web Search, or Fast Mode—noting that Anthropic's [prepaid Console credits expire one year after purchase and are non-refundable](https://support.claude.com/en/articles/8977456-how-do-i-pay-for-my-claude-api-usage). Choose Amazon Bedrock, Google Cloud's Agent Platform, or Microsoft Foundry if your organization requires existing cloud-commit billing, IAM policies, or regional data residency. - **Why unofficial non-Claude free proxies break real engineering work:** Anthropic's [LLM gateway documentation](https://code.claude.com/docs/en/llm-gateway) states that routing Claude Code to non-Claude models through a gateway is unsupported. Community proxies that rewrite requests for free tiers or local open models frequently trigger `400` schema rejections on tool definitions, fail on adaptive-thinking parameters, or strip `cache_control` markers—leaving every turn uncached. Treat those proxies as experiments rather than a production coding setup. One billing misconception catches many existing subscribers off guard: **the monthly API credits bundled with Claude Max ($100/month) and Claude Ultra ($200/month) cannot be used for Claude Code.** Anthropic's [subscriber API credit rules](https://platform.claude.com/docs/en/about-claude/api-credits-for-subscribers) restrict those monthly credits to direct Claude API calls, Managed Agents, the Agent SDK, and Console Playground—explicitly excluding Claude Code and in-app extra usage.

How to set up Claude Code with BeatAPI (CLI, VS Code, and GitHub Actions)

**To run Claude Code on BeatAPI without a subscription, install the CLI, fund a dedicated BeatAPI API key, write `ANTHROPIC_BASE_URL` and `ANTHROPIC_AUTH_TOKEN` into `~/.claude/settings.json`, and verify the active billing route with `/status`.** Storing the variables in your user-level `settings.json` is more reliable than shell exports alone because Anthropic notes that background subagents hosted by the supervisor do not reliably inherit shell-only exports. ### Step 1: Install Claude Code and check your version Install the official CLI—this binds no subscription by itself—and confirm the version. Keeping Claude Code on v2.1.251 or newer gives you built-in `Prompt cache (main)` diagnostics in `/usage` and explicit cache-TTL controls: ```bash # macOS / Linux curl -fsSL https://claude.ai/install.sh | bash # Windows PowerShell irm https://claude.ai/install.ps1 | iex # Verify installation claude --version ``` ### Step 2: Create a dedicated BeatAPI key and add balance Create a dedicated key in [BeatAPI Dashboard → API Keys](https://beatapi.io/dashboard/apikeys) and add prepaid USD balance. Keep two operational rules in mind before your first run: - **Top up before calling paid Claude models:** Free sign-up credit accounts can receive `403 forbidden` on paid models that require a funded balance. - **Use one key per machine or pipeline:** Separating keys across laptops and CI runners makes per-project spend visible in `GET /v1/usage` and lets you revoke one compromised credential without interrupting anything else. ### Step 3: Point Claude Code at BeatAPI **Persistent setup (recommended for daily work and background agents):** Create or edit `~/.claude/settings.json` on macOS/Linux (`%USERPROFILE%\.claude\settings.json` on Windows) and merge the `env` block below, then restart Claude Code: ```json { "env": { "ANTHROPIC_BASE_URL": "https://api.beatapi.io", "ANTHROPIC_AUTH_TOKEN": "", "ANTHROPIC_MODEL": "claude-sonnet-5-5", "CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1" } } ``` **Single-terminal setup (for a quick trial or temporary overflow):** If you only want to test BeatAPI for one session—or temporarily override a subscription on the same laptop—export the variables in the shell before launching `claude`: ```bash # macOS / Linux (zsh / bash) export ANTHROPIC_BASE_URL="https://api.beatapi.io" export ANTHROPIC_AUTH_TOKEN="" export ANTHROPIC_MODEL="claude-sonnet-5-5" claude # Windows PowerShell $env:ANTHROPIC_BASE_URL = "https://api.beatapi.io" $env:ANTHROPIC_AUTH_TOKEN = "" $env:ANTHROPIC_MODEL = "claude-sonnet-5-5" claude ``` Watch three details that trip up most first-time setups: 1. **Use the bare host `https://api.beatapi.io` with no `/v1` suffix.** Claude Code appends `/v1/messages` automatically; adding `/v1` produces a broken `/v1/v1/messages` request. 2. **Never place a plaintext key inside a repository's committed `.claude/settings.json`.** Keep credentials in user-level `~/.claude/settings.json` or process environment variables, and audit local allow rules using our [Claude Code privacy checklist](/blog/claude-code-privacy-checklist). 3. **Switch models inside any session with `/model`.** The same BeatAPI key accesses `claude-sonnet-5-5`, `claude-opus-5-5`, `claude-fable-5-2`, and `claude-haiku-5-5`. Full endpoint parameters and error codes are documented in the [BeatAPI Claude Code integration guide](https://docs.beatapi.io/integrations/claude-code). ### Step 4: Verify the endpoint and active billing path in 30 seconds Before running a multi-file refactor, send a 1-token `curl` probe from the same shell to confirm the base URL and `Authorization: Bearer` header work end to end: ```bash curl -sS -w '\n%{http_code}\n' -X POST "https://api.beatapi.io/v1/messages" \ -H "Authorization: Bearer $ANTHROPIC_AUTH_TOKEN" \ -H "anthropic-version: 2023-06-01" \ -H "content-type: application/json" \ -d '{"model":"claude-sonnet-5-5","max_tokens":1,"messages":[{"role":"user","content":"."}]}' ``` An HTTP `200` response whose JSON starts with `{"id":"msg_` confirms BeatAPI accepted the request. Next, launch `claude` and run `/status`. Check two lines on the **Status** tab: `Anthropic base URL` must read `https://api.beatapi.io`, and the credential line must show `ANTHROPIC_AUTH_TOKEN` rather than a `claude.ai` login method. Finally, run one tiny query (`claude "Hello"`) and verify the request appears in your [BeatAPI Dashboard](https://beatapi.io/dashboard) or via `GET /v1/usage`. ### Configuring BeatAPI in VS Code and GitHub Actions Writing `~/.claude/settings.json` covers the local CLI, but Anthropic's [gateway connection guide](https://code.claude.com/docs/en/llm-gateway-connect) documents two surface-specific requirements you must handle separately: - **VS Code extension:** The extension performs its own pre-launch credential check and ignores `~/.claude/settings.json` for that check. Open **Preferences: Open User Settings (JSON)** in VS Code and add `claudeCode.environmentVariables`: ```json { "claudeCode.environmentVariables": [ { "name": "ANTHROPIC_BASE_URL", "value": "https://api.beatapi.io" }, { "name": "ANTHROPIC_AUTH_TOKEN", "value": "" }, { "name": "ANTHROPIC_MODEL", "value": "claude-sonnet-5-5" } ] } ``` - **GitHub Actions (`anthropics/claude-code-action@v1`):** Before launching Claude Code, the action checks for `anthropic_api_key`, `CLAUDE_CODE_OAUTH_TOKEN`, or workload identity federation—it does not inspect `ANTHROPIC_AUTH_TOKEN` during that pre-flight check. For a bearer-token gateway like BeatAPI, pass the same GitHub Secret twice—once in `env.ANTHROPIC_AUTH_TOKEN` (used for the actual `Authorization: Bearer` header) and once in `with.anthropic_api_key` (to satisfy the action's launch check): ```yaml env: ANTHROPIC_BASE_URL: https://api.beatapi.io ANTHROPIC_AUTH_TOKEN: ${{ secrets.BEATAPI_API_KEY }} ANTHROPIC_MODEL: claude-sonnet-5-5 steps: - uses: anthropics/claude-code-action@v1 with: anthropic_api_key: ${{ secrets.BEATAPI_API_KEY }} ```

Pay-as-you-go API vs Claude subscriptions: same-workload cost math

**Pay-as-you-go is neither universally cheaper nor universally more expensive than a Claude subscription; the crossover depends on your monthly token volume, prompt cache hit rate, model tier, and per-token rate.** In Anthropic's [Claude Code cost management guide](https://code.claude.com/docs/en/costs), enterprise deployments average roughly **$13 per developer per active day** and **$150–250 per developer per month**, with 90% of users staying below $30 per active day at official API pricing. Because Claude Code operates as an agent loop—re-sending the system prompt, `CLAUDE.md`, and conversation history on every tool call—a single-turn uncached estimate is misleading. Prompt caching dominates real coding bills, which means an honest comparison requires all five token rates side by side. ### Current Claude model API rates: BeatAPI vs Anthropic official (USD per 1M tokens)
Model (1M context) Provider Base input Output 5m cache write 1h cache write Cache read
Claude Haiku 5.5
Prompts ≤100K tokens*
BeatAPI
Anthropic official
$0.05
$0.10
$0.25
$0.50
$0.0625
$0.125
$0.10
$0.20
$0.005
$0.01
Claude Sonnet 5.5
Balanced daily default
BeatAPI
Anthropic official
$1.00
$2.00
$5.00
$10.00
$1.25
$2.50
$2.00
$4.00
$0.10
$0.10
Claude Opus 5.5
Hard debugging & architecture
BeatAPI
Anthropic official
$2.00
$4.00
$10.00
$20.00
$2.50
$5.00
$4.00
$8.00
$0.10
$0.20
Claude Fable 5.2
Long-horizon deep reasoning
BeatAPI
Anthropic official
$4.00
$8.00
$20.00
$40.00
$5.00
$10.00
$8.00
$16.00
$0.10
$0.20
Rates reflect standard real-time global routing (excluding Batch API and Fast Mode), verified against [Anthropic's official API pricing](https://platform.claude.com/docs/en/about-claude/pricing) and the [BeatAPI public pricing catalog](/pricing) on November 21, 2026. Note two specific details: **Claude Sonnet 5.5 cache reads cost $0.10 per million tokens on both BeatAPI and Anthropic**, while all other Sonnet 5.5 line items are 50% lower on BeatAPI; and *on Claude Haiku 5.5, any single request whose total input (including cache reads and writes) exceeds 100,000 tokens steps up to the long-context tier ($0.25 input / $1.25 output / $0.025 cache read on BeatAPI vs $0.50 / $2.50 / $0.05 on Anthropic). Sonnet 5.5, Opus 5.5, and Fable 5.2 carry no long-context surcharge across their full 1M context window. ### Break-even math against Claude Pro ($20), Max ($100), and Ultra ($200) Anthropic does not publish token quotas for Pro, Max, or Ultra, so you can only compare one way: translate a realistic coding token mix into dollars, then check how many total tokens each subscription's monthly fee buys on pay-as-you-go. As an **illustrative coding mix—not measured Claude Code telemetry**—assume 85% cache reads, 5% five-minute cache writes, 8% uncached new input, and 2% output (extended thinking tokens bill at the output rate):
Model Billing route Blended cost / 1M tokens $20 (Pro price) buys $100 (Max price) buys $200 (Ultra price) buys
Claude Sonnet 5.5 BeatAPI
Anthropic official
~$0.33 ($0.3275)
$0.57
~61M tokens
~35M tokens
~305M tokens
~175M tokens
~611M tokens
~351M tokens
Claude Opus 5.5 BeatAPI
Anthropic official
$0.57
$1.14
~35M tokens
~18M tokens
~175M tokens
~88M tokens
~351M tokens
~175M tokens
Claude Fable 5.2 BeatAPI
Anthropic official
~$1.06 ($1.055)
$2.11
~19M tokens
~9.5M tokens
~95M tokens
~47M tokens
~190M tokens
~95M tokens
How to apply these crossover points to your own workload: - **Replace a subscription with BeatAPI pay-as-you-go** when your usage is intermittent, bursty around release weeks, driven by CI/CD PR automation, or shared across multiple coding tools and data APIs. On Claude Opus 5.5 under this mix, $100 on BeatAPI buys roughly the same token volume as $200 at Anthropic's official API list price—with zero fixed monthly overhead during quiet weeks. - **Pair a subscription with a BeatAPI overflow key** when you code interactively all day and rarely hit weekly caps (see our [Claude Max vs Ultra breakdown](/blog/claude-max-vs-ultra) if you are choosing between those two tiers). Keep interactive sessions on your subscription, and route CI pipelines, overnight batch jobs, or mid-week overflow to BeatAPI instead of paying Anthropic's full list price for subscription usage credits (under the Opus 5.5 mix above, 20M overflow tokens cost ~$22.80 via official usage credits vs ~$11.40 on BeatAPI).

Credential precedence, avoiding double billing, and fixing common errors

**Whenever `ANTHROPIC_AUTH_TOKEN` is present in your environment or `settings.json`, Claude Code uses it immediately—even if you are already signed in to a Claude Pro, Max, or Ultra account via `/login`.** Understanding Anthropic's credential order prevents accidental API charges when you meant to use a subscription, and explains why setting only a base URL does not turn off subscription billing.
Paper-cut diagram of Claude Code credential priority showing Gateway token routing to BeatAPI ahead of direct API keys and saved subscription login
Claude Code resolves gateway tokens and API keys ahead of saved claude.ai subscription logins. Setting ANTHROPIC_BASE_URL alone does not replace an active OAuth session.
When multiple credentials exist on the same machine, Claude Code stops at the first match in this order (except when an enterprise Claude apps gateway session is signed in, which outranks the list): 1. Cloud provider flags (`CLAUDE_CODE_USE_BEDROCK`, `CLAUDE_CODE_USE_VERTEX`, or `CLAUDE_CODE_USE_FOUNDRY`). 2. `ANTHROPIC_AUTH_TOKEN` (sent as `Authorization: Bearer`; takes effect immediately without an interactive prompt). 3. `ANTHROPIC_API_KEY` (sent as `x-api-key`; prompts once for approval in interactive mode, and applies automatically in `-p` headless runs). 4. `apiKeyHelper` script output (for dynamic vault/SSO tokens; sent in both headers and cached for 5 minutes by default). 5. `CLAUDE_CODE_OAUTH_TOKEN` (a 1-year subscription token from `claude setup-token`; ignored in `--bare` mode). 6. Anthropic profile and Workload Identity Federation credentials (`ant auth login` or Console keyless sign-in). 7. Saved claude.ai subscription OAuth credentials from `/login`. **Keep a subscription and BeatAPI cleanly separated on one laptop:** Rather than exporting and unsetting variables every morning, isolate BeatAPI inside its own configuration directory with `CLAUDE_CONFIG_DIR`: ```bash # Add to ~/.zshrc or ~/.bashrc alias claude-beat='CLAUDE_CONFIG_DIR=~/.claude-beatapi claude' ``` Put your BeatAPI `settings.json` only inside `~/.claude-beatapi/`. Running `claude` keeps your existing environment untouched; running `claude-beat` routes cleanly to BeatAPI with isolated session history and zero auth-conflict warnings. ### Common BeatAPI setup errors and fixes
Symptom / HTTP status Root cause Fix
Auth conflict or auth may not work as expected on startup A saved claude.ai login and ANTHROPIC_AUTH_TOKEN are both present in the same config directory Run /logout to stay exclusively on BeatAPI, or separate profiles with CLAUDE_CONFIG_DIR
Login screen still appears or subscription still drains after setting ANTHROPIC_BASE_URL ANTHROPIC_AUTH_TOKEN was omitted, or variables were placed in project-level .claude/settings.local.json (which loads only after folder trust) Set both ANTHROPIC_BASE_URL and ANTHROPIC_AUTH_TOKEN in shell exports or user-level ~/.claude/settings.json
401 invalid_api_key Key is mistyped, disabled, or placed in ANTHROPIC_API_KEY instead of a bearer-token variable Move the key to ANTHROPIC_AUTH_TOKEN and verify it is active in Dashboard → API Keys
402 insufficient_credits or 403 forbidden Account balance is below the request estimate, or a free-credit account called a top-up-required Claude model Top up USD balance and confirm the model ID appears in your account's GET /v1/models response
404 not_found ANTHROPIC_BASE_URL includes a stray /v1 suffix, or ANTHROPIC_MODEL has a typo Set ANTHROPIC_BASE_URL to https://api.beatapi.io and use a live model ID such as claude-sonnet-5-5
429 rate_limit_exceeded Per-minute request limit reached (pay-as-you-go removes weekly subscription caps, not rate limits) Respect the Retry-After header and check your account's current RPM tier in the dashboard

What works without a subscription—and what stays subscription-only

**Every local Claude Code workflow runs identically on pay-as-you-go API billing; what you give up are the hosted surfaces and remote features tied to a claude.ai account identity.** Anthropic's [feature availability matrix](https://code.claude.com/docs/en/feature-availability) draws a sharp line between local capabilities and subscription-bound products:
Feature group Capabilities Status on BeatAPI pay-as-you-go Practical API alternative
Core local coding CLI, VS Code & JetBrains extensions, Agent SDK, subagents, hooks, skills, CLAUDE.md, plugins, local MCP servers, checkpoints, sandboxing, workflows, OpenTelemetry Fully available None needed
Hosted claude.ai features Claude Code on the Web (cloud sessions), mobile app, Slack, Remote Control, voice dictation (/voice), cloud scheduled tasks (/schedule), claude.ai connectors, Chrome extension, Computer Use, Artifacts, /usage-credits Unavailable (environment variables and gateway tokens never override hosted surfaces) Use local /loop instead of /schedule; run automated tasks in GitHub Actions or GitLab CI; replace claude.ai connectors with local/remote MCP
Desktop & provider-dependent tools Claude Desktop, Anthropic server-side Web Search, Fast Mode, Advisor, cross-session messaging Partially restricted: Desktop requires 3P inference configuration; cross-session messaging is same-machine only; Remote Control and first-party checks disable under a custom ANTHROPIC_BASE_URL Add BeatAPI remote MCP in .mcp.json for live web search, page reading, SEO data, and social data on the same BeatAPI balance (see BeatAPI Integrations)

The hidden 5-minute prompt cache shift and five ways to control API spend

**The biggest cost surprise after leaving a Claude subscription is not the model's per-token price—it is that Claude Code drops the main conversation's default prompt cache TTL from 1 hour to 5 minutes the moment you authenticate with an API key or gateway.**
Paper-cut timeline diagram contrasting a long subscription prompt cache window against the shorter default API cache window that breaks into cold rebuilds unless extended TTL is enabled
On a Claude subscription within plan limits, the main conversation defaults to a 1-hour cache TTL. On API keys and gateways, it drops to 5 minutes unless you opt into promptCacheTtl: "1h".
Anthropic's [prompt caching documentation](https://code.claude.com/docs/en/prompt-caching) explains why this happens. Within subscription plan limits, Claude Code requests a **1-hour cache lifetime** for your main conversation, so stepping away for a 20-minute stand-up keeps your entire prefix warm. Under an API key, cloud provider, or LLM gateway, Claude Code switches the default to **5 minutes** because 5-minute cache writes bill at 1.25× base input rather than the 2× multiplier of 1-hour cache writes. If you pause for 6 minutes to review a PR or answer Slack, your next prompt misses the cache and re-caches the full conversation prefix from scratch. **When to turn 1-hour caching back on:** On Claude Code v2.1.242 or newer, if your real rhythm involves working in one long session with 10-to-50-minute breaks between turns, add `"promptCacheTtl": "1h"` to `~/.claude/settings.json` (or export `CLAUDE_CODE_PROMPT_CACHE_TTL=1h`). Anthropic's pricing math breaks even on a 1-hour cache write after **two cache reads**. Conversely, if you fire rapid back-to-back prompts with pauses under 5 minutes, keep the 5-minute default so you do not overpay on cache writes. Run `/usage` (v2.1.251+) mid-session and read the `Prompt cache (main)` line to verify your live hit percentage, miss count, and whether the cache is warm. Pair the right cache TTL with five high-leverage habits to keep BeatAPI spend lean: 1. **Run `/clear` between unrelated tasks:** Carrying 150K tokens of stale context into a fresh bug fix bills cache reads on every tool turn. Run `/rename` first if you want to return later with `/resume`, then `/clear`. 2. **Pick your model at session start instead of toggling `/model` mid-task:** Default to `claude-sonnet-5-5` for routine implementation, open a dedicated session with `claude-opus-5-5` or `claude-fable-5-2` for hard architectural work, and pin `model: haiku` for lightweight subagents. Each model maintains a separate cache, so switching models mid-conversation forces a full uncached re-read; by contrast, adjusting `/effort` mid-session preserves the cache on Sonnet 5.5, Opus 5.5, Haiku 5.5, and Fable 5.1/5.2 over API billing. 3. **Dial down `/effort` on straightforward edits:** Extended thinking tokens bill at the output rate, and Claude 5.5 and Fable models keep adaptive thinking enabled at all times. Lowering `/effort` trims unnecessary reasoning output without invalidating your cached prefix. 4. **Keep `CLAUDE.md` under 200 lines and filter verbose test logs:** `CLAUDE.md` loads into every session from turn one—move infrequent workflows (such as migration checklists) into on-demand skills, and attach a `PreToolUse` hook on `Bash` to tail `npm test` or `pytest` output to the last 100 lines. 5. **Watch multi-agent multipliers and idle background calls:** Anthropic reports that experimental Agent Teams in plan mode consume roughly **7× more tokens** than a standard session because every teammate maintains its own context window. On metered billing, keep teams small and turn off idle features like prompt suggestions or session recaps if you do not use them.

FAQ: Claude Code API without a subscription

### Can I use Claude Code without a Claude Pro, Max, or Ultra subscription? Yes. The local Claude Code CLI, VS Code and JetBrains extensions, GitHub Actions, and the Agent SDK all work without a claude.ai subscription. Setting `ANTHROPIC_BASE_URL=https://api.beatapi.io` and `ANTHROPIC_AUTH_TOKEN` routes your sessions directly through BeatAPI pay-as-you-go billing on `POST /v1/messages`. ### Is running Claude Code without a subscription free? No. Removing the monthly subscription simply switches you from a recurring plan with 5-hour and weekly usage caps to metered per-token billing. You need prepaid USD balance in your BeatAPI account; free sign-up credit accounts can receive `403 forbidden` on paid Claude models that require a top-up. ### Can I use the monthly API credits included with Claude Max ($100) or Ultra ($200) for Claude Code? No. Anthropic's subscriber API credit policy explicitly excludes Claude Code and Claude app extra usage. Those monthly credits apply only to direct Claude API calls, Managed Agents, the Agent SDK, and Console Playground. ### Why does `/usage` in Claude Code show a higher dollar estimate than my BeatAPI dashboard? Claude Code computes the dollar figure in `/usage` locally using **Anthropic's official list prices** unless an enterprise administrator deploys a managed `modelPricing` override. When routing through BeatAPI, check your [BeatAPI Dashboard](https://beatapi.io/dashboard) or `GET /v1/usage` for authoritative charges—real-time input, output, and cache-write rates for Claude Sonnet 5.5, Opus 5.5, Fable 5.2, and Haiku 5.5 settle at 50% of Anthropic's list price. ### Will configuring `ANTHROPIC_AUTH_TOKEN` still consume my Claude subscription allowance? No. In Claude Code's credential precedence, `ANTHROPIC_AUTH_TOKEN` outranks a saved `/login` claude.ai session and routes requests strictly to your BeatAPI key. Run `/status` inside Claude Code to verify that `Anthropic base URL` and `ANTHROPIC_AUTH_TOKEN` are active. ### Does this pay-as-you-go configuration work in Claude Code on the Web or the mobile app? No. Claude Code on the Web, the mobile app, Slack integration, Remote Control, and `/voice` dictation always authenticate through a claude.ai subscription. Environment API keys and gateway tokens do not override Anthropic's hosted surfaces. ### Is routing Claude Code models through BeatAPI the same as connecting BeatAPI MCP? No. Setting `ANTHROPIC_BASE_URL` switches Claude Code's model inference endpoint to BeatAPI's native `/v1/messages` API. Connecting [BeatAPI remote MCP](/claude-code) adds external tools—web search, page reading, SEO data, and social media data—without changing your reasoning model. Both share the same BeatAPI USD balance and can run independently or together.

Next step: benchmark one week of real work

Skip guesswork based on generic monthly averages. Create a dedicated key in [BeatAPI Dashboard → API Keys](https://beatapi.io/dashboard/apikeys), add a small prepaid balance, and run one representative week of coding from a single shell with `ANTHROPIC_BASE_URL="https://api.beatapi.io"`, `ANTHROPIC_AUTH_TOKEN`, and `ANTHROPIC_MODEL="claude-sonnet-5-5"` (confirming the route with `/status`). At the end of the week, compare your `/usage` prompt-cache hit rate against actual spend in `GET /v1/usage`: if the projected monthly total sits below a Pro or Max plan and you do not rely on hosted cloud surfaces, move the variables into `~/.claude/settings.json` permanently; if daily interactive usage favors a subscription, keep the BeatAPI key wired to your CI workflows and weekly-cap overflow.