Using Ahur AI in Cursor
A complete guide to using the Ahur AI API inside the Cursor development environment
Introduction
This guide walks you through using the Ahur AI API inside the Cursor development environment so you can take advantage of a wide range of AI models.
1. Get an API Key
To use Ahur AI in Cursor, you first need to obtain an API key:
- Go to the API Keys section of the Ahur developer panel
- Create a new key and store it somewhere safe
2. Configure the Ahur AI Key in Cursor
Cursor lets you use custom models through an OpenAI-compatible API. To connect Ahur AI:
- Open Cursor's settings from the top right
- Go to the Models tab
- Under OpenAI API Key, click Override OpenAI Base URL, enter the value below, and click Save:
https://api.ahur.ir/v1
- Enter your API key in the API Key field
- Click the Verify button
You can find the full list of models on the Ahur pricing page.
3. Security and Cost Management Tips
- Never share your API key with anyone
- Track your usage and costs in the usage statistics section
- Each model has a different cost; check the prices on the pricing page before using one
4. Available Models
The Ahur platform offers a diverse set of AI models:
| Model | Use Case | Cost |
|---|---|---|
| Ahur Base | General tasks and fast responses | Low |
| Ahur Pro | Text analysis and content generation | Medium |
| Ahur Enterprise | Complex processing and analytics | High |
5. Practical Examples
Code Generation
You can use Ahur to generate code in a variety of languages:
// A request to generate a TypeScript function
function calculateArea(width: number, height: number): number {
return width * height;
}
Code Analysis
To analyze and optimize existing code:
// JavaScript code to analyze
const data = [1, 2, 3, 4, 5];
const sum = data.reduce((acc, val) => acc + val, 0);
Documentation
Generating documentation for your code:
# A Python function with documentation
def process_data(input_data):
"""
This function processes the input data
Args:
input_data: the input data to process
Returns:
the processed data
"""
return processed_data
6. Common Troubleshooting
Connection Issues
If you run into a connection error:
- Check that the API URL was entered correctly:
https://api.ahur.ir/v1 - Make sure the API key is valid
- Make sure your internet connection is stable
Rate Limits
If you hit a rate limit error:
- Wait a moment and try again
- Upgrade your plan for higher limits
Poor Responses
To get better responses:
- Write clear, precise requests
- Use appropriate sample code
- Provide enough context for your request
7. Further Resources
If you run into problems or need more help, reach out to Ahur support.