Skip to main content

Getting Started with AI Gateway

Follow these steps to start routing your AI requests through the LeanMCP AI Gateway.

Prerequisites

You need credits on your LeanMCP account to use the AI Gateway. Credits are used to cover the cost of AI provider requests plus a small gateway fee.

Step 1: Create an Account

  1. Go to ship.leanmcp.com
  2. Sign up with your email or GitHub account
  3. Complete the onboarding process
Sign up for LeanMCP

Step 2: Purchase Credits

  1. Navigate to Settings > Billing in your dashboard
  2. Select a credit package or set up auto-recharge
  3. Complete the payment
Credits are used at approximately the same rate as direct API calls, plus a small fee for gateway services (logging, security scanning, etc.).

Step 3: Generate an API Key

  1. Go to Settings > API Keys
  2. Click Create New API Key
  3. Give your key a descriptive name (e.g., “Windsurf Development”)
  4. Copy and save your API key securely
Your API key is shown only once. Store it securely - you’ll need it to authenticate requests.

Step 4: Configure Your Application

Replace your AI provider’s base URL and API key with the gateway endpoint:
import OpenAI from 'openai';

const client = new OpenAI({
  baseURL: 'https://aigateway.leanmcp.com/v1/openai',
  apiKey: 'your-leanmcp-api-key',
});

Step 5: Verify It’s Working

Make a test request and check your dashboard:
const response = await client.chat.completions.create({
  model: 'gpt-5.2',
  messages: [{ role: 'user', content: 'Hello!' }],
});

console.log(response.choices[0].message.content);
  1. Go to your LeanMCP Dashboard
  2. Navigate to AI Gateway > Logs
  3. You should see your test request logged
AI Gateway Logs

What’s Next?