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

# Cursor

> Route Cursor AI requests through Wardin for cost tracking and policy enforcement.

Cursor uses the Anthropic and OpenAI APIs directly. You can route it through Wardin by configuring a custom base URL in Cursor's settings.

## Configuration

In Cursor, go to **Settings → Models → API Keys**.

Set:

* **Anthropic API Key**: `wardin_sk_YOUR_KEY`
* **OpenAI API Key**: `wardin_sk_YOUR_KEY` (same key works for both if you use the same virtual key)

Then set the base URLs:

* **Anthropic Base URL**: `https://gw.wardin.ai`
* **OpenAI Base URL**: `https://gw.wardin.ai/v1`

The gateway accepts both auth styles these integrations send (`x-api-key` and `Authorization: Bearer`), so no extra configuration is needed.

<Note>
  Cursor's UI for custom base URLs may vary by version. Check Cursor's documentation if the fields are not visible.
</Note>

## What gets tracked

Every Cursor AI request — tab completions, chat, inline edits — passes through Wardin with full attribution:

* Token usage per request type
* Model used
* Session grouping (Cursor sessions are grouped by idle timeout)
* Policy enforcement (model allowlist, PII redaction)

## Using environment variables

If you're running Cursor from a terminal (or using a `.cursor/mcp.json` setup), you can set:

```bash theme={null}
export ANTHROPIC_API_KEY=wardin_sk_YOUR_KEY
export ANTHROPIC_BASE_URL=https://gw.wardin.ai

export OPENAI_API_KEY=wardin_sk_YOUR_KEY
export OPENAI_BASE_URL=https://gw.wardin.ai/v1
```

## Per-developer keys

Give each developer their own `wardin_sk_` key for individual cost tracking. All keys can point to the same provider credentials on the Wardin side.

```bash theme={null}
# Developer key with $75/month budget
curl -X POST https://api.wardin.ai/v1/keys \
  -H "Authorization: Bearer wardin_sk_ADMIN_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "bob-cursor",
    "monthlyBudgetUsd": 75,
    "ownerId": "user_bob_id"
  }'
```
