How to cut token costs without dropping Claude 3.7

11 min read

API bills eat up project budgets. Processing text through Claude 3.7 Sonnet at $3 per million input tokens or renting AWS H100 instances directly at $6.88 per hour makes mass generation unprofitable. Rewriting production from the familiar PyTorch and CUDA stack to JAX just to save money takes too long. Free engineering hands for such massive tasks are usually unavailable.

We will break down the pricing mechanics in the hardware market and set up hybrid routing through a single gateway to redirect routine tasks to cheap TPU chips.

Where the graphics card shortage came from and the 108 billion dollars behind it

The market long believed in a natural shortage of computing power. A Wall Street Journal investigation showed the hidden mechanics of price formation. Nvidia management forced circular financing deals with cloud providers and AI startups in the second half of 2026 under the leadership of former CEO Jensen Huang. The scheme worked directly. The chipmaker gave startups loans or invested money in them on the condition of buying Nvidia equipment. The company actively absorbed the excess of semiconductor wafers from TSMC. This helped artificially keep graphics processor prices at a consistently high level. Startups received hardware while Nvidia showed record revenue.

A graphics card bent into a perfect ring
Circular financing artificially keeps hardware prices high.

Sharp conflicts began inside the company around the scale of guaranteed deals. Jensen Huang criticized CFO Colette Kress after her appointment as interim CEO. She demanded a sharp reduction in financial obligations and the termination of the agreement with OpenAI. The contract included guarantees of 250 billion dollars to build the largest data center.

Nvidia's official financial report for the quarter ending July 26, 2026, recorded a maximum volume of credit and lease guarantees to customers totaling 108.5 billion dollars. Out of this amount, 105 billion dollars went to support the OpenAI data center campus in Ohio. Such financial injections created the illusion of endless demand for equipment. Legal consequences have not yet arrived. The US Department of Justice and the SEC have not officially charged Nvidia with cartel collusion or stock market manipulation. Inside the company, such deals are classified as standard vendor project financing.

Redirecting TSMC silicon wafers and memory chips toward data center AI accelerators caused an instant spike in consumer prices. Memory manufacturers switched their assembly lines to produce HBM chips for servers. Regular DDR5 RAM went up in price right after graphics cards. GeForce graphics cards exceeded 160 percent of the recommended retail price. The flagship RTX 5090 model became practically unavailable for open purchase. Gamers and independent researchers lost the ability to build local workstations at a reasonable price.

Market rates for renting graphics chips were artificially inflated. The annual lease of an H100 accelerator rose from $1.70 per hour in October 2025 to $2.35 in March 2026. The median on-demand price reached $2.70 by June 2026. Rates for the Blackwell B200 generation fluctuate from $5.30 to $7.05 per hour of chip operation. On the AWS platform, renting an H100 instance reaches $6.88 per hour. A typical AI startup stack generating a million tokens a day became 40 percent more expensive in just one year.

How much a million tokens cost across different vendors

The difference in hardware costs directly reflects on API prices. We collected current rates for November 2026 for popular text generation models. Vendors factor the cost of equipment depreciation into every generated token.

Anthropic logo shaped like a piggy bank with a stuck coin
Flagship models factor the depreciation of expensive clusters into the token price.
Model namePrice per 1M input tokensPrice per 1M output tokens
Claude 3.7 Sonnet$3.00$15.00
Claude Sonnet 5.5$2.00$10.00
GPT-4o-mini$0.15$0.60
Claude Haiku 5.5$0.10$0.50
Gemini 2.0 Flash$0.10$0.40

The Gemini 2.0 Flash model is 30 times cheaper than Claude 3.7 Sonnet on input tokens. The price gap on output tokens between these same models reaches 37.5 times. Calls to the lightweight OpenAI GPT-4o-mini model cost $0.15 per million input tokens and $0.60 per million output. Cached context for GPT-4o-mini costs developers $0.075.

The flagship reasoning model Claude 3.7 Sonnet in the Anthropic API costs $3.00 per million input tokens and $15.00 per million output tokens. This amount includes the mandatory generation of thinking tokens. Hitting the cache lowers the input cost to $0.30. The Claude Haiku 5.5 model is priced at $0.10 per million input and $0.50 per million output tokens for prompts up to 100,000 tokens.

The blended rate for Gemini 2.0 Flash is $0.50 per million input and million output tokens combined. This is 33 percent cheaper than the previous Gemini 1.5 Flash generation. The difference in rates is explained by data center architecture and the cost of the chips used.

The exact internal margin per token remains unknown. Neither OpenAI nor Anthropic publicly disclose their profit and loss regarding the cost price of each specific token. You cannot say exactly what share of the $15 per million Sonnet tokens goes to amortizing Nvidia clusters and what covers research or electricity bills. Cartel markup estimates are calculated by analysts through the hourly chip rental cost and throughput.

Why TPU inference costs less

Chip economics rely on power consumption and production costs. The sixth-generation TPU Trillium consumes 300W TDP. The Nvidia H100 accelerator requires 700W TDP, while the power consumption of the Blackwell B200 generation reaches 1200W. The difference provides 2.3 times higher energy efficiency per watt during continuous inference. A cluster of tens of thousands of chips saves megawatts of electricity every hour. Lower heat output reduces the cost of liquid cooling systems in data centers. Cooling infrastructure takes up to a third of the budget when building a server farm based on Blackwell.

