ROUTING ACTIVE
LEARNING
OPENCLAW INTEGRATION
LOCAL-FIRST PROXYYOUR KEYS · YOUR MACHINE

Cut Agent
Costs by
90%

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

$npx clawhub@latest install RelayPlane/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

100K+ 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$1.20
Debug session (80 calls)
$9.60$4.80
Feature build (200 calls)
$24.00$12.00
MONTHLY (heavy use)
$3,400$340
agent-session.log
[09:41:02] Reading codebase... → sonnet
[09:41:03] Analyzing imports... → sonnet
[09:41:04] Planning refactor... → sonnet
[09:41:06] Writing new code... → sonnet
[09:41:08] Reviewing changes... → sonnet
[09:41:09] Running tests... → sonnet
[09:41:11] Complex debug... → opus
[09:41:15] Final review... → sonnet
✓ Session complete8 calls · $0.34 (was $3.40)
90% SAVED
5
PROVIDERS
90%
AVG. SAVINGS
<1
MS ROUTING

Five Providers. One Interface.

Route between any model seamlessly

Anthropic
Claude 4.5 (Opus, Sonnet, Haiku)
OpenAI
GPT-5.2, o1, o3
Google
Gemini 2.0, 1.5
xAI
Grok-3, Grok-3-mini
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 4100
# 3. Point your agent to the proxy
export ANTHROPIC_BASE_URL=http://localhost:4100
openclaw
✓ All requests now route through RelayPlane
// OPENCLAW SKILL v2.0.0

Agent Commands

Once the skill is installed, your agent can use these commands directly.

INSTALLAdd the RelayPlane skill to OpenClaw
$npx clawhub@latest install RelayPlane/relayplane

Telemetry Control

relayplane telemetry on

Enable anonymized telemetry (for Relay Network)

relayplane telemetry off

Disable telemetry completely

relayplane telemetry status

Show current telemetry settings

Dashboard & Stats

relayplane dashboard

Open the cloud dashboard in browser

relayplane stats

Show local routing statistics

relayplane status

Show proxy status and configuration

relayplane models

List available routing models and providers

All commands work inside your OpenClaw agent session. Just ask your agent to run them.

// 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

auto

Analyzes prompt complexity, routes simple tasks to Sonnet and complex tasks to Opus. Best balance of cost and quality.

simple → sonnet
complex → opus
AGGRESSIVE

Cascade

cascade

Starts with cheapest viable model, escalates on rate limits or errors. Maximum savings with automatic fallback.

start → sonnet
# escalate on rate_limit
CONSERVATIVE

Quality Priority

quality

Routes everything to Opus. Maximum quality, no cost 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": "auto",
    "complexity": {
      "enabled": true,
      "simple": "claude-sonnet-4-6",
      "moderate": "claude-sonnet-4-6",
      "complex": "claude-opus-4-6"
    },
    "cascade": {
      "enabled": true,
      "escalateOn": "rate_limit",
      "maxEscalations": 1,
      "fallbackProvider": "ollama"
    }
  },
  "reliability": {
    "cooldowns": {
      "enabled": true,
      "allowedFails": 5,
      "windowSeconds": 120,
      "cooldownSeconds": 30
    }
  }
}

routing.mode

"auto" — Complexity-based routing (simple/moderate/complex)

"cascade" — Start cheap, escalate on rate limits or errors

"quality" — Always use the best model

cascade.escalateOn

"rate_limit" — Escalate on rate limits or errors

"error" — Escalate on API errors only

complexity routing

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

reliability.cooldowns

Auto-disable failing providers. 5 failures in 120s triggers 30s 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 4100 -v

Wrong model being used?

Check that your BASE_URL is set correctly:

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

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:4100/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 LICENSEOPTIONAL TELEMETRY