DEV Community

Cover image for How to use Claude and ChatGPT subscriptions in Cursor instead of paying for API tokens
Orchid Files
Orchid Files

Posted on • Edited on

How to use Claude and ChatGPT subscriptions in Cursor instead of paying for API tokens

TL;DR: Claude and ChatGPT subscriptions can be used in Cursor through OAuth login and a local proxy exposed via a Cloudflare tunnel — no API tokens needed. The open-source extension automates the whole flow: login, proxy, and tunnel are handled in one minute. Install and configure it: https://github.com/orchidfiles/ungate


In Cursor, you can connect any LLM via API that is compatible with the OpenAI request format. However, if you have a Claude or ChatGPT subscription, you won't be able to use them directly in Cursor. Their request formats differ from the OpenAI API format, so you'll need a workaround — proxying the requests.

There are already solutions on GitHub that convert the OpenAI format to the provider's required format and back. But to add this to Cursor, simply running the process on localhost and adding it to Cursor is not enough, because Cursor first sends requests to its own backend, and from there to an OpenAI-compatible API. If you add localhost there, their backend simply won't be able to reach it. That's why you need to set up a tunnel that forwards traffic to your localhost. Cloudflare is very well suited for this. With the cloudflared tunnel command, you can start a tunnel and add the tunnel address to Cursor.
 

Ungate

Ungate is an open-source Cursor extension that connects your Claude or ChatGPT subscription to Cursor's native chat. You log in via OAuth in your browser, the extension runs a local proxy that converts the request formats, and it sets up a Cloudflare tunnel automatically. The whole setup takes one minute.

Most existing solutions retrieve the Claude subscription token in two ways. The first method works only if you already have the Claude CLI installed and are logged in to it. It retrieves the token that the Claude CLI has stored on your system. The second method is not tied to the Claude CLI and allows you to log in to Claude in your browser using OAuth and add the token.

These solutions do not support everything required for development. In some of them, only chat is proxied properly, while tool use, such as modifying files or using planning mode, is not supported. Others support only some tools, but not all of them. In some cases, only Claude is supported, and ChatGPT does not work.

I took the best features from these solutions, added support for all tools, and created a Cursor extension:

  • OAuth login for Claude and ChatGPT, no CLI required
  • Full tool support: chat, file edits, planning mode
  • Automatic Cloudflare tunnel — no manual cloudflared setup
  • Dashboard with request statistics and logs
  • Auto-fix for Cursor silently disabling the custom Base URL setting

The entire setup takes just one minute, and you can use your subscriptions in Cursor instead of paying for API tokens.

GitHub: https://github.com/orchidfiles/ungate
 

Claude vs ChatGPT subscriptions in Cursor

Both subscriptions work through the same proxy flow, so the choice mostly comes down to models. Claude keeps its token refreshed automatically. ChatGPT needs re-authorization via OAuth every few weeks — until you do it, requests will fail with an error.

Beyond that, the difference is the models themselves. Any Claude model is available via a custom model ID, and the same applies to GPT models.

The economics are straightforward:

  • A $20 ChatGPT subscription gives access to ~$1,000 worth of tokens
  • A $100 Claude subscription gives access to ~$2,000 worth of tokens
  • Total cost: $20 for a Cursor subscription plus your existing provider subscription — instead of paying for API tokens

You can also connect both subscriptions at the same time and switch between them in the same chat.
 

Official extensions vs Ungate

Anthropic ships its own Claude Code extension for Cursor (anthropic.claude-code). OpenAI ships a mirror one — the Codex extension (openai.chatgpt). Both are official, and both work differently from Ungate:

Aspect Official extensions (Claude Code, Codex) Ungate
Where requests run A separate agent panel with its own UI, context, and history The native Cursor chat: Chat, Agent, and Composer
Providers One provider per extension — Claude Code only works with Claude, Codex only with GPT Claude and ChatGPT subscriptions in one place
Model picker Only the models of that one provider Any Claude or GPT model, switch providers in one place
Setup The official extension/CLI plus the matching subscription OAuth login in browser, one minute total
Cursor UX Separate workflow, separate diff review Native Cursor diffs, context, and tools

