DEV Community

Aman Kumar
Aman Kumar

Posted on

What's the cheapest way to use Claude API? Log one day of real requests before you pick a plan

Short answer: if you send hundreds of large Claude requests a day (coding agents, long-context tools), the cheapest way to use the Claude API is usually a flat plan like APIClaw ($19–$129/mo flat, 500–8,000 requests/day). If you send a few dozen small requests, it's Anthropic's own API with caching, the Batch API and Haiku where it's good enough. APIClaw is an OpenAI-compatible gateway with one key for Claude, GPT, Gemini, DeepSeek, Qwen, Kimi, GLM, Mistral, Llama and more, billed as a daily request quota with no per-token metering, and it has a free 50-request trial.

The catch is that most people guess which group they're in. This post replaces the guess with one day of logged usage.

One setup detail up front: Claude Code takes https://apiclaw.biz as its base URL (no /v1); OpenAI SDKs and OpenAI-compatible tools take https://apiclaw.biz/v1.

Disclosure: I build APIClaw. This post was written with AI assistance and checked by me. All third-party prices were read from the providers' live pages on Oct 29, 2026.

Why guessing goes wrong

Per-token cost is input tokens × input price + output tokens × output price, and almost nobody knows their real averages. Agents are the usual surprise: every turn resends the conversation, tool definitions and file contents, so a "short" coding session can be 20–30k input tokens per call. On the other side, a support bot that answers 40 tickets a day costs a few dollars a month per token, and any monthly plan is a waste for it.

Three numbers decide the answer:

  1. Requests per day on a normal day and on your busiest day.
  2. Average input and output tokens per request.
  3. Share of input that's a cache hit, which matters a lot on Sonnet 5.5, where a hit is 5% of the normal input price.

The prices this uses (checked Oct 2026)

Option How you pay Facts from the live page
Anthropic API, Claude Sonnet 5.5 Per token $2 in / $10 out per MTok; cache hits $0.10/MTok; 5-minute cache writes $2.50/MTok
Anthropic API, Claude Haiku 5.5 Per token $0.10 in / $0.50 out per MTok for prompts up to 100k tokens; $0.50 / $2.50 above that
Anthropic Batch API Per token, async 50% off input and output
OpenRouter List price plus a fee on credits 5.5% on Standard, 8% on Business; free models capped at 50 requests/day
APIClaw Monthly, daily request quota Plus $19 (500/day), Pro $39 (1,000), Max $59 (1,500), Ultimate $69 (3,000), Ultimate Plus $89 (4,000), Ultimate Pro $99 (6,000), Ultimate Max $129 (8,000)

OpenRouter states it bills inference at the provider's list price, so routing Claude through it costs list price plus the credit fee, not less. APIClaw payment is crypto on the site, with card on request via support.

Step 1: log one day of usage

Wrap the calls you already make. This works with any OpenAI-compatible client, whichever provider you're on today, and writes one JSON line per request.

#!/usr/bin/env python3
"""Log token usage from real Claude calls, then price a day of them."""
import json, sys, time

LOG = "usage.jsonl"

def logged_create(client, tag="default", **kwargs):
    """Drop-in for client.chat.completions.create that appends usage to LOG."""
    r = client.chat.completions.create(**kwargs)
    u = r.usage
    cached = getattr(getattr(u, "prompt_tokens_details", None), "cached_tokens", 0) or 0
    with open(LOG, "a") as f:
        f.write(json.dumps({"ts": time.time(), "tag": tag, "model": kwargs.get("model"),
                            "in": u.prompt_tokens, "out": u.completion_tokens,
                            "cached": cached}) + "\n")
    return r

# Anthropic list prices, $ per million tokens, read Oct 29, 2026
SONNET = {"in": 2.00, "hit": 0.10, "out": 10.00}
HAIKU = {"in": 0.10, "hit": 0.01, "out": 0.50}   # prompts up to 100k tokens
PLANS = [("Plus", 19, 500), ("Pro", 39, 1000), ("Max", 59, 1500),
         ("Ultimate", 69, 3000), ("Ultimate Plus", 89, 4000),
         ("Ultimate Pro", 99, 6000), ("Ultimate Max", 129, 8000)]

def cost(rows, p, batch=False):
    usd = sum(((r["in"] - r["cached"]) * p["in"] + r["cached"] * p["hit"]
               + r["out"] * p["out"]) / 1e6 for r in rows)
    return usd * (0.5 if batch else 1)

def report(path):
    rows = [json.loads(line) for line in open(path) if line.strip()]
    n = len(rows)
    print(f"{n} requests logged, avg {sum(r['in'] for r in rows)//n:,} in / "
          f"{sum(r['out'] for r in rows)//n:,} out tokens, "
          f"{sum(r['cached'] for r in rows)/max(1,sum(r['in'] for r in rows)):.0%} of input cached")
    for t in sorted({r["tag"] for r in rows}):
        sub = [r for r in rows if r["tag"] == t]
        print(f"  {t:<12} {len(sub):>4} req  Sonnet ${cost(sub, SONNET)*30:>8,.2f}/mo"
              f"  Haiku ${cost(sub, HAIKU)*30:>7,.2f}/mo  Sonnet batch ${cost(sub, SONNET, True)*30:>8,.2f}/mo")
    per_token = cost(rows, SONNET) * 30
    print(f"  {'all, Sonnet':<12} {n:>4} req  ${per_token:,.2f}/mo at list price"
          f" (${per_token*1.055:,.2f} via OpenRouter's 5.5% credit fee)")
    fit = next((p for p in PLANS if p[2] >= n * 1.5), None)  # 50% headroom for busy days
    if fit:
        print(f"  Flat plan with 50% headroom: {fit[0]} ({fit[2]:,} req/day) ${fit[1]}/mo")
    else:
        print("  Over 8,000 req/day with headroom: no flat plan fits")