The hourly rental of a TPU v5e in Google Cloud is $1.20 per chip on demand and $0.54 with a three-year contract. Renting a TPU v6e Trillium will cost $2.70 on demand and $1.22 with long-term reservation. Renting an AWS H100 instance costs about $6.88 per hour. Thanks to full hardware stack optimization on their own TPU accelerators, Google's unit cost for Gemini model inference dropped by 78 percent in 2025.

The full cost price of Google TPU chips for third parties is also unpublished. Google sells Gemini API tokens with a subsidized margin inside its ecosystem. The exact production cost of TPUs at TSMC factories and Google's net savings per generated token remain a commercial secret of Alphabet.

Where specialized chips lose to graphics processors

Inference on specialized ASIC chips does not automatically win in speed on every request. With single interactive queries featuring low parallelism and a batch size of 1 to 4, modern Nvidia graphics processors deliver comparable or lower time to first token. The massive TensorRT and vLLM ecosystem perfectly optimizes single calls. GPU architecture with high memory bandwidth is ideal for an instant response to a single user. Graphics processors load model weights into memory faster during frequent context switching.

TPUs provide a 50 to 70 percent price advantage only on large batches starting from 32 requests. This requires high cluster utilization and a constant stream of tokens. With a three-year reservation of TPU Trillium capacity, the cost of generating a million tokens using dense 70B models drops to $0.42. The same task on AWS H100 instances on demand costs $0.91 or $0.94. Developers of low-load chatbots might not notice the speed difference, but they will see a difference in their bills.

The creators of Claude are also moving away from the CUDA monopoly

Dependence on graphics cards hits the profit margins of AI developers themselves. There is a widespread belief that advanced labs depend exclusively on the CUDA stack. In practice, the situation is changing very quickly.

Anthropic historically trained its models on Nvidia clusters. In November 2025, the company signed the largest deal in Google Cloud history. The developers of Claude reserved hundreds of thousands of TPU Trillium chips for 2026. The agreement includes scaling capacity to a million chips by 2027.

Anthropic uses this capacity to reduce infrastructure dependence on Nvidia GPUs during inference. Scaling a commercial API solely on graphics cards proved unprofitable even for market leaders. Switching to other chips became a matter of business survival.

Hybrid routing through a single API replaces rewriting code

Moving from PyTorch and CUDA to JAX and XLA on your own requires hundreds of engineering hours. For a single company, such a step is often economically pointless. Using different SDKs for different vendors is also inconvenient. Developers have to maintain several data contracts and handle different error formats.

A minimalist funnel filters rough blocks into one perfect drop
A cheap model filters the context leaving only the final output for the expensive one.

The problem of library zoos is solved by model routing at the level of a single API gateway like AltRouter. The application sends standard JSON requests, and the router directs large contexts to the ultra-cheap Gemini Flash. Expensive GPU models are kept only for critical final output.

We can send a 50,000-token text to the Gemini 2.5 Flash model to extract facts. We pass the filtered data of 2,000 tokens to Claude Sonnet 5.5 for final formatting. Without a single gateway, a developer has to write integration with two different libraries. The code grows with extra type checks and network failure handlers for each vendor separately. Maintaining such a zoo of dependencies takes time away from the product team. In code, a manual cascade looks like a sequential call to two different APIs.

Python
from google import genai
import anthropic

gemini_client = genai.Client(api_key="YOUR_GEMINI_API_KEY")
claude_client = anthropic.Anthropic(api_key="YOUR_ANTHROPIC_API_KEY")

raw_documents = "Very long text from the knowledge base spanning 50,000 tokens..."

# Step 1: Draft processing on a cheap model
draft_response = gemini_client.models.generate_content(
    model='gemini-2.5-flash',
    contents=f"Extract only key facts and numbers:\n{raw_documents}"
)
extracted_facts = draft_response.text

# Step 2: Final output on a smart model
final_response = claude_client.messages.create(
    model="claude-sonnet-5.5",
    max_tokens=1000,
    system="Write an analytical report based on the facts.",
    messages=[
        {"role": "user", "content": extracted_facts}
    ]
)

print(final_response.content[0].text)

Looking at the price list, sending 50,000 tokens directly to Claude Sonnet 5.5 costs $0.10. Processing 50,000 tokens through Gemini 2.5 Flash costs $0.0135 at the rate of $0.27 per million. The subsequent sending of the compressed 2,000 tokens to Claude Sonnet 5.5 costs another $0.004. Total expenses amount to $0.0175.

Using Gemini 2.5 Flash for draft fact extraction lowers the cost of processing long context by 82.5 percent compared to sending it directly to Claude Sonnet 5.5. With a volume of ten thousand requests a day, the savings reach 825 dollars. The difference covers the salary of several developers for a month.

How to split traffic in a production application

Model selection depends on context size and latency requirements. Routing rules in the code help avoid overpaying for routine tasks.

Use caseBatch sizeRecommended model
Interactive chat with a user1 to 4Claude 3.7 Sonnet
Mass background log parsing32+Gemini 2.0 Flash
Complex agents with function calling1 to 4Claude Sonnet 5.5
Context filtering for RAG32+Claude Haiku 5.5

Mass background log parsing requires processing millions of lines. Sending such a volume to Claude 3.7 Sonnet will bankrupt a project in a couple of days. Gemini 2.0 Flash handles the task for pennies. Complex agents with function calling require strict logic. Here Claude Sonnet 5.5 pays off its price through a minimal hallucination rate.

Background tasks and large texts go to models with a low input token price. Flagship solutions remain for tasks with a high cost of error. Splitting the streams cuts token costs without losing the quality of the final response. Set up cascade processing once to permanently untie your project budget from the cost of renting graphics cards.