1. AI App
Nebula-API操作文档
🇺🇸English
  • 🇨🇳中文
  • 🇺🇸English
  • Chat
    • General Text Dialogue Interface Document
    • Tongyi Qianwen General Dialogue Interface Document
    • DeepSeek General Dialogue Document
    • GPT Chat General Dialogue Document
    • Grok Model (xAI) General Dialogue Interface Document
  • Image
    • General Image Generation Interface Document
    • Nano Banana Image Generation Interface Document
    • Tongyi Qianwen Text to Image Model Interface Document
    • Tongyi Qianwen Image Editing Model Interface Document
  • Video
    • Sora-2 interface document
    • Alibaba Wanxiang Wan2.5 Tu Sheng Video Interface Document
    • Google Veo Video Model Interface Document
    • General Video Generation Interface Document
  • AI App
    • Cherry Studio Integration Guide
    • LangChain Development Framework Integration Guide
    • Cursor Code Editor Integration Guide
    • Claude Code and other client integration guidelines
    • Cline (VS Code) AI Programming Assistant Integration Guide
    • Immersive Translation Integration Guide
  • Real time conversation
    • Realtime real-time conversation document
  1. AI App

Cursor Code Editor Integration Guide

Cursor User Guide#

I. Product Introduction#

Cursor is an AI-powered code editor. By integrating Nebula Lab, you can access powerful AI assistance while writing code, supporting intelligent code generation, completion, explanation, and optimization.

II. Quick Configuration Steps#

1. Open Settings#

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

2. Configure API#

OpenAI API Key: Enter your Nebula Lab key (use the default token directly).
Override OpenAI Base URL: Check this box and enter https://llm.ai-nebula.com/v1.
Click Verify to confirm the configuration works.

3. Model Configuration Instructions#

Important Limitation: Cursor currently does not support Agent mode, only Chat mode (you need to manually apply AI-generated code to actual files).
Suggestion for Beginners: If you rely on Agent mode for Vibe Coding, you can choose:
Purchase a Cursor official membership to use native services.
Alternatives: VS Code's RooCode or Cline extensions (both support Agent mode).

III. Recommended Model Configuration#

Based on performance and cost-effectiveness, the following model configurations are recommended:
TypeRecommended Model IDFeatures
Top Choice for Codingclaude-sonnet-4-20250514Claude 4 Sonnet, strongest coding capability
gpt-4.1Fast speed, strong comprehensive capability
deepseek-v3Excellent in Chinese coding, high cost-performance ratio
Cost Optimizationgpt-4.1-miniLightweight but capable
claude-3-haikuCheapest in Claude series
gemini-2.5-flashGoogle fast response model
Reasoning Enhancemento4-miniTop choice reasoning model for coding tasks
o3Suitable for complex reasoning and algorithmic problems

Add Custom Models#

Add the following model IDs in Cursor settings:
claude-sonnet-4-20250514
gpt-4.1
deepseek-v3
o4-mini
gemini-2.5-pro

IV. Usage Mode Explanation#

Chat Mode Workflow#

Since Agent mode is not supported, the recommended workflow is as follows:
1.
Generate Code via Chat:
Use Ctrl/Cmd + L to open the chat window.
Describe requirements and let AI generate code snippets.
2.
Manually Apply Code:
Copy code from the chat window and paste it into the target file.
Or use the "Apply" button (if available).
3.
Iterative Optimization:
Continue the dialogue to request modifications and repeat the application process.

Alternative Solutions Comparison#

ToolAgent ModeProsCons
Cursor❌Elegant interface, good completion experienceNo Agent mode
Cline (VS Code)✅Full Agent features, can automatically modify filesRequires VS Code
RooCode (VS Code)✅Agent mode, supports multi-file editingNewer, features still being polished
Continue (VS Code)✅Open source, highly customizableConfiguration is relatively complex

V. Core Functions#

Intelligent Code Completion#

Tab Completion: Press Tab to accept AI suggestions.
Multi-line Completion: Supports function-level code generation.
Context Awareness: Provides precise suggestions based on project structure.

AI Chat#

Ctrl/Cmd + K: Open Command Palette.
Ctrl/Cmd + L: Open Sidebar Chat.
Code Explanation: Select code to directly ask AI for its meaning or optimization direction.

Code Editing#

Generate Code: Describe requirements, and AI automatically generates complete code snippets.
Refactoring Suggestions: Get code structure optimization plans.
Error Fixing: AI assists in locating and fixing syntax/logic errors.

VI. Shortcuts#

ShortcutFunction
Ctrl/Cmd + KOpen AI Command Palette
Ctrl/Cmd + LOpen AI Chat Sidebar
TabAccept code suggestion
EscCancel current suggestion

VII. Usage Tips#

1. Provide Clear Context#

2. Optimize Prompts#

Bad Example: "Fix this function"
Good Example: "Fix the floating-point precision issue in the calculateTotal function, ensuring amounts are calculated to two decimal places"

3. Make Full Use of Chat Mode#

Let AI generate complete file content.
Request detailed modification instructions.
Use for code review and refactoring suggestions.

VIII. Troubleshooting#

Connection Timeout#

Check if the network connection is normal.
Confirm the API URL is https://llm.ai-nebula.com/v1.
Verify the validity of the API Key.

Model Not Responding#

Check if the account balance is sufficient.
Try switching to another model.
Restart the Cursor client.

Poor Quality Code Suggestions#

Provide more project context (e.g., frameworks, dependency versions).
Use more specific prompts.
Try switching to a better-performing model (e.g., claude-sonnet-4-20250514).

IX. Best Practices#

Project-Level Configuration#

Create .cursor-settings.json in the project root directory to unify configuration rules:
{
 "model": "gpt-4.1",
 "temperature": 0.7,
 "contextFiles": ["README.md", "package.json"],
 "rules": [
  "Use TypeScript strict mode",
  "Follow ESLint standards",
  "Add appropriate comments"
 ]
}

Code Standards#

Explicitly state standard requirements in prompts, for example:
Use TypeScript
Follow Airbnb standards
Add JSDoc comments
Adopt functional style

Security Awareness#

Avoid including sensitive information (such as keys, tokens) in the code.
Review AI-generated code to verify logic security.
Check the security of third-party dependencies (e.g., via npm audit).

X. Integration Workflow#

Git Integration#

Test-Driven Development (TDD)#

1.
Write test cases first.
2.
Let AI generate implementation code.
3.
Run tests to verify results.
4.
Iteratively optimize code.

Code Review#

Use AI for automated review:
Please review this code, focusing on:
1. Performance issues
2. Security vulnerabilities
3. Code standards
4. Best practices

XI. Supplement on Agent Mode#

If you need AI to automatically modify multiple files or perform complex refactoring tasks, the following tools are recommended:
Cline: VS Code extension, supports full Agent features, can automatically modify files.
RooCode: Emerging VS Code AI Agent extension, supports multi-file editing.
修改于 2025-12-04 07:48:50
上一页
LangChain Development Framework Integration Guide
下一页
Claude Code and other client integration guidelines
Built with