Prerequisites
Before you begin, please ensure:-
Cursor is installed
Download and install the version suitable for your operating system from Cursor Official Website -
APIMart API Key obtained
Log in to APIMart Console to get your API key (starts withsk-)
Tip: If you don’t have an APIMart account yet, please register at APIMart and obtain an API key first.
Step 1: Open Cursor Settings
After launching Cursor, navigate to the settings page:- Click the ⚙️ Settings icon (gear icon) in the top right corner
- Or use keyboard shortcuts:
- Windows/Linux:
Ctrl+Shift+J - macOS:
Cmd+Shift+J
- Windows/Linux:
Step 2: Configure Model Settings
2.1 Access Model Settings
In the settings page:- Find the Models option in the left menu
- Click to enter model settings page
2.2 Select OpenAI API Key
On the model settings page:- Find the OpenAI API Key configuration area
- Click Add new or Override OpenAI Base URL option
Important: Cursor supports OpenAI-compatible APIs, so we can configure APIMart as a custom API provider.
2.3 Configure APIMart API Information
Fill in the following configuration:| Field | Value |
|---|---|
| API Key | Your APIMart API key (sk-xxxxxxxxxxxx) |
| Base URL | https://api.apimart.ai/v1 |
Important:
- Base URL must include the
/v1suffix:https://api.apimart.ai/v1 - API Key must be obtained from APIMart console and start with
sk- - After configuration, Cursor will use APIMart’s models for code completion and chat
Step 3: Select Models to Use
3.1 Model Selection
In model settings, you can select the models to use: Available Model Types:-
GPT-4/5 Series - Suitable for complex code generation and problem-solving
gpt-5- Latest GPT-5 modelgpt-4o- GPT-4o modelgpt-4o-mini- Faster and more economical version
-
Claude Series - Suitable for code understanding and refactoring
claude-sonnet-4-5-20250929- Claude Sonnet 4.5claude-haiku-4-5-20251001- Claude Haiku 4.5
-
Other Models
gemini-2.0-flash-exp- Google Gemini 2.0 Flash
3.2 Configure Models for Specific Features
Cursor allows configuring different models for different features:- Chat - For conversing with AI
- Autocomplete - For code auto-completion suggestions
- Cmd+K (Quick Edit) - For quick code editing and generation
Step 4: Start Using
After configuration, you can start using Cursor’s AI features:4.1 AI Chat (Cmd+L / Ctrl+L)
- Press
Cmd+L(macOS) orCtrl+L(Windows/Linux) to open AI chat panel - Enter your question or request, for example:
- “How to implement a quicksort algorithm?”
- “Help me optimize this code’s performance”
- “Explain how this function works”
4.2 Code Completion
- Write code normally in the editor
- Cursor will automatically provide code completion suggestions
- Press
Tabto accept suggestions
4.3 Quick Edit (Cmd+K / Ctrl+K)
- Select the code you want to edit
- Press
Cmd+K(macOS) orCtrl+K(Windows/Linux) - Enter editing instructions, for example:
- “Add error handling”
- “Refactor this function”
- “Add type annotations”
4.4 Code Explanation
- Select the code you want to understand
- Right-click and select “Explain with AI” or use shortcut
- AI will explain the code’s functionality and logic in detail
FAQ
Q1: Cannot connect to APIMart service?
Solution:-
Check Base URL:
- Ensure Base URL is
https://api.apimart.ai/v1(note the/v1suffix) - Don’t omit or add extra paths
- Ensure Base URL is
-
Verify API Key:
- Confirm API Key is correct and starts with
sk- - Check if the key is valid in APIMart Console
- Confirm API Key is correct and starts with
-
Check Network Connection:
- Ensure you can access
https://api.apimart.ai - You may need to configure a proxy if in China
- Ensure you can access
Q2: AI response is slow?
Solution:-
Switch to a faster model:
- Use
gpt-4o-miniinstead ofgpt-4o - Use
gemini-2.0-flash-expfor faster responses
- Use
-
Reduce context length:
- Limit the code context sent to AI
- Use more precise question descriptions
-
Check network conditions:
- Test network latency
- Consider using a proxy to optimize connection
Q3: API call fails or returns errors?
Common errors and solutions:| Error Message | Cause | Solution |
|---|---|---|
401 Unauthorized | Invalid or expired API Key | Re-obtain API Key and update configuration |
429 Too Many Requests | Request rate limit exceeded | Wait a moment and retry |
500 Internal Server Error | Temporary server issue | Wait a few minutes and retry |
insufficient_quota | Insufficient account balance | Top up in the console |
Q4: How to view API usage and costs?
Log in to APIMart Console to view:- 📊 API call statistics
- 💰 Cost details
- 📈 Usage trend charts
- 🔍 Detailed request logs
Usage Tips
1. Leverage Context
Cursor automatically includes relevant code context. You can:- Open related files to let AI understand project structure
- Use
@filenameto reference specific files - Use
@folderto reference entire folders
2. Write Clear Prompts
Good prompts lead to better results: ❌ Poor Prompt:3. Iterative Development
When collaborating with AI:- Start with simple requirements
- Gradually refine and optimize
- Test and validate promptly
- Adjust prompts based on results
4. Utilize Project Standards
Create a.cursorrules file to define:
- Code style guidelines
- Naming conventions
- Architecture patterns
- Testing requirements
Features
Using Cursor + APIMart, you can:- 💬 Intelligent Chat - Ask programming questions anytime, get detailed answers
- ⚡ Code Completion - Real-time intelligent code suggestions and completion
- ✏️ Quick Edit - Quickly modify code through natural language
- 🔍 Code Understanding - Deeply understand how complex code works
- 🐛 Debugging Assistant - Help find and fix code bugs
- 📝 Documentation Generation - Automatically generate code comments and documentation
- 🔄 Code Refactoring - Intelligently refactor and optimize code structure
- 🧪 Test Generation - Automatically generate unit tests and test cases
Support & Help
If you encounter any issues:- 📚 APIMart Documentation
- 💬 Discord Community
- 🐦 Twitter @APIMart_
- 📧 Technical Support: zhihong@apimart.ai
Start Using APIMart
Register for APIMart now, get your API key, and boost your programming efficiency!