> ## Documentation Index
> Fetch the complete documentation index at: https://docs.leanmcp.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Windsurf

> Use the LeanMCP AI Gateway with Windsurf IDE

# Windsurf Integration

[Windsurf](https://codeium.com/windsurf) is an AI-powered IDE by Codeium. You can route Windsurf's AI requests through the LeanMCP AI Gateway to monitor what code is being sent to AI providers.

## Prerequisites

<Steps>
  <Step title="Get Credits">
    Purchase credits at [leanmcp.com](https://leanmcp.com)
  </Step>

  <Step title="Create API Key">
    Create an API key at [leanmcp.com/api-keys](https://leanmcp.com/api-keys) with **SDK** permissions
  </Step>
</Steps>

## Configuration

<Steps>
  <Step title="Open Windsurf Settings">
    Press `Cmd + ,` (Mac) or `Ctrl + ,` (Windows/Linux) to open Settings

    Or click the gear icon in the bottom left corner
  </Step>

  <Step title="Search for AI Settings">
    In the search bar, type "AI" or "API" to find the AI configuration section
  </Step>

  <Step title="Configure Custom API Endpoint">
    Look for settings related to custom AI providers or API endpoints:

    **Base URL / API Endpoint:**

    ```
    https://aigateway.leanmcp.com/v1/openai
    ```

    **API Key:**

    ```
    leanmcp_your_api_key_here
    ```

    <Frame>
      <img src="https://mintlify.s3.us-west-1.amazonaws.com/leanmcp/images/ai-gateway-windsurf-settings.png" alt="Windsurf settings" />
    </Frame>
  </Step>

  <Step title="Apply and Restart">
    Apply your settings and restart Windsurf.
  </Step>
</Steps>

## Alternative: Settings JSON

You can also configure Windsurf via its settings JSON file:

```json theme={null}
{
  "ai.provider": "openai-compatible",
  "ai.baseUrl": "https://aigateway.leanmcp.com/v1/openai",
  "ai.apiKey": "leanmcp_your_api_key_here"
}
```

## Verifying the Setup

1. Open a project in Windsurf
2. Use the AI assistant (Cascade) to ask a question about your code
3. Check your [LeanMCP Dashboard](https://leanmcp.com) to see the request logged

## What You Can Monitor

With the AI Gateway, you can see:

| Data               | Description                          |
| ------------------ | ------------------------------------ |
| **Code Context**   | Exact code snippets sent to the AI   |
| **File Paths**     | Which files are included in requests |
| **Token Usage**    | Input and output tokens per request  |
| **Costs**          | Real-time cost tracking              |
| **Sensitive Data** | Detected secrets, keys, or PII       |

## Why Use AI Gateway with Windsurf?

<CardGroup cols={2}>
  <Card title="See What's Sent" icon="eye">
    Windsurf sends surrounding code as context. Know exactly what's included.
  </Card>

  <Card title="Detect Secrets" icon="key">
    Get alerts if API keys or passwords are accidentally sent to AI.
  </Card>

  <Card title="Track Costs" icon="dollar-sign">
    Monitor your AI spending across all coding sessions.
  </Card>

  <Card title="Compliance" icon="shield-check">
    Maintain audit logs for security and compliance requirements.
  </Card>
</CardGroup>

## Troubleshooting

<AccordionGroup>
  <Accordion title="Cascade not responding">
    * Check your API key is valid and has credits
    * Verify the base URL is correct
    * Ensure Windsurf is using the custom endpoint (check settings)
  </Accordion>

  <Accordion title="Settings not persisting">
    * Make sure to save settings before closing
    * Try editing the settings JSON file directly
    * Restart Windsurf after making changes
  </Accordion>

  <Accordion title="Requests not appearing in dashboard">
    * Confirm you're using the LeanMCP API key (starts with `leanmcp_`)
    * Wait a few seconds - there may be a brief delay
    * Check the correct workspace/account in the dashboard
  </Accordion>
</AccordionGroup>

## Next Steps

<CardGroup cols={2}>
  <Card title="View Request Logs" icon="list" href="/ai-gateway/observability">
    See all your Windsurf AI requests
  </Card>

  <Card title="Set Up Alerts" icon="bell" href="/ai-gateway/security">
    Get notified of sensitive data exposure
  </Card>
</CardGroup>
