Skip to content

About

Claude Code API cost guide: dated Crazyrouter rates, input/output/cache accounting and native Messages setup.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

3 Commits

Folders and files

Repository files navigation

Claude Code API pricing: estimate costs from current rates

Practical guides / 实操入口

Updated 2026-10-12. This guide covers Crazyrouter, an independent third-party gateway. Claude subscriptions and API credits are separate products; see Anthropic pricing for subscription terms.

Current model rates

Use the live Claude catalogue and pricing page. This snapshot is from Crazyrouter's public pricing API, default account group, USD per one million tokens:

Exact model ID Uncached input Output Cached input
claude-opus-4-8 $3.25 $16.25 $0.325
claude-opus-4-6 $3.25 $16.25 $0.325
claude-sonnet-4-6 $1.95 $9.75 $0.195

These are Crazyrouter rates, not independently verified Anthropic list prices. Cache creation, long-context tiers, account groups and other model-specific charges must be checked separately. There is no universal percentage discount.

Estimate a task

Cost = uncached input tokens × input rate / 1,000,000
     + output tokens × output rate / 1,000,000
     + cached input tokens × cache-read rate / 1,000,000
     + cache creation and other applicable charges

Example: 10,000 uncached input tokens and 2,000 output tokens with claude-opus-4-8, without other charges, cost 10,000 × 3.25 / 1,000,000 + 2,000 × 16.25 / 1,000,000 = $0.065 at these rates.

A coding task can include many calls, repeated context and tool results. Use actual usage records instead of estimating a monthly bill from output tokens alone. This is not a typical-task or annual-savings promise.

Claude Code setup

Create a key in the console. Set variables in the terminal that launches Claude Code:

export ANTHROPIC_BASE_URL="https://crazyrouter.com"
export ANTHROPIC_AUTH_TOKEN="YOUR_CRAZYROUTER_API_KEY"
export ANTHROPIC_MODEL="claude-opus-4-8"
claude

Use a clean root URL: Anthropic clients append /v1/messages. Avoid conflicting credentials from another provider. Full integration guide.

Python: Anthropic Messages

Install anthropic and set CRAZYROUTER_API_KEY locally:

import os
from anthropic import Anthropic

client = Anthropic(base_url="https://crazyrouter.com", api_key=os.environ["CRAZYROUTER_API_KEY"])
response = client.messages.create(
    model="claude-opus-4-8",
    max_tokens=64,
    messages=[{"role": "user", "content": "Reply OK"}],
)
for block in response.content:
    if block.type == "text":
        print(block.text)

The minimal Messages request returned HTTP 200 on 2026-10-12. Routing and availability can change; this does not establish performance equivalence with another provider.

Avoid common mistakes

  • Verify exact model IDs and endpoint compatibility before sending requests.
  • For HTTP 400, check JSON schema, required max_tokens, context length and unsupported parameters.
  • For 401/403, check credentials and access; for 429, inspect quota and rate limits.
  • /v1/models checks authentication and discovery; it does not generate output.
  • Trial credits and payment terms are displayed in your account; no fixed signup credit is promised here.

API documentation · Claude Code scripts

About

Claude Code API cost guide: dated Crazyrouter rates, input/output/cache accounting and native Messages setup.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages