Getting Your API Key
To use the LeanMCP AI Gateway, you need an API key. This key authenticates your requests and tracks your usage.Prerequisites
You need credits on your LeanMCP account before using the AI Gateway. Purchase credits at ship.leanmcp.com first.
Creating an API Key
Go to API Keys Page
Navigate to ship.leanmcp.com/api-keys

Configure Your Key
Fill in the details:
- Name: A descriptive name (e.g., “Windsurf Development”, “Production App”)
- Permissions: Select SDK permissions for AI Gateway access

API Key Format
LeanMCP API keys are prefixed withleanmcp_ for easy identification:
Using Your API Key
Once you have your API key, use it in place of your AI provider’s API key:- Environment Variable
- In Code
- In IDE Settings
Managing API Keys
View All Keys
Go to ship.leanmcp.com/api-keys to see all your API keys:- Creation date
- Last used
- Usage statistics
Delete a Key
To revoke an API key:- Go to the API Keys page
- Find the key you want to delete
- Click the Delete button
- Confirm deletion
Rotate Keys
For security, we recommend rotating your API keys periodically:- Create a new API key
- Update your applications to use the new key
- Verify everything works
- Delete the old key
Best Practices
Use separate keys for different environments
Use separate keys for different environments
Create separate API keys for development, staging, and production. This makes it easier to track usage and rotate keys without affecting all environments.
Never commit API keys to version control
Never commit API keys to version control
Use environment variables or secret management tools. Add
.env files to your .gitignore.Monitor your usage
Monitor your usage
Check the API Keys page regularly to monitor usage and detect any unusual activity.
Set up billing alerts
Set up billing alerts
Configure alerts in your dashboard to be notified when you’re approaching credit limits.