⚙️ Under the hood

How RouteHP decides which model to use

Every query that passes through RouteHP is scored, classified, and routed in under 1 millisecond. Here's exactly how it works.

The routing flow

From query to response in 4 steps

RouteHP sits invisibly between your app and Anthropic. Your code doesn't change — we just intercept each request and make a smarter decision about which model handles it.

01
📨
Query received
Your app sends a query to RouteHP exactly as it would to Anthropic. Same format, same headers, same everything.
0ms
02
🧠
Complexity scored
Our classifier reads the query and scores its complexity from 0.0 (trivial) to 1.0 (highly complex) using multiple signals.
< 1ms
03
Model selected
Based on the score, the query is routed to the cheapest model that can handle it well — Haiku, Sonnet, or Opus.
< 1ms
04
Response returned
The response comes back in the standard Anthropic format, plus a routehp block showing the model used and saving.
~300ms
The classifier

How we score query complexity

Our classifier analyses multiple signals in each query to produce a complexity score. The higher the score, the more powerful the model we route to.

📏 Length signals

Short queries (under 10 words) → lower score
Medium queries (10–100 words) → neutral
Long queries (100+ words) → higher score
Example: "What is 2+2?" scores low. "Analyse this 50-page contract for liability clauses" scores high.

🔑 Keyword signals

Complex: analyse, evaluate, implement, legal, medical, financial
Simple: summarise, define, translate, what is, hello
Code blocks in the query → higher score
Example: "Define REST API" scores low. "Implement a distributed rate limiter in Python" scores high.

🏗️ Structure signals

Multiple questions in one query → higher score
Long conversation history → higher score
Single short question → lower score
Example: A query with 3 sub-questions scores higher than a single direct question of the same length.

📊 Final score

0.0 – 0.35 → Fast tier (Haiku)
0.35 – 0.65 → Balanced tier (Sonnet)
0.65 – 1.0 → Powerful tier (Opus)
Key insight: Most real-world workloads are 60–70% simple queries. RouteHP captures that saving automatically.
The three tiers

Which model gets used for what

RouteHP routes across three Anthropic model tiers. Each tier is matched to the right type of query — so you never pay for more than you need.

Fast tier
Claude Haiku
Complexity score: 0.0 – 0.35
Simple questions and lookups
Greetings and conversational replies
Short summaries
Translations
Basic definitions
95% cheaper than Opus
Balanced tier
Claude Sonnet
Complexity score: 0.35 – 0.65
Drafting emails and documents
Explaining technical concepts
Moderate-length analysis
Product descriptions
Multi-step instructions
80% cheaper than Opus
Powerful tier
Claude Opus
Complexity score: 0.65 – 1.0
Legal and contract analysis
Complex code implementation
Financial modelling
Long-form research
Multi-document reasoning
Full Opus capability
The response

What you get back

Every response from RouteHP is a standard Anthropic response — your existing code works unchanged. We add a routehp block showing exactly what happened and what you saved.

Standard response (unchanged)
{
  "id": "msg_abc123",
  "type": "message",
  "role": "assistant",
  "content": [{
    "type": "text",
    "text": "2 + 2 = 4"
  }],
  "model": "claude-haiku-4-5",
  "usage": {
    "input_tokens": 14,
    "output_tokens": 13
  }
}
RouteHP block (added by us)
{
  "routehp": {
    "original_model": "claude-opus-4-6",
    "chosen_model": "claude-haiku-4-5",
    "tier": "fast",
    "complexity_score": 0.20,
    "complexity_reason": "short query; simple keywords",
    "cost_actual_usd": 0.000063,
    "cost_original_usd": 0.001185,
    "saving_pct": 94.7,
    "latency_ms": 1448
  }
}
Data and privacy

What we see and what we don't

We take data privacy seriously. Here's exactly what RouteHP does and doesn't access.

👁️

What we read

The first 80 characters of each query to score its complexity. This is the minimum needed for routing. We do not store full query content.

🔑

Your API keys

Your Anthropic key is passed through in your request headers and used to call the model. We never store it. Your billing relationship with Anthropic stays direct.

🌍

Data location

All data is stored in West Europe (London). RouteHP is UK/EU native and designed for GDPR compliance from day one. DPA available on request.

Ready to start saving?

Sign up free and your developer can have RouteHP running in under 10 minutes.

Get started free →