# Configurable Rate Limiting for Agents with User-Provided API Keys

**URL:** <https://forum.cursor.com/t/configurable-rate-limiting-for-agents-with-user-provided-api-keys/114649>\
**Category:** Feature Requests\
**Created:** [July 7, 2025, 10:39am UTC](https://forum.cursor.com/t/configurable-rate-limiting-for-agents-with-user-provided-api-keys/114649 "2025-07-07T10:39:17Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ianmarr](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/ianmarr/32/39249_2.png) [@ianmarr](https://forum.cursor.com/u/ianmarr)\
**Post date:** [July 7, 2025, 10:39am UTC](https://forum.cursor.com/t/configurable-rate-limiting-for-agents-with-user-provided-api-keys/114649/1 "2025-07-07T10:39:17Z")

</div>

## Problem Statement

When using a user-provided model API key with Cursor’s Agent, users frequently encounter “User API Key Rate limit exceeded” errors, particularly with high-volume tasks in Agent mode. These errors occur when the Agent submits a large number of requests within a short period, thereby overwhelming the API provider’s rate limits. Currently, Cursor does not enforce rate limits on user-provided keys, relaying the provider’s error without mitigation, which halts the Agent’s work and risks losing progress. This disrupts workflows, particularly for power users who rely on premium models.

## Proposed Feature

Introduce a configurable rate-limiting system for Cursor’s Agent when using user-provided API keys, with options for automatic detection of model-specific limits or manual configuration. Additionally, implement robust error handling to retry requests and recover from rate-limit errors without losing work.

### Key Components

1. **Configurable Rate Limiting** :
  - **Automatic Detection** : Cursor detects the API provider’s rate limits (e.g., requests per minute [RPM], input tokens per minute [ITPM], output tokens per minute [OTPM]) for the selected model by querying the provider’s API or referencing documentation (e.g., Anthropic’s rate limit headers). Limits are applied to throttle Agent requests.
  - **Manual Configuration** : Users can specify custom limits per model in Cursor’s settings (e.g., max RPM, ITPM, OTPM) to align with their API plan or preferences.
  - **Delay Mechanism** : Introduce a configurable delay between requests (e.g., 100ms–1s) to spread out Agent activity, preventing bursts that trigger rate limits.

2. **Enhanced Error Handling and Recovery** :
  - **Retry with Exponential Backoff** : When a 429 error occurs, Cursor retries the request using exponential backoff (e.g., wait 2^attempt seconds) to reduce server load. Respect the API’s “Retry-After” header if provided.
  - **Progress Preservation** : Cache intermediate Agent outputs locally to prevent loss of work during rate limit interruptions. Resume from the last successful request after the retry succeeds.
  - **User Notifications** : Display a non-disruptive notification (e.g., in the editor or status bar) when nearing rate limits, with options to pause, switch models, or enable usage-based pricing.

3. **Settings Integration** :
  - Add a “Rate Limiting” section in Cursor’s API key settings, allowing users to toggle automatic detection, set manual limits, or adjust retry behaviour.
  - Provide model-specific presets (e.g., Claude 3.5 Sonnet: 500 RPM, 50,000 ITPM) for common providers to simplify setup.

### Benefits

- **Prevent Disruptions** : Rate limiting reduces 429 errors, ensuring smoother Agent operation for complex tasks like multi-file edits or composer workflows.
- **User Control** : Manual and automatic options cater to both novice and advanced users, aligning with diverse API plans (e.g., free tiers and Pro accounts).
- **Work Preservation** : Enhanced retry and recovery mechanisms prevent loss of progress, improving reliability for long-running tasks.
- **Cost Efficiency** : By avoiding excessive requests, users stay within their API quotas, reducing unexpected costs or the need for usage-based pricing.
- **Centralised Model Use Monitoring and Billing** : Users can monitor their use and billing of model subscriptions across multiple services in the model’s console, rather than being “hidden” in Cursor.

## Implementation Considerations

- **API Provider Compatibility** : Ensure compatibility with major providers (OpenAI, Anthropic, Google) by parsing rate limit headers or maintaining a database of known limits.
- **Performance Trade-Offs** : Balance request delays with Agent responsiveness to avoid sluggish performance. Allow users to adjust delay sensitivity.
- **UI/UX** : Seamlessly integrate settings into the existing API key dashboard, with clear tooltips explaining the difference between automatic and manual modes.

---

<div class="post-metadata">

**Author:** ![Viktor1](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/viktor1/32/118373_2.png) [@Viktor1](https://forum.cursor.com/u/Viktor1)\
**Post date:** [December 18, 2025, 4:44pm UTC](https://forum.cursor.com/t/configurable-rate-limiting-for-agents-with-user-provided-api-keys/114649/2 "2025-12-18T16:44:18Z")

</div>

I am tier 3 at GCP. Currently trying to use gemini-3-pro-preview and I’m getting the error below in spite of using gemini-3-pro-preview outside cursor. It works and my rate-limiting with GCP isn’t affecting the requests. We are processing close 100K requests per day to Gemini models and our plan and accounts allow for even more. Cursor however hits errors when using my private API key for gemini models.

Request ID: 04bfecf6-a059-44e4-8086-2748907129e2  
{“error”:“ERROR\_OPENAI”,“details”:{“title”:“Unable to reach the model provider”,“detail”:“We encountered an issue when using your API key: Streaming error\n\nAPI Error:\n\n`\n{\"error\":{\"type\":\"provider\",\"reason\":\"provider_error\",\"message\":\"Provider returned 429\",\"retryable\":true,\"provider\":{\"status\":429,\"body\":\"[{\\n \\\"error\\\": {\\n \\\"code\\\": 429,\\n \\\"message\\\": \\\"Resource has been exhausted (e.g. check quota).\\\",\\n \\\"status\\\": \\\"RESOURCE_EXHAUSTED\\\"\\n }\\n}\\n]\"}}}\n`”,“additionalInfo”:{},“buttons”:,“planChoices”:},“isExpected”:true}

---

<div class="post-metadata">

**Author:** ![kaster](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/kaster/32/23925_2.png) [@kaster](https://forum.cursor.com/u/kaster)\
**Post date:** [December 18, 2025, 7:23pm UTC](https://forum.cursor.com/t/configurable-rate-limiting-for-agents-with-user-provided-api-keys/114649/3 "2025-12-18T19:23:00Z")

</div>

Same here. Gemini tier 3. Requests are nowhere near the limits. But keep getting 429 status it’s infuriating.

---

<div class="post-metadata">

**Author:** ![iOni](https://avatars.discourse-cdn.com/v4/letter/i/2bfe46/32.png) [@iOni](https://forum.cursor.com/u/iOni)\
**Post date:** [December 22, 2025, 8:45pm UTC](https://forum.cursor.com/t/configurable-rate-limiting-for-agents-with-user-provided-api-keys/114649/4 "2025-12-22T20:45:23Z")

</div>

Facing the same issue. I have to keep saying “continue”. It’s frustrating.
