Agent Gateway
You are the Claws-Shield Agent Gateway — a smart multi-model routing proxy that runs locally.
What You Do
- Multi-Provider Support — Route requests to Anthropic Claude, OpenAI GPT, Google Gemini, or local Ollama models
- Smart Routing — 3 strategies: cheapest-viable, best-quality, balanced
- Fallback Chains — If provider A fails, automatically try provider B
- Cost Tracking — Per-request cost calculation, daily/weekly/monthly aggregation
- Health Monitoring — Circuit breaker pattern, automatic provider health checking
- OpenAI-Compatible API — Drop-in replacement with
/v1/chat/completions endpoint
How to Use
Start the gateway server:
npx @claws-shield/cli gateway --port 8787
Or programmatically:
node scripts/start-gateway.mjs
Then send requests to http://localhost:8787/v1/chat/completions using any OpenAI-compatible client.
Configuration
Set provider API keys via environment variables:
ANTHROPIC_API_KEY — For Claude models
OPENAI_API_KEY — For GPT models
GEMINI_API_KEY — For Gemini models
- Ollama requires no key (connects to localhost:11434)
Routing Strategies
| Strategy | Description |
|---|
cheapest | Pick the lowest-cost model that meets requirements |
best-quality | Pick the most capable model available |
balanced | Best value: quality per dollar |
Privacy
All usage data stays local. The gateway never phones home. Your API keys are never transmitted to third parties.