Live
Black Hat USAAI BusinessBlack Hat AsiaAI BusinessMicrosoft executive touts Copilot sales traction as AI anxiety weighs on stock - CNBCGoogle News: AIAnthropic Brings Claude Computer Use to Windows - Thurrott.comGoogle News: Claude[D] Physicist-turned-ML-engineer looking to get into ML research. What's worth working on and where can I contribute most?Reddit r/MachineLearning🔥 Alishahryar1/free-claude-codeGitHub Trending🔥 roboflow/supervisionGitHub Trending🔥 zai-org/GLM-OCRGitHub Trending🔥 MervinPraison/PraisonAIGitHub Trending🔥 sponsors/asgeirtjGitHub TrendingHow Does AI-Powered Data Analysis Supercharge Investment Decisions in Today's Inflationary World?Dev.to AIClaude has Angst. What can we do?LessWrongSame Prompt. Different Answers Every Time. Here's How I Fixed It.Dev.to AICan AI Predict the Next Stock Market Crash? Unpacking the Hype and Reality for Global InvestorsDev.to AIBlack Hat USAAI BusinessBlack Hat AsiaAI BusinessMicrosoft executive touts Copilot sales traction as AI anxiety weighs on stock - CNBCGoogle News: AIAnthropic Brings Claude Computer Use to Windows - Thurrott.comGoogle News: Claude[D] Physicist-turned-ML-engineer looking to get into ML research. What's worth working on and where can I contribute most?Reddit r/MachineLearning🔥 Alishahryar1/free-claude-codeGitHub Trending🔥 roboflow/supervisionGitHub Trending🔥 zai-org/GLM-OCRGitHub Trending🔥 MervinPraison/PraisonAIGitHub Trending🔥 sponsors/asgeirtjGitHub TrendingHow Does AI-Powered Data Analysis Supercharge Investment Decisions in Today's Inflationary World?Dev.to AIClaude has Angst. What can we do?LessWrongSame Prompt. Different Answers Every Time. Here's How I Fixed It.Dev.to AICan AI Predict the Next Stock Market Crash? Unpacking the Hype and Reality for Global InvestorsDev.to AI
AI NEWS HUBbyEIGENVECTOREigenvector

How to use a Claude Subscription in Cursor without paying for API tokens

Dev.to AIby Orchid FilesApril 2, 20265 min read1 views
Source Quiz

In Cursor, you can connect any LLM via API that is compatible with the OpenAI request format. This means you can connect Claude via API and pay for tokens. However, if you have a Claude subscription, you can only use it in Claude Code. There, the request format is Anthropic, which differs from OpenAI. You cannot take your Claude subscription and add it to Cursor because the request formats are incompatible. You cannot make requests to the Claude API using a Claude subscription. There are already solutions on GitHub that proxy requests from Cursor to Claude using the subscription without paying for API tokens. They convert the OpenAI format to Anthropic and back. But to add this to Cursor, it's not enough to simply run the process on localhost and add the URL to Cursor, because Cursor first

In Cursor, you can connect any LLM via API that is compatible with the OpenAI request format. This means you can connect Claude via API and pay for tokens. However, if you have a Claude subscription, you can only use it in Claude Code. There, the request format is Anthropic, which differs from OpenAI. You cannot take your Claude subscription and add it to Cursor because the request formats are incompatible. You cannot make requests to the Claude API using a Claude subscription.

There are already solutions on GitHub that proxy requests from Cursor to Claude using the subscription without paying for API tokens. They convert the OpenAI format to Anthropic and back. But to add this to Cursor, it's not enough to simply run the process on localhost and add the URL to Cursor, because Cursor first sends requests to its own backend, and from there to the 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, and Cloudflare is perfect for this. With a single cloudflared tunnel command, you can set up a tunnel that provides a public URL and routes traffic to your localhost. You add this URL to Cursor.

How it works

  • Start the proxy process that converts requests between OpenAI and Anthropic formats

  • Set up a Cloudflare tunnel and add the URL to Cursor

  • Send a message in the Cursor chat; it sends a request to its backend

  • From the backend, it sends a request to Cloudflare, which forwards it to your localhost

  • The proxy process receives the request from Cloudflare and sends it to Claude

  • The proxy process receives the response from Claude and sends it to Cloudflare

  • Cloudflare returns the response to the Cursor backend, which sends it to the IDE

  • You see the response in the chat

Various solutions on GitHub 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 solutions, only the chat is properly proxied, but any use of tools such as reading, modifying files, or creating plans is not supported. Others support tools, but not all of them; for example, sending images or asking questions when creating plans is not supported.

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 via OAuth, launches a process to proxy requests, and establishes a Cloudflare tunnel. The entire setup takes 30 seconds, and you can use your Claude subscription in Cursor without paying for API tokens.

Project repository: https://github.com/orchidfiles/ungate VSX Marketplace: https://open-vsx.org/extension/orchidfiles/ungate Installation from the terminal: cursor --install-extension orchidfiles.ungate

After installing the extension in Cursor, an "Ungate :47821" button will appear in the status bar. This means that the proxy service is running on port 47821. Clicking the button will open the Dashboard, which displays statistics on proxied requests and settings. In the settings, you can change the port, restart the tunnel, log in to Claude via OAuth, and view the tunnel and proxy logs. After starting the tunnel, you will receive a URL from Cloudflare. You need to paste this URL into Cursor Settings -> Models -> API Keys -> Override OpenAI Base URL. You also need to paste the API Key, which is displayed on the same settings page, into Cursor Settings -> Models -> API Keys -> OpenAI API Key. This is not related to your Claude subscription. It is just an API key for the proxy service, so other people cannot send requests through your proxy if they do not know this key. It is generated when you install the extension. After configuring these settings, you can select any Claude model in the Cursor chat, and all requests will go through your Claude subscription.

Important details

  • Anthropic allows the subscription to be used only in Claude Code and prohibits its use in other tools

  • When you first run the proxy, the extension downloads a build of better-sqlite3 compatible with your OS and Cursor version

  • When you first launch the tunnel, the extension downloads a build of cloudflared

  • When adding or changing tools, you must add them to the mapping Cursor tools -> Claude Code tools -> Cursor tools

  • When adding new Sonnet, Opus, or Haiku models, you must add them to the code

  • There are issues when making changes to large documents and plans; you need to ask the agent to make changes in parts

Was this article helpful?

Sign in to highlight and annotate this article

AI
Ask AI about this article
Powered by Eigenvector · full article context loaded
Ready

Conversation starters

Ask anything about this article…

Daily AI Digest

Get the top 5 AI stories delivered to your inbox every morning.

Knowledge Map

Knowledge Map
TopicsEntitiesSource
How to use …claudemodellaunchversionservicefeatureDev.to AI

Connected Articles — Knowledge Graph

This article is connected to other articles through shared AI topics and tags.

Knowledge Graph100 articles · 175 connections
Scroll to zoom · drag to pan · click to open

Discussion

Sign in to join the discussion

No comments yet — be the first to share your thoughts!

More in Products