mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-05 08:07:05 +00:00
fix: use correct Cursor logo from lobehub, add documentation page
- Replace placeholder Cursor logo with official hexagonal logo from lobehub - Add docs/pass_through/cursor.md with full tutorial matching a2a_cost_tracking style - Quick Start: add creds on UI, start proxy, launch agent, view logs - Examples: all Cursor Cloud Agents API endpoints - Advanced: virtual key usage - Screenshots: credential form, logs page, log detail view - Add Cursor to sidebars.js under Pass-through Endpoints - Add screenshots to docs/my-website/img/ Co-authored-by: Ishaan Jaff <ishaan-jaff@users.noreply.github.com>
This commit is contained in:
parent
2044d565a6
commit
a3cd15fe7d
6 changed files with 262 additions and 5 deletions
260
docs/my-website/docs/pass_through/cursor.md
Normal file
260
docs/my-website/docs/pass_through/cursor.md
Normal file
|
|
@ -0,0 +1,260 @@
|
|||
import Image from '@theme/IdealImage';
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
|
||||
# Cursor Cloud Agents
|
||||
|
||||
Pass-through endpoints for the [Cursor Cloud Agents API](https://docs.cursor.com/account/api) — launch and manage cloud agents that work on your repositories, in native format (no translation).
|
||||
|
||||
| Feature | Supported | Notes |
|
||||
|---------|-----------|-------|
|
||||
| Cost Tracking | ✅ | Logged as $0.00 (subscription-based, no per-request pricing) |
|
||||
| Logging | ✅ | All requests logged with operation classification |
|
||||
| End-user Tracking | ❌ | [Tell us if you need this](https://github.com/BerriAI/litellm/issues/new) |
|
||||
| Streaming | ❌ | Cursor API does not use streaming |
|
||||
|
||||
Just replace `https://api.cursor.com` with `LITELLM_PROXY_BASE_URL/cursor` 🚀
|
||||
|
||||
**Supported endpoints:**
|
||||
|
||||
| Endpoint | Method | Description |
|
||||
|----------|--------|-------------|
|
||||
| `/v0/agents` | GET | List agents |
|
||||
| `/v0/agents` | POST | Launch an agent |
|
||||
| `/v0/agents/{id}` | GET | Agent status |
|
||||
| `/v0/agents/{id}` | DELETE | Delete an agent |
|
||||
| `/v0/agents/{id}/conversation` | GET | Agent conversation |
|
||||
| `/v0/agents/{id}/followup` | POST | Add follow-up |
|
||||
| `/v0/agents/{id}/stop` | POST | Stop an agent |
|
||||
| `/v0/me` | GET | API key info |
|
||||
| `/v0/models` | GET | List models |
|
||||
| `/v0/repositories` | GET | List GitHub repositories |
|
||||
|
||||
## Quick Start
|
||||
|
||||
### 1. Add Cursor API Key on the UI
|
||||
|
||||
Navigate to **Models + Endpoints → LLM Credentials** and click **Add Credential**. Select **Cursor** from the provider dropdown — you'll see the Cursor logo. Enter your API key from [cursor.com/settings](https://cursor.com/settings).
|
||||
|
||||
<Image img={require('../../img/cursor_add_credential.png')} alt="Add Cursor credential with logo" style={{maxWidth: '800px'}} />
|
||||
|
||||
### 2. Start LiteLLM Proxy
|
||||
|
||||
<Tabs>
|
||||
<TabItem value="env" label="Environment Variable">
|
||||
|
||||
```bash
|
||||
export CURSOR_API_KEY="crsr_..."
|
||||
|
||||
litellm
|
||||
|
||||
# RUNNING on http://0.0.0.0:4000
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
<TabItem value="config" label="Config File">
|
||||
|
||||
```yaml
|
||||
model_list:
|
||||
- model_name: cursor-agents
|
||||
litellm_params:
|
||||
model: cursor/claude-4-sonnet
|
||||
api_key: os.environ/CURSOR_API_KEY
|
||||
|
||||
general_settings:
|
||||
master_key: sk-1234
|
||||
```
|
||||
|
||||
```bash
|
||||
litellm --config config.yaml
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
### 3. Launch a Cursor Agent
|
||||
|
||||
```bash
|
||||
curl -X POST http://0.0.0.0:4000/cursor/v0/agents \
|
||||
-H "Authorization: Bearer sk-1234" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{
|
||||
"prompt": {
|
||||
"text": "Add a README.md with installation instructions"
|
||||
},
|
||||
"source": {
|
||||
"repository": "https://github.com/your-org/your-repo",
|
||||
"ref": "main"
|
||||
},
|
||||
"target": {
|
||||
"autoCreatePr": true
|
||||
}
|
||||
}'
|
||||
```
|
||||
|
||||
**Expected Response:**
|
||||
|
||||
```json
|
||||
{
|
||||
"id": "bc_abc123",
|
||||
"name": "Add README Documentation",
|
||||
"status": "CREATING",
|
||||
"source": {
|
||||
"repository": "https://github.com/your-org/your-repo",
|
||||
"ref": "main"
|
||||
},
|
||||
"target": {
|
||||
"branchName": "cursor/add-readme-1234",
|
||||
"url": "https://cursor.com/agents?id=bc_abc123",
|
||||
"autoCreatePr": true
|
||||
},
|
||||
"createdAt": "2024-01-15T10:30:00Z"
|
||||
}
|
||||
```
|
||||
|
||||
### 4. View Logs
|
||||
|
||||
Navigate to **Logs** in the sidebar. Filter by "cursor" to see your agent requests. Each request shows the operation type (e.g., `cursor/cursor:agent:create`), status, duration, and cost.
|
||||
|
||||
<Image img={require('../../img/cursor_logs.png')} alt="Cursor requests in Logs page" style={{maxWidth: '800px'}} />
|
||||
|
||||
Click on any log entry to see full request details including provider, API base, and metadata.
|
||||
|
||||
<Image img={require('../../img/cursor_log_detail.png')} alt="Cursor log entry detail" style={{maxWidth: '800px'}} />
|
||||
|
||||
## Examples
|
||||
|
||||
Anything after `http://0.0.0.0:4000/cursor` is treated as a provider-specific route, and handled accordingly.
|
||||
|
||||
| **Original Endpoint** | **Replace With** |
|
||||
|---|---|
|
||||
| `https://api.cursor.com` | `http://0.0.0.0:4000/cursor` (LITELLM_PROXY_BASE_URL) |
|
||||
| `-u YOUR_API_KEY:` (Basic Auth) | `-H "Authorization: Bearer sk-1234"` (LiteLLM Virtual Key) |
|
||||
|
||||
### List Available Models
|
||||
|
||||
```bash
|
||||
curl http://0.0.0.0:4000/cursor/v0/models \
|
||||
-H "Authorization: Bearer sk-1234"
|
||||
```
|
||||
|
||||
```json
|
||||
{
|
||||
"models": [
|
||||
"claude-4-sonnet-thinking",
|
||||
"gpt-5.2",
|
||||
"claude-4.5-sonnet-thinking"
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
### Check Agent Status
|
||||
|
||||
```bash
|
||||
curl http://0.0.0.0:4000/cursor/v0/agents/bc_abc123 \
|
||||
-H "Authorization: Bearer sk-1234"
|
||||
```
|
||||
|
||||
### List All Agents
|
||||
|
||||
```bash
|
||||
curl http://0.0.0.0:4000/cursor/v0/agents \
|
||||
-H "Authorization: Bearer sk-1234"
|
||||
```
|
||||
|
||||
### Add Follow-up to Agent
|
||||
|
||||
```bash
|
||||
curl -X POST http://0.0.0.0:4000/cursor/v0/agents/bc_abc123/followup \
|
||||
-H "Authorization: Bearer sk-1234" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{
|
||||
"prompt": {
|
||||
"text": "Also add a section about troubleshooting"
|
||||
}
|
||||
}'
|
||||
```
|
||||
|
||||
### Stop an Agent
|
||||
|
||||
```bash
|
||||
curl -X POST http://0.0.0.0:4000/cursor/v0/agents/bc_abc123/stop \
|
||||
-H "Authorization: Bearer sk-1234"
|
||||
```
|
||||
|
||||
### Delete an Agent
|
||||
|
||||
```bash
|
||||
curl -X DELETE http://0.0.0.0:4000/cursor/v0/agents/bc_abc123 \
|
||||
-H "Authorization: Bearer sk-1234"
|
||||
```
|
||||
|
||||
### Get API Key Info
|
||||
|
||||
```bash
|
||||
curl http://0.0.0.0:4000/cursor/v0/me \
|
||||
-H "Authorization: Bearer sk-1234"
|
||||
```
|
||||
|
||||
```json
|
||||
{
|
||||
"apiKeyName": "Production API Key",
|
||||
"createdAt": "2024-01-15T10:30:00Z",
|
||||
"userEmail": "developer@example.com"
|
||||
}
|
||||
```
|
||||
|
||||
## Advanced — Use with Virtual Keys
|
||||
|
||||
Pre-requisites:
|
||||
- [Setup proxy with DB](../proxy/virtual_keys.md#setup)
|
||||
|
||||
Use this to avoid giving developers the raw Cursor API key, but still letting them use Cursor endpoints.
|
||||
|
||||
### Usage
|
||||
|
||||
1. Setup environment
|
||||
|
||||
```bash
|
||||
export DATABASE_URL=""
|
||||
export LITELLM_MASTER_KEY=""
|
||||
export CURSOR_API_KEY=""
|
||||
```
|
||||
|
||||
```bash
|
||||
litellm
|
||||
|
||||
# RUNNING on http://0.0.0.0:4000
|
||||
```
|
||||
|
||||
2. Generate virtual key
|
||||
|
||||
```bash
|
||||
curl -X POST 'http://0.0.0.0:4000/key/generate' \
|
||||
-H 'Authorization: Bearer sk-1234' \
|
||||
-H 'Content-Type: application/json' \
|
||||
-d '{}'
|
||||
```
|
||||
|
||||
3. Launch an agent using the virtual key
|
||||
|
||||
```bash
|
||||
curl -X POST http://0.0.0.0:4000/cursor/v0/agents \
|
||||
-H "Authorization: Bearer sk-1234ewknldferwedojwojw" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{
|
||||
"prompt": {
|
||||
"text": "Fix the failing test in test_utils.py"
|
||||
},
|
||||
"source": {
|
||||
"repository": "https://github.com/your-org/your-repo",
|
||||
"ref": "main"
|
||||
}
|
||||
}'
|
||||
```
|
||||
|
||||
## Related
|
||||
|
||||
- [Cursor Cloud Agents API Docs](https://docs.cursor.com/account/api)
|
||||
- [Pass-through Endpoints Overview](./intro.md)
|
||||
- [Virtual Keys](../proxy/virtual_keys.md)
|
||||
BIN
docs/my-website/img/cursor_add_credential.png
Normal file
BIN
docs/my-website/img/cursor_add_credential.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 28 KiB |
BIN
docs/my-website/img/cursor_log_detail.png
Normal file
BIN
docs/my-website/img/cursor_log_detail.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 44 KiB |
BIN
docs/my-website/img/cursor_logs.png
Normal file
BIN
docs/my-website/img/cursor_logs.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 45 KiB |
|
|
@ -635,6 +635,7 @@ const sidebars = {
|
|||
"pass_through/bedrock",
|
||||
"pass_through/azure_passthrough",
|
||||
"pass_through/cohere",
|
||||
"pass_through/cursor",
|
||||
"pass_through/google_ai_studio",
|
||||
"pass_through/langfuse",
|
||||
"pass_through/mistral",
|
||||
|
|
|
|||
|
|
@ -1,5 +1 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" fill="none">
|
||||
<rect width="100" height="100" rx="20" fill="#000000"/>
|
||||
<path d="M25 75V25L70 50L25 75Z" fill="white"/>
|
||||
<path d="M70 50L50 75H25L70 50Z" fill="#AAAAAA"/>
|
||||
</svg>
|
||||
<svg fill="currentColor" fill-rule="evenodd" height="1em" style="flex:none;line-height:1" viewBox="0 0 24 24" width="1em" xmlns="http://www.w3.org/2000/svg"><title>Cursor</title><path d="M22.106 5.68L12.5.135a.998.998 0 00-.998 0L1.893 5.68a.84.84 0 00-.419.726v11.186c0 .3.16.577.42.727l9.607 5.547a.999.999 0 00.998 0l9.608-5.547a.84.84 0 00.42-.727V6.407a.84.84 0 00-.42-.726zm-.603 1.176L12.228 22.92c-.063.108-.228.064-.228-.061V12.34a.59.59 0 00-.295-.51l-9.11-5.26c-.107-.062-.063-.228.062-.228h18.55c.264 0 .428.286.296.514z"></path></svg>
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 242 B After Width: | Height: | Size: 548 B |
Loading…
Add table
Reference in a new issue