ROUTING ACTIVE
LEARNING
OPENCLAW INTEGRATION
100% LOCALZERO CLOUD

Cut Agent
Costs by
0%

Intelligent model routing. Haiku for simple tasks. Opus when it matters. All decisions local. All data private.

$npx clawhub@latest install relayplane
LIVE ROUTINGACTIVE
task_typecode_review
complexitylow
routed_toclaude-3-5-haiku
cost_saved92%
OPUS COST$15.00/1M
HAIKU COST$0.25/1M
// WHY THIS EXISTS

OpenClaw is Exploding

155K+ GitHub stars. The AI coding agent that's changing how developers work. One session can make hundreds of API calls — and token costs spiral fast.

A typical debugging session? 50+ Claude calls. A refactoring task? 100+ calls. Using Opus for everything means $3-10+ per task in API fees.

TYPICAL AGENT SESSION COSTS
Quick fix (20 calls)
$2.40$0.48
Debug session (80 calls)
$9.60$1.92
Feature build (200 calls)
$24.00$4.80
MONTHLY (heavy use)
$600+$120
agent-session.log
[09:41:02] Reading codebase... → haiku
[09:41:03] Analyzing imports... → haiku
[09:41:04] Planning refactor... → sonnet
[09:41:06] Writing new code... → sonnet
[09:41:08] Reviewing changes... → haiku
[09:41:09] Running tests... → haiku
[09:41:11] Complex debug... → opus
[09:41:15] Final review... → haiku
✓ Session complete8 calls · $0.34 (was $1.92)
82% SAVED
0
PROVIDERS
0%
AVG. SAVINGS
<0
MS ROUTING

Five Providers. One Interface.

Route between any model seamlessly

Anthropic
Claude 3.5 Haiku, Sonnet 4, Opus 4.5
OpenAI
GPT-4o, GPT-4o-mini, o1, o3
Google
Gemini 1.5 Flash, Gemini 1.5 Pro
xAI
Grok models
Moonshot
v1-8k to 128k
// HOW IT WORKS

L3 Proxy Architecture

01

SDK Sends Request

POST /v1/messages

Any SDK respecting BASE_URL redirects through the local proxy

02

RelayPlane Routes

→ claude-3-5-haiku

Analyzes prompt, infers task type, selects optimal model for cost/quality

03

Provider Responds

← SSE stream

Direct connection to provider. Response streams back. Outcome logged.

// QUICK START

Three Commands to Start Saving

~/projects/my-agent
# 1. Set your API keys
export ANTHROPIC_API_KEY="sk-ant-..."
export OPENAI_API_KEY="sk-..."
# 2. Start the proxy
npx @relayplane/proxy --port 3001
# 3. Point your agent to the proxy
export ANTHROPIC_BASE_URL=http://localhost:3001
openclaw
✓ All requests now route through RelayPlane
// ADAPTIVE INTELLIGENCE

Gets Smarter Over Time

RelayPlane doesn't just route — it learns from every request. Track outcomes, detect patterns, and continuously improve routing for your specific codebase.

Outcome Tracking
Records success/failure for each routing decision
Pattern Detection
Identifies what model combinations work for your code
Local Intelligence
All learning in SQLite — query your own data anytime
~/.relayplane/data.db
# View your stats
npx @relayplane/proxy stats --days 7
Routing Summary (7 days)
Total requests:1,247
Routed to Haiku:892 (71%)
Routed to Sonnet:298 (24%)
Routed to Opus:57 (5%)
Success rate:94.2%
Est. savings:$127.40
LEARNS FROM YOU
// ROUTING MODES

Choose Your Strategy

DEFAULT

Smart Routing

relayplane:auto

Infers task type from prompt, routes to optimal model. Best balance of cost and quality.

code_review → haiku
complex_analysis → sonnet
AGGRESSIVE

Cost Priority

relayplane:cost

Always routes to cheapest models. Maximum savings, upgrades on failure.

everything → haiku
# retry with sonnet if needed
CONSERVATIVE

Quality Priority

relayplane:quality

Uses best available model. Maximum quality, similar to no optimization.

everything → opus
# no downgrade
// TASK DETECTION

Automatic Classification

RelayPlane analyzes your prompts and infers task types to make optimal routing decisions.

code_generation

Writing new code

code_review

Reviewing, debugging

summarization

Condensing text

analysis

Deep reasoning

question_answering

Direct questions

data_extraction

Structured parsing

creative_writing

Stories, copy

translation

Language conversion

// CONFIGURATION

Config Reference

Config file: ~/.relayplane/config.json — hot-reloads on save.

~/.relayplane/config.json
{
  "enabled": true,
  "routing": {
    "mode": "cascade",
    "cascade": {
      "enabled": true,
      "models": [
        "claude-3-haiku-20240307",
        "claude-3-5-sonnet-20241022",
        "claude-3-opus-20240229"
      ],
      "escalateOn": "uncertainty",
      "maxEscalations": 1
    },
    "complexity": {
      "enabled": true,
      "simple": "claude-3-haiku-20240307",
      "moderate": "claude-3-5-sonnet-20241022",
      "complex": "claude-3-opus-20240229"
    }
  },
  "reliability": {
    "cooldowns": {
      "enabled": true,
      "allowedFails": 3,
      "windowSeconds": 60,
      "cooldownSeconds": 120
    }
  },
  "modelOverrides": {}
}

routing.mode

"cascade" — Try cheap models first, escalate on uncertainty

"standard" — Direct task-based routing

cascade.escalateOn

"uncertainty" — Escalate when model seems unsure

"refusal" — Escalate on refusal patterns

"error" — Escalate on API errors

complexity routing

Automatically classifies prompts as simple/moderate/complex and routes to the configured model for each tier.

reliability.cooldowns

Auto-disable failing providers. 3 failures in 60s triggers 120s cooldown.

// API REFERENCE

REST Endpoints

GET/control/status

Proxy status and current configuration

{ "enabled": true, "mode": "cascade", "modelOverrides": {} }
GET/control/stats

Aggregated statistics and routing counts

{ "totalRequests": 142, "successRate": "97.2%", "avgLatencyMs": 1203, "modelCounts": {...} }
POST/control/enable

Enable routing (returns { enabled: true })

{ "enabled": true }
POST/control/disable

Disable routing — passthrough mode

{ "enabled": false }
POST/control/config

Update config (merges with existing, hot-reload)

{ "ok": true, "config": {...} }

Proxy Endpoints

POST /v1/messages

Native Anthropic API — for Claude Code and direct Claude integrations

POST /v1/chat/completions

OpenAI-compatible API — works with any OpenAI SDK

// TROUBLESHOOTING

Common Issues

Proxy not running?

Start it with verbose mode to see what's happening:

npx @relayplane/proxy --port 3001 -v

Wrong model being used?

Check that your BASE_URL is set correctly:

echo $ANTHROPIC_BASE_URL  # Should be http://localhost:3001

Want to bypass proxy temporarily?

Unset the BASE_URL or add the bypass header:

unset ANTHROPIC_BASE_URL
# Or use header: X-RelayPlane-Bypass: true

How do I know routing is working?

Check the stats endpoint or look at proxy logs:

curl http://localhost:3001/control/stats

Getting 401 Unauthorized?

Make sure your API key is set:

export ANTHROPIC_API_KEY="sk-ant-..."

Start Saving Today

No sign-up. No cloud dependency. Just install and run.

100% OPEN SOURCEMIT LICENSEZERO TELEMETRY