ХабрПостыНовостиМегапосты?

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

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 differs 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.

So, when you buy a $20 ChatGPT subscription, you get access to ~$1,000 worth of tokens. When you buy a $100 Claude subscription, you get access to ~$2,000 worth of tokens. However, to use custom OpenAI URLs in Cursor, you’ll also need a $20 Cursor subscription.

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. It allows you to log in to Claude and ChatGPT via OAuth, launches a process to proxy requests, and establishes a Cloudflare tunnel. 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

Installation

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

Install 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"

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:

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 and Solutions

  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.

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. I would appreciate any feedback.

My Blog • Telegram Channel • Bluesky

@orchidfiles
26.05.2026 04:09 UTC
Первоисточник

Комментарии

@jetnet
26.05.2026 04:15 UTC
0

Можнно подробнее про эту магию: Ungate proxy

  • зачем он

  • где он

  • почему нельзя сразу с юзерского места

26.05.2026 04:18 UTC
0

Мне казалось если я публикую в английский хабр, то его читают только на английском :)
Это расширение нужно для использования подписок Claude и GPT в Cursor, как и следует из названия статьи. Чтобы экономить примерно 1000$ в месяц, которые мы бы потратили на оплату API токенов в курсоре.

26.05.2026 04:20 UTC
0

да что вы говорите :) Ну ладно, не хотите - не рассказывайте

26.05.2026 04:23 UTC
0

Я не знаю какие еще подобрать синонимы, чтобы объяснить зачем нужен этот Ungate proxy. Задавайте вопросы, я отвечу.

26.05.2026 04:28 UTC
0

Я задавал вопросы, смотря на диаграмму “Architecture”. Думал, что вам сразу станет понятно, о чём речь.

26.05.2026 05:17 UTC
0

Дошел в своей ленте до оригинала на русском. Понял смысл туннеля :) Меня на диаграмме смутил этот прокси-компонент, я подумал, что у вас какой-то магический сервер в облаке магически проксирует. А это “просто” хак для курсоровских серваков. Н-да… наверное очень хорошее IDE :)

26.05.2026 05:21 UTC
0

Я не до конца разобрался еще как работает хабр. Я думал, что если я публикую контент на английском, то он для англоязычной аудитории. Но мне начинает казаться, что англоязычной аудитории здесь почти нет. И даже русскоговорящие люди добавляют в ленту английский контент. И скорее всего мне не имело большого смысла публиковать английскую версию статьи. Или я ошибаюсь?

26.05.2026 05:31 UTC
0

Сорян, тут помочь не могу - просто читаю свою ленту, иногда что-то комментирую, чаще невпопад :)

26.05.2026 10:10 UTC
0

В настройках публикации выбирается язык публикации:

Все, читатели, у кого выбран русский, не увидят эту статью в ленте. А у кого выбран английский - увидят.

27.05.2026 02:21 UTC
0

Да, в статье как раз был выбран английский язык. Поэтому я удивился, что комментарии на русском.

@faiwer
27.05.2026 20:28 UTC
+1

Thx for the extension. I've raised your habr-karma. Testing the extension. BTW, what does this "0 in / 0 out" mean? I see "0.00000" in the "Token Usage Over Time". Whereas these "recent requests" were real requests in the real cursor chat.

27.05.2026 20:53 UTC
+1

Thanks! This is a bug in the code. It should show the number of tokens spent. But it isn’t working right now.