AI Gateway
One line change. Full visibility into every AI request — what was sent, what came back, how many tokens, what it cost. Works with Claude Code, Cursor, Windsurf, Cline, Raycast and any app you build.How it works
You’re changing one thing: where your AI requests go.Why use AI Gateway?
Complete Visibility
See exactly what data is being sent to AI providers from your tools and apps — full request body, response, tokens, and cost per request.
Security & Privacy
Automatically detect and block sensitive data — API keys, passwords, PII — before they reach an AI provider.
Cost Optimization
Track token usage per tool, per user, per feature. Run A/B tests on prompts and models to reduce spend.
Drop-in Replacement
Works with existing SDKs and tools. Change one URL and one env var — nothing else in your workflow changes.
Supported providers
| Provider | Gateway endpoint |
|---|---|
| Anthropic | aigateway.leanmcp.com/v1/anthropic |
| OpenAI | aigateway.leanmcp.com/v1/openai |
| xAI (Grok) | aigateway.leanmcp.com/v1/xai |
| Fireworks | aigateway.leanmcp.com/v1/fireworks |
| ElevenLabs | aigateway.leanmcp.com/v1/elevenlabs |
Where do you want to start?
I use Claude Code, Cursor, or Windsurf
Set up the gateway for your personal coding tools. See exactly what your AI assistant is sending — your code, context, token usage, and cost — in real time.
I'm building an app that calls an AI API
Add the gateway to your backend. Get per-user tracking, abuse prevention, rate limiting, and cost controls in production.
Quick setup (2 steps)
Get your API key
Top up credits at app.leanmcp.com/billing, then create a key at app.leanmcp.com/api-keys.
Setup guides by tool
Personal tools
Claude Code
Cursor
Windsurf
Cline
Raycast
OpenCode
Developers
SDK Integration
OpenAI and Anthropic SDK examples with user context headers.
Full Integration Guide
All providers, auth patterns, rate limiting, and A/B testing.
What you’ll see after setup
Go to app.leanmcp.com/observability after your first request:| Field | What it shows |
|---|---|
| Request Body | Full prompt sent to the AI |
| Response Body | Full response received |
| Model | Which model was used |
| Tokens | Input / output / total |
| Latency | Response time in ms |
| Status | Success or error |
| Timestamp | When the request was made |

