Hero background with glowing routing plates
PLATFORM · 01 / SYSTEM · ACTIVE

Budget-bounded capability spending

Enforce hard spend policies across HTTP 402 providers. Compare live quotes in parallel and authorize atomic micro-settlements.

GitHub ↗
Neon execution chamber stage
NETWORK · ECOROUTER
VERSION · 0.1.0
SYSTEM · ACTIVE
ecorouter.execute() // deterministic pipeline
STATUS: ACTIVE
01 / PROBE 402
Parallel Probes

Pings registered capability providers concurrently for live 402 terms.

alpha:$0.0012
beta:$0.0018
02 / VALIDATE PASS
Policy Constraint

Validates that challenged fees do not exceed maximum budget cap.

maxSpend:≤ $0.0100
eligible:2 / 2
03 / SELECT BEST
Price × Quality

Scores eligible endpoints deterministically by price and quality score.

winner:alpha
latency:38ms
04 / EXECUTE 200 OK
Settlement & Data

Authorizes micro-payment on-chain and streams payload back.

settled:$0.0012
elapsed:42ms
SCALE · 1:1 REF · ECO-01
COMPATIBLE WITH HTTP 402 PROVIDERS & AGENT RUNTIMES
Model Context Protocol logo
Model Context Protocol Standard
OpenAI Swarm logo
OpenAI Swarm Framework
LangGraph logo
LangGraph Orchestrator
CrewAI logo
CrewAI Multi-Agent
ElizaOS logo
ElizaOS Autonomous
Base AgentKit logo
Base AgentKit On-Chain
Solana Agent SDK logo
Solana Agent SDK On-Chain
Stellar Soroban logo
Stellar Soroban Settlement
Firecrawl logo
Firecrawl Capability
Tavily Search logo
Tavily Search Capability
E2B Sandboxes logo
E2B Sandboxes Runtime
Model Context Protocol logo
Model Context Protocol Standard
OpenAI Swarm logo
OpenAI Swarm Framework
LangGraph logo
LangGraph Orchestrator
CrewAI logo
CrewAI Multi-Agent
ElizaOS logo
ElizaOS Autonomous
Base AgentKit logo
Base AgentKit On-Chain
Solana Agent SDK logo
Solana Agent SDK On-Chain
Stellar Soroban logo
Stellar Soroban Settlement
Firecrawl logo
Firecrawl Capability
Tavily Search logo
Tavily Search Capability
E2B Sandboxes logo
E2B Sandboxes Runtime
01 // CORE SYSTEM ARCHITECTURE

Deterministic capability routing primitives

Autonomous agents need to purchase external compute, web searches, and indexing without exposing infinite credit lines or hardcoded secrets.

Glowing curved routing canopy
PRIMITIVE 01 PARALLEL

HTTP 402 Probing

Queries registered capability endpoints simultaneously for live 402 payment requirements, verifying fees before dispatching funds.

PRIMITIVE 02 POLICY

Deterministic Spend Caps

Enforces an explicit maxSpendUsdc policy per execution. Providers quoting above the limit are rejected.

PRIMITIVE 03 LOCAL

In-Process & Idempotent

Runs directly in your application. Uses an optional executionId for safe deterministic retries.

Code terminal stage
02 // QUICKSTART | example.ts
import { EcoRouter } from "ecorouter";

// 1. Initialize router with smart account and candidate providers
const router = new EcoRouter({
  account: process.env.STELLAR_ACCOUNT,
  sessionSecret: process.env.SESSION_SECRET,
  providers: [
    { id: "tavily", capability: "web-search", endpoint: "https://api.tavily.com/x402", qualityScore: 0.95 },
    { id: "brave", capability: "web-search", endpoint: "https://api.brave.com/x402", qualityScore: 0.90 }
  ]
});

// 2. Execute capability under hard spending bounds
const result = await router.execute({
  capability: "web-search",
  input: { query: "latest autonomous agent runtime specifications" },
  policy: { maxSpendUsdc: "0.01", minimumQuality: 0.85 }
});

console.log(result.providerId, result.spentUsdc, result.data);
Simulator testbench stage backdrop
03 // INTERACTIVE CAPABILITY TESTBENCH

Simulate capability execution

Test how EcoRouter challenges endpoints, enforces maxSpendUsdc caps, and selects providers deterministically.

TESTBENCH · SIMULATOR
PROTOCOL · X402 V2
SYSTEM · READY
OUTPUT STREAM IDLE
// Select capability and click 'Execute Probe' to inspect runtime negotiation.
RATE · EXACT REF · SIM-02
FAQ luminous wave backdrop
04 // FREQUENTLY ASKED QUESTIONS

FAQ

What is EcoRouter?
An open-source TypeScript SDK for autonomous agents to discover, evaluate, and settle HTTP 402 capability fees in-process.
How does provider selection work?
When execute() is invoked, EcoRouter queries registered providers in parallel, filters out quotes exceeding your maxSpendUsdc policy, and routes to the lowest-cost endpoint.
Is there a centralized proxy or server?
No. The SDK runs completely in your application process. Your keys, policies, and queries are strictly local.
How does it protect against runaway loops?
Every execution requires an explicit spending policy. If quoted fees exceed your limit, EcoRouter rejects the call before initiating any payment.
✓ Copied to clipboard