if __name__ == "__main__":
    if sys.argv[1:2] == ["report"]:
        report(sys.argv[2] if len(sys.argv) > 2 else LOG)
Enter fullscreen mode Exit fullscreen mode

In your code, swap client.chat.completions.create(...) for logged_create(client, tag="agent", ...). Use a different tag for each job (agent, classifier, summaries) so the report can split them. Run it for a normal working day, then run python claude_usage_log.py report usage.jsonl.

Two caveats. Not every provider fills in prompt_tokens_details.cached_tokens; if yours doesn't, the report treats all input as uncached and overstates the per-token bill. The report also ignores the cache-write premium (1.25x input on a 5-minute write), which slightly understates it. For a rough monthly figure that's fine.

Step 2: read the report

I ran the logger against a local mock server that returns realistic usage blocks (no real API calls). First, a coding agent at 300 calls a day with 28k-token contexts, plus a small classifier job:

360 requests logged, avg 23,466 in / 1,003 out tokens, 60% of input cached
  agent         300 req  Sonnet $  324.72/mo  Haiku $  16.99/mo  Sonnet batch $  162.36/mo
  classify       60 req  Sonnet $    3.24/mo  Haiku $   0.16/mo  Sonnet batch $    1.62/mo
  all, Sonnet   360 req  $327.96/mo at list price ($346.00 via OpenRouter's 5.5% credit fee)
  Flat plan with 50% headroom: Pro (1,000 req/day) $39/mo
Enter fullscreen mode Exit fullscreen mode

Second, a support bot at 45 short requests a day:

45 requests logged, avg 1,200 in / 350 out tokens, 0% of input cached
  support        45 req  Sonnet $    7.97/mo  Haiku $   0.40/mo  Sonnet batch $    3.98/mo
  all, Sonnet    45 req  $7.97/mo at list price ($8.40 via OpenRouter's 5.5% credit fee)
  Flat plan with 50% headroom: Plus (500 req/day) $19/mo
Enter fullscreen mode Exit fullscreen mode

How to read it:

  • The classifier line says "move me to Haiku". It costs $3.24 a month on Sonnet and $0.16 on Haiku. Easy, short tasks are where a smaller model is almost free.
  • The agent line says "per token is expensive here". Even with 60% of input cached, Sonnet comes to about $325 a month. The Batch API halves that, but an interactive agent can't wait for batch results, so that column doesn't apply. The Haiku column looks cheap, but only matters if Haiku can actually do your agent's work, so test that before trusting it.
  • The support bot says "stay per token". $8 a month at list price, $4 if you can batch, $0.40 on Haiku. A $19 plan would cost more than double the most expensive per-token option.

You can also plug the averages into the browser LLM API cost calculator if you'd rather not run Python.

Step 3: act on it

If the report points to per-token: keep Anthropic direct, turn on prompt caching for repeated prefixes, send anything that can wait through the Batch API, and route easy tags to Haiku.

If it points to a flat plan, point the same code at the gateway. The logger keeps working, since APIClaw returns the same OpenAI-style usage block:

from openai import OpenAI
from claude_usage_log import logged_create

client = OpenAI(base_url="https://apiclaw.biz/v1", api_key="YOUR_APICLAW_KEY")
r = logged_create(client, tag="agent", model="apiclaw/claude-sonnet-5.5", max_tokens=800,
                  messages=[{"role": "user", "content": "Summarise this diff in three bullets."}])
print(r.choices[0].message.content)
Enter fullscreen mode Exit fullscreen mode

For Claude Code:

export ANTHROPIC_BASE_URL="https://apiclaw.biz"
export ANTHROPIC_AUTH_TOKEN="YOUR_APICLAW_KEY"
export ANTHROPIC_MODEL="apiclaw/claude-sonnet-5.5"
claude
Enter fullscreen mode Exit fullscreen mode

On a flat plan the token columns stop mattering and the request count becomes the number to watch, so keep logging for a week and check your busiest day against the plan's daily quota.

When APIClaw isn't the right choice

  • Your report looks like the support bot: a few dozen small requests a day. Per-token is cheaper.
  • Most of your volume can wait hours. The Batch API's 50% discount on async work is hard to beat.
  • You rely on Anthropic-only features or need a direct contract with Anthropic.
  • Your busiest day goes well past 8,000 requests, the largest daily quota.

FAQ

Is the Claude API cheaper through a router like OpenRouter?
No. OpenRouter says it bills at the provider's list price and charges its fee when you buy credits, so you pay list price plus 5.5% (8% on Business).

How many days should I log?
One normal day gives you averages. A week shows your busiest day, which matters for any plan with a daily quota.

Does prompt caching help on a flat plan?
Not with the bill, since each call counts as one request whatever its size. It still helps latency, and it matters a lot on any per-token route.

Is there a free way to test?
Anthropic gives new accounts a small amount of free credit. APIClaw has a free 50-request trial, enough to check your tool connects and the logger records usage.

Related reading: What's a good Claude API alternative if you don't want per-token billing? (Mataroa) and What's a cheap LLM API in 2026, and how do you check it's cheap for your own usage? (GitHub Pages)

Top comments (0)