# Cursor-HIDDEN

{% hint style="warning" %}
Only versions 1.x are currently supported for integration.\
You can select one of them on [Cursor’s official download page](https://cursor.com/download).
{% endhint %}

## About

[Cursor](https://cursor.com/) is an advanced AI-powered IDE that combines intelligent code completion, inline explanations, and automatic code editing directly inside the editor.

This guide explains how to connect **AI/ML API** to **Cursor** using the **Azure OpenAI-compatible** flow.\
You’ll get a clean setup with **one endpoint**, support for **slashes in deployment names**.

## 🚀 Quick Setup

<table><thead><tr><th width="248">Field</th><th>Value</th></tr></thead><tbody><tr><td><strong>Base URL</strong></td><td><code>https://api.aimlapi.com</code></td></tr><tr><td><strong>API Key</strong></td><td>Your AI/ML API key (create at <a href="https://aimlapi.com/app/keys">aimlapi.com/app/keys</a>)</td></tr><tr><td><strong>Deployment</strong></td><td><code>google/gemini-2.5-pro</code> <em>(slashes allowed)</em></td></tr><tr><td><strong>Alias (Model ID)</strong></td><td><code>gpt-4o</code> <em>(Bypasses the restriction and makes Cursor work with any mode</em>l<em>)</em></td></tr></tbody></table>

{% hint style="warning" %}
Do **not** add `/v2/azure` or `/openai` to the Base URL.
{% endhint %}

***

## ✅ Prerequisites

* AI/ML API key
* Cursor IDE (latest)
* Internet access to `api.aimlapi.com`

***

## Installation & Configuration

### 1) Configure Cursor (Azure path)

Open **Cursor → Settings → Models → Azure** and fill in:

**Base URL**

```
https://api.aimlapi.com
```

**Deployment Name**

```
google/gemini-2.5-pro
```

**API Key** Paste your AI/ML API key exactly (avoid spaces).

Click **Verify** to confirm.

<div align="left" data-with-frame="true"><figure><img src="/files/HwRrYPNpjORZVbvXZ4ma" alt=""><figcaption></figcaption></figure></div>

<div align="left" data-full-width="false" data-with-frame="true"><figure><img src="/files/MCaKUkOLHhXKWu2mApj1" alt=""><figcaption></figcaption></figure></div>

<div align="left" data-with-frame="true"><figure><img src="/files/LWtfydgikxzAyYsbGMcO" alt=""><figcaption></figcaption></figure></div>

***

### 2) Keep the model picker clean

In Cursor’s **Chat model selector**, only enable:

```
gpt-4o
```

This alias (Model ID) will send traffic to your deployment (`google/gemini-2.5-pro`).

<div data-with-frame="true"><figure><img src="/files/L4IdD5eplJXouq8B6008" alt=""><figcaption></figcaption></figure></div>

***

### 3) How Cursor calls AI/ML API

Example request generated by Cursor:

{% code overflow="wrap" %}

```http
POST https://api.aimlapi.com/openai/deployments/google/gemini-2.5-pro/chat/completions?api-version=2024-12-01-preview
Api-Key: <YOUR_AIMLAPI_KEY>
Content-Type: application/json

{
  "messages": [
    { "role": "system", "content": "You are a helpful coding assistant." },
    { "role": "user",   "content": "Write a Python function that reverses a string." }
  ]
}
```

{% endcode %}

Notes:

* `Deployment Name` is inserted into `/deployments/<NAME>/...`.
* `api-version` is handled by Cursor automatically.
* Base URL stays **exactly** `https://api.aimlapi.com`.

<div align="left" data-with-frame="true"><figure><img src="/files/f7YCgwjJPl1CVoZXLH1U" alt=""><figcaption></figcaption></figure></div>

<div align="left" data-with-frame="true"><figure><img src="/files/K0rI1ZIKZob8Ta5ENSpv" alt=""><figcaption></figcaption></figure></div>

<div align="left" data-with-frame="true"><figure><img src="/files/N5VUC45dMEV45bWsw2r1" alt=""><figcaption></figcaption></figure></div>

***

### 4) Optional smoke test

{% code overflow="wrap" %}

```bash
curl -sS -X POST \
  "https://api.aimlapi.com/openai/deployments/google/gemini-2.5-pro/chat/completions?api-version=2024-12-01-preview" \
  -H "Api-Key: YOUR_AIMLAPI_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "messages": [
      {"role":"system","content":"You are a helpful coding assistant."},
      {"role":"user","content":"Give me a one-line Python function to merge two dicts."}
    ]
  }'
```

{% endcode %}

You should receive a JSON response with `choices[0].message.content`.

***

### 5) Common pitfalls

* **Deployment not found** → Check Base URL & Deployment Name.
* **Invalid API key** → Re-copy the key, ensure it’s in the Azure section.
* **Wrong model list** → Toggle Azure off/on, click Verify, restart Cursor.
* **Slashes in names** → Allowed in Deployment, but keep alias short (e.g. `gpt-4o`).

***

### 6) Tips for teams

* Standardize the **alias (Model ID)** (`gpt-4o`) so everyone sees the same thing in Cursor.
* Document your **Base URL + Deployment** in team wiki to avoid drift.
* You can swap deployments later without changing the alias in UI.

***

### ✅ Summary (copy/paste)

* **Base URL:** `https://api.aimlapi.com`
* **API Key:** your AI/ML API key
* **Deployment:** `google/gemini-2.5-pro` *(slashes allowed)*
* **Alias (Model ID):** `gpt-4o`

With this setup, Cursor talks to **AI/ML API** using the **Azure flow**, while you keep the UI clean and consistent


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.aimlapi.com/integrations/cursor.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
