How steipete-oai/clawrouter works
ClawRouter is a local LLM proxy and OpenClaw plugin for agent-driven inference. A client submits a request; the proxy can classify it and choose a capable, lower-cost model, then handle upstream inference and wallet-based x402 payment. The repository also includes context compression, session continuity, partner tools, web search, and spend and usage controls. The README documents these product capabilities, while sampled source directly confirms routing delegation, wallet setup, compression, partner definitions, and web-search requests; some proxy internals are represented only by their enclosing modules.
Main entry points: proxy.ts Local API proxy · index.ts Routing entry · auth.ts Wallet authentication · provider.ts Provider integration
Components 23
Client entry
- OpenClaw plugin
src/index.ts - Local API proxy
src/proxy.ts - CLI and setup
src/cli.ts
Request routing
- Routing entry
src/router/index.ts - Request classifier
src/router/rules.ts - Model selector
src/router/selector.ts - Session pinning
src/session.ts - Model catalog
src/models.ts
Inference and payment
- Provider integration
src/provider.ts - Upstream transport
src/upstream-proxy.ts - Wallet authentication
src/auth.ts - Payment preauthorization
src/payment-preauth.ts - Wallet storage
src/wallet.ts
Agent capabilities
- Context compression
src/compression/index.ts - Partner tools
src/partners/tools.ts - Partner catalog
src/partners/registry.ts - Web search tool
src/web-search-provider.ts - Usage and spend
src/stats.ts - Spend controls
src/spend-control.ts
Other components
- Agent or client
- Base and Solana
- Model providers
- Partner APIs
Connections 22
- Agent or client → Local API proxy: sends requests
- Agent or client → OpenClaw plugin: uses plugin
- CLI and setup → Wallet authentication: sets up wallet
- Local API proxy → Routing entry: routes requests
- Routing entry → Request classifier: classifies request
- Routing entry → Model selector: selects model
- Routing entry → Session pinning: pins session model
- Model selector → Model catalog: checks models
- Local API proxy → Provider integration: dispatches inference
- Provider integration → Upstream transport: forwards requests
- Upstream transport → Model providers: calls model APIs
- Provider integration → Wallet authentication: authenticates
- Wallet authentication → Wallet storage: loads keys
- Wallet authentication → Payment preauthorization: signs payments
- Payment preauthorization → Base and Solana: settles x402
- Local API proxy → Context compression: compresses context
- Local API proxy → Partner tools: dispatches tools
- Partner tools → Partner catalog: reads definitions
- Partner tools → Partner APIs: calls services
- Web search tool → Local API proxy: submits search
- Local API proxy → Usage and spend: records usage
- Local API proxy → Spend controls: checks spending