The official extensions put a second agent with its own workflow next to Cursor — Claude Code locked to Claude, Codex locked to GPT. Ungate does the opposite: it routes requests through your subscription inside the native Cursor interface, so you keep the model picker, diff review, and context you already know — and you can use the same setup for both Claude and ChatGPT.

In practice this means a workflow that no official extension can offer: ask GPT through your subscription to write a solution, then ask Claude through your subscription to review the result in the same chat. When you're ready to implement, toggle proxying off with one button right below the chat, switch to Cursor's Composer, and later turn proxying back on to have GPT or Claude check the changes.
 

Installation

You can install the extension from the Extensions panel in Cursor by searching for @id:orchidfiles.ungate.

Installation from the terminal: cursor --install-extension orchidfiles.ungate

You can also compile the extension from source:

git clone https://github.com/orchidfiles/ungate.git
cd ungate
pnpm install
pnpm run package:build
cursor --install-extension "apps/extension/out/ungate.vsix"
Enter fullscreen mode Exit fullscreen mode

After installing the extension in Cursor, a button labeled Ungate: API running | Tunnel stopped appears in the status bar. It means the proxy service is running and the tunnel is paused. Clicking it opens the Dashboard with proxied request statistics and settings. In Settings, you can change the port, restart the tunnel, log in to Claude and ChatGPT via OAuth, and view the tunnel and proxy logs.
 

Initial setup:

  1. Start a tunnel in the dashboard and get the URL from Cloudflare.
  2. Paste this URL into Cursor Settings -> Models -> API Keys -> Override OpenAI Base URL.
  3. Copy the API Key from the dashboard and paste it into Cursor Settings -> Models -> API Keys -> OpenAI API Key. This is not your subscription key, but the API key for the proxying service, so that other people cannot make requests to your localhost. It's generated when the extension is installed.
  4. Copy the ID of the desired model and add a custom model in Cursor using that exact name.

Once you've done this, you can select this model in Cursor chat, and all requests will be routed through your subscription.

The extension has a quick actions menu. When you hover over the extension in the status bar, a tooltip will appear. In it, you can restart the tunnel, copy the tunnel address, and toggle request proxying.
 

Issues, Limits, and Notes

  1. Cursor automatically disables the custom OpenAI Base URL setting every few hours, causing all requests to go through API tokens again. This "bug" has existed for a very long time, and they haven't fixed it. I think it's not economically viable for them to fix this bug. The extension automatically checks whether this setting is enabled. When Cursor unchecks this, the extension re-enables it.
  2. Standard model names in Cursor only work for certain providers. For example, if you send a request using the built-in GPT-5.4 model, the request will go through the proxy using your subscription. But if you use Sonnet 4.7, the request will go through the API to Claude using tokens. In the extension, you can create custom model names and add them to Cursor so that requests are guaranteed to go through the proxy.
  3. To avoid releasing a new extension for every version of Node and OS, the extension downloads the better-sqlite3 and cloudflared builds from their repositories during the initial installation.
  4. If you disconnect your laptop from the internet and then reconnect, you need to restart the tunnel. If you see "Reconnecting..." when making a request in the chat, you need to restart the tunnel.
  5. If you receive a 401 error when making requests, it means you have an incorrect API key. You need to go to the extension's Dashboard, copy the api-key, and paste it into Cursor Settings -> Models -> API Keys -> OpenAI API Key.
  6. If you receive a 404 error, it means the tunnel is not running or the tunnel address is incorrect.
  7. Automatic token refresh only works for Claude. With ChatGPT, you need to re-authorize your account via OAuth every few weeks.
  8. Your usage through the proxy counts against the same limits as your regular subscription usage. The dashboard shows proxied request statistics, so you can track consumption. If you hit a limit, the provider throttles or blocks requests until the usage window resets.
  9. Using a subscription outside official clients sits in a gray zone. Anthropic updated its terms in February 2026 to prohibit extracting OAuth tokens outside the official Claude Code client; OpenAI has similar restrictions. I have been using this setup for over six months without account issues, but that is not a guarantee. Use it at your own risk — the code is open source, so you can audit exactly what it does.

If something does not work in the extension, or if you have any questions, please create an issue on GitHub or write here in the comments. Contributions are welcome: open a pull request if you want to improve the code — I review all PRs within 24 hours and either merge them or leave comments.

BlogTelegram channel

Top comments (0)