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

# Cursor + OpenRouter Setup

> Use VibeLearn in Cursor with OpenRouter's 100+ AI models

## Why OpenRouter for Cursor

OpenRouter provides access to many models including free options. Good as a primary provider or fallback when Gemini hits rate limits.

## Step 1: Get an OpenRouter Key

1. Go to [openrouter.ai/keys](https://openrouter.ai/keys)
2. Sign up and create a key (starts with `sk-or-`)

## Step 2: Configure VibeLearn

```bash theme={null}
mkdir -p ~/.vibelearn
cat > ~/.vibelearn/settings.json << 'EOF'
{
  "VIBELEARN_OPENROUTER_API_KEY": "sk-or-YOUR_KEY_HERE",
  "VIBELEARN_OPENROUTER_MODEL": "google/gemini-2.0-flash-exp:free"
}
EOF
```

**Free model options:**

* `google/gemini-2.0-flash-exp:free` — recommended
* `xiaomi/mimo-v2-flash:free` — fast, smaller context

## Step 3: Install Cursor Hooks

```bash theme={null}
# From the vibelearn repo directory
bun run cursor:install -- user
bun run worker:start
```

Restart Cursor to load the hooks.

## Step 4: Verify

```bash theme={null}
curl http://127.0.0.1:37778/api/readiness
# → {"status":"ready"}
```

Run an agent session, then `vl quiz` to see questions.

## Combining Gemini + OpenRouter

For maximum reliability, configure both:

```json theme={null}
{
  "VIBELEARN_GEMINI_API_KEY": "AIza...",
  "VIBELEARN_OPENROUTER_API_KEY": "sk-or-..."
}
```

VibeLearn tries Gemini first. If it fails or hits rate limits, it falls back to OpenRouter automatically.

## Troubleshooting

**No output / empty response** — Free models may be slow or at capacity. Try a different free model.

**`402 Payment Required`** — Model requires credits. Switch to a `:free` model or add OpenRouter credits.

**Check which provider was used:**

```bash theme={null}
grep "provider" ~/.vibelearn/logs/vibelearn-$(date +%Y-%m-%d).log | tail -5
```
