Skip to main content

Raycast Integration

Raycast is a productivity tool for macOS with powerful AI features. Using Raycast’s Bring Your Own Key (BYOK) feature, you can route AI requests through the LeanMCP AI Gateway.
Raycast BYOK lets you use your own API keys from AI providers. By pointing to the LeanMCP AI Gateway, you get full visibility into your AI usage.

Prerequisites

1

Get Credits

Purchase credits at ship.leanmcp.com
2

Create API Key

Create an API key at ship.leanmcp.com/api-keys with SDK permissions
3

Install Raycast

Download and install Raycast if you haven’t already

Understanding Raycast BYOK

Raycast’s Bring Your Own Key feature allows you to:
  • Use AI models without a Raycast Pro subscription
  • Pay only for what you use via your own API keys
  • Use Raycast AI with any OpenAI-compatible endpoint
With BYOK, you can send as many AI messages as you want at your own cost, without needing a Pro subscription.

Configuration

1

Open Raycast AI Settings

  1. Open Raycast (default: Cmd + Space)
  2. Type “Raycast Settings” and press Enter
  3. Navigate to the AI section
Raycast AI Settings
2

Find Custom API Keys Section

Scroll down to find the Custom API Keys section.
3

Add OpenAI-Compatible Key

For OpenAI models via LeanMCP:Provider: OpenAI (or OpenRouter for all providers)API Key:
leanmcp_your_api_key_here
Raycast’s standard BYOK doesn’t support custom base URLs directly. See the OpenRouter method below for full gateway support.
4

Validate the Key

Click Validate to test the API key connection.

Using OpenRouter for Full Gateway Support

For complete LeanMCP AI Gateway integration with Raycast, use OpenRouter as the provider:
1

Select OpenRouter

In Raycast AI Settings, choose OpenRouter as the provider.
2

Enter LeanMCP API Key

Enter your LeanMCP API key in the OpenRouter API key field.
The LeanMCP AI Gateway is OpenRouter-compatible, so Raycast will route requests through the gateway.
3

Select Models

Choose from available models. All requests will go through the LeanMCP gateway.

What Raycast Sends to AI

When you use Raycast AI, the following may be sent:
  • Your prompt/question
  • Selected text (if using “Ask AI about selection”)
  • Clipboard contents (if using clipboard features)
  • File contents (if using file-based commands)
With the AI Gateway, you can see exactly what’s sent in each request.

Model Selection

After configuring BYOK, you’ll see a key icon next to models using your API key:
Raycast model picker with BYOK
Available models depend on your configuration:
  • OpenAI: GPT-5.2, GPT-5.2, GPT-5.2
  • Anthropic: Claude Sonnet 4.5, Claude Opus 4.5
  • OpenRouter: Access to 100+ models

Privacy Considerations

When using BYOK (excluding OpenRouter), Raycast processes requests through their servers to unify APIs and add features. With the LeanMCP gateway, you get an additional layer of logging and control.
Learn more about Raycast’s AI Privacy + Security.

Local Models Alternative

If you want complete privacy, Raycast also supports local models via Ollama:
  1. Install Ollama
  2. Pull a model: ollama pull llama2
  3. Select the local model in Raycast
Local models run entirely on your machine and don’t go through any external service.

Benefits of Using AI Gateway with Raycast

Usage Tracking

See exactly how much you’re using Raycast AI

Cost Monitoring

Track spending across all your Raycast AI usage

Sensitive Data Alerts

Get notified if clipboard or selection contains secrets

Request History

Review past AI interactions and their costs

Troubleshooting

  • Ensure your LeanMCP API key has credits
  • Check the key has SDK permissions
  • Verify you’re using the correct provider setting
  • Restart Raycast after adding the API key
  • Check Raycast has the latest version
  • Try removing and re-adding the API key
  • Confirm you’re using the LeanMCP API key
  • Some requests may go directly to providers depending on Raycast’s routing
  • Try using OpenRouter mode for guaranteed gateway routing

Resources

Next Steps