Back to Blog
TutorialsNovember 3, 20266 min read

How to Use a Free LLM API Key with Cursor IDE (No Paid Plan Needed)

Exact steps to configure Cursor IDE with a custom OpenAI-compatible API key — get GPT-4o and Claude in Cursor for free.

Why Cursor IDE?

Cursor has become one of the most popular AI-native code editors on the market. It wraps VSCode's interface around a deeply integrated AI assistant that can understand your entire codebase, write multi-file changes, and answer questions about your code in context. The problem is that Cursor's Pro plan costs $20/month, and the free tier has heavily throttled completions.

What most developers do not realize is that Cursor supports a custom API endpoint. This means you can plug in your own API key pointing to any OpenAI-compatible server — and a free OpenRouter key (one key for GPT-4o, Claude, DeepSeek and more) is a perfect fit.

What You Need

  • Cursor IDE installed (download from cursor.com — the free tier works fine for this)
  • A free API key you create yourself — OpenRouter is the easiest (one key, many models)
  • The base URL: https://openrouter.ai/api/v1

Step-by-Step Setup

Step 1 — Open Cursor Settings

Open Cursor IDE. Press Cmd + Shift + J (Mac) or Ctrl + Shift + J (Windows/Linux) to open Cursor Settings. Alternatively, go to Cursor menu → Preferences → Cursor Settings.

Step 2 — Navigate to Models

In the settings sidebar, click Models. You will see the model management screen where Cursor shows its built-in models (GPT-4o, Claude 3.5 Sonnet, etc.).

Step 3 — Enable Custom API

Scroll down to the section labeled OpenAI API Key or Override OpenAI Base URL. You will see two input fields:

  • API Key: paste your OpenRouter key here (e.g., sk-or-xxxxxxxxxxxxxxxx)
  • Override OpenAI Base URL: enter https://openrouter.ai/api/v1

Make sure the toggle for "Use custom API key" or similar is enabled.

Step 4 — Select Your Model

Back in the Models list, make sure gpt-4o or claude-sonnet-4 is checked. These are the models that work best inside Cursor (on OpenRouter, enter the full ids such as openai/gpt-4o).

Step 5 — Test It

Open any file in your project. Press Cmd + K to open the inline edit prompt, type a request like "add error handling to this function", and hit Enter. If it works, you are in.

Which Models Work Best in Cursor?

  • gpt-4o — Best for general coding tasks, explanations, and refactoring. Very fast.
  • claude-sonnet-4 or claude-opus-4 — Excellent for longer context tasks, documentation writing, and nuanced code review.
  • deepseek-chat — Great for purely algorithmic or math-heavy code problems.

Troubleshooting

The key returns an error: Double-check the key is correct and still active. If needed, create a fresh key on your provider dashboard and paste it into Cursor settings.

Model not available: If you get a "model not found" error, try switching to gpt-4o which has the broadest availability.

Slow responses: Free tiers are rate-limited. If it feels slow, try again shortly or switch to a faster provider like Groq.

How This Compares to GitHub Copilot

GitHub Copilot costs $10–19/month. Cursor Pro costs $20/month. With a free OpenRouter key, you get comparable AI assistance in Cursor for free — with the bonus that you can switch between GPT-4o, Claude, and DeepSeek on demand. The free tier is rate-limited rather than unlimited, but for a solo developer building personal projects or learning, this is an excellent deal.

F
FreeLLMKeys Team
Building tools for the AI developer community