Skip to main content

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.
# before
ANTHROPIC_API_KEY=sk-ant-...   →   goes directly to Anthropic

# after
ANTHROPIC_AUTH_TOKEN=leanmcp_...   →   goes through LeanMCP gateway   →   then to Anthropic
Your tools behave identically. You get a full log of every request in app.leanmcp.com/observability.

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

ProviderGateway endpoint
Anthropicaigateway.leanmcp.com/v1/anthropic
OpenAIaigateway.leanmcp.com/v1/openai
xAI (Grok)aigateway.leanmcp.com/v1/xai
Fireworksaigateway.leanmcp.com/v1/fireworks
ElevenLabsaigateway.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)

1

Get your API key

Top up credits at app.leanmcp.com/billing, then create a key at app.leanmcp.com/api-keys.
2

Point your tool at the gateway

Replace your provider’s base URL and API key with your LeanMCP key. That’s it.Pick your tool below for the exact config.

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:
FieldWhat it shows
Request BodyFull prompt sent to the AI
Response BodyFull response received
ModelWhich model was used
TokensInput / output / total
LatencyResponse time in ms
StatusSuccess or error
TimestampWhen the request was made