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

# Cursor

> Cursor Code Editor Integration Guide

## Introduction

Cursor is an AI-powered code editor. By integrating MixRoute API, you can get powerful AI assistance while coding, including intelligent code generation, completion, explanation, and optimization. MixRoute is now compatible with Cursor's Agent capabilities (Auto Apply / multi-file editing).

## Quick Configuration

<Warning>
  **Important**: Currently Cursor officially restricts third-party API Keys (including Mixroute Api) with the following conditions:

  * Must have Pro Plan (paid subscription), Free Plan cannot use third-party API Keys
  * Need VPN/proxy to connect to third-party API services
  * This is Cursor's official policy limitation.
</Warning>

### 1. Open Settings

Click the gear icon ⚙️ in the top right, select Models option.

### 2. Configure API

* **OpenAI API Key**: Enter your MixRoute API key
* **Override OpenAI Base URL**: Check and enter `https://api.mixroute.ai/v1`
* Click **Verify** to validate configuration

<Note>
  - GPT series models need `openai/` prefix, e.g., use `openai/gpt-5.5` for `gpt-5.5`. Other channels use original model IDs.
  - Mixroute Api supports Cursor Agent (Auto Apply). To enable Agent, use Agent-compatible models.
</Note>

### 3. Agent Mode Tips

* Use Agent-compatible models (Claude, DeepSeek, Grok, GPT series with `openai/` prefix)
* Ensure Base URL is `https://api.mixroute.ai/v1`
* Verify auto-apply with a simple change in Cursor sidebar first time
* If model doesn't support Agent, use Chat mode with manual Apply

### Add Custom Models

Add in Cursor settings:

```text theme={null}
claude-sonnet-5
gpt-5.5
deepseek-v4-pro
gemini-3.5-flash
```

## Usage Modes

### Chat Mode Workflow

1. **Generate code**: `Ctrl/Cmd + L` to open chat, describe requirements
2. **Apply code**: Copy code to target file, or use "Apply" button
3. **Iterate**: Continue conversation for modifications

### Alternatives Comparison

| Tool               | Agent Mode | Pros                         | Cons             |
| ------------------ | ---------- | ---------------------------- | ---------------- |
| Cursor             | ❌          | Elegant UI, great completion | No Agent mode    |
| Cline (VS Code)    | ✅          | Full Agent functionality     | Requires VS Code |
| RooCode (VS Code)  | ✅          | Multi-file editing           | Newer, evolving  |
| Continue (VS Code) | ✅          | Open source, customizable    | Complex setup    |

## Core Features

### Smart Code Completion

* **Tab completion**: Press Tab to accept AI suggestions
* **Multi-line completion**: Function-level code generation
* **Context-aware**: Precise suggestions based on project structure

### AI Chat

* `Ctrl/Cmd + K`: Open command palette
* `Ctrl/Cmd + L`: Open sidebar chat
* **Code explanation**: Select code and ask AI

### Code Editing

* **Generate code**: Describe requirements, AI auto-generates
* **Refactoring**: Get code optimization suggestions
* **Fix errors**: AI helps locate and fix errors

## Keyboard Shortcuts

| Shortcut       | Function                  |
| -------------- | ------------------------- |
| `Ctrl/Cmd + K` | Open AI command palette   |
| `Ctrl/Cmd + L` | Open AI chat sidebar      |
| `Tab`          | Accept code suggestion    |
| `Esc`          | Cancel current suggestion |

## Tips

### Provide Clear Context

```javascript theme={null}
// @context: React component for user authentication
// @requirements: Need OAuth2 login support
// @constraints: Compatible with NextJS 13+
```

### Optimize Prompts

* **Poor**: `"Fix this function"`
* **Good**: `"Fix floating-point precision issue in calculateTotal function, ensure amount calculation is accurate to two decimal places"`

## Troubleshooting

<AccordionGroup>
  <Accordion title="Connection Timeout">
    * Check network connection
    * Confirm API URL is `https://api.mixroute.ai/v1`
    * Verify API key is valid
  </Accordion>

  <Accordion title="Model Not Responding">
    * Check account balance
    * Try switching to another model
    * Restart Cursor client
  </Accordion>

  <Accordion title="Poor Suggestions">
    * Provide more project context
    * Use more specific prompts
    * Switch to a better-performing model
  </Accordion>
</AccordionGroup>

## Best Practices

### Project-level Config

Create `.cursor-settings.json` in project root:

```json theme={null}
{
  "model": "gpt-5.5",
  "temperature": 0.7,
  "contextFiles": ["README.md", "package.json"],
  "rules": [
    "Use TypeScript strict mode",
    "Follow ESLint standards",
    "Add appropriate comments"
  ]
}
```

### Code Review

```text theme={null}
Please review this code, focusing on:
1. Performance issues
2. Security vulnerabilities
3. Code standards
4. Best practices
```

## About Agent Mode

For AI auto-editing multiple files and complex refactoring, consider:

* **Cline**: VS Code plugin with full Agent functionality
* **RooCode**: Emerging VS Code AI Agent plugin
