<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Li Xixiong</title>
    <description>The latest articles on DEV Community by Li Xixiong (@lixixiong999).</description>
    <link>https://dev.to/lixixiong999</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4198214%2F7def523f-1cc4-4144-a583-5ac77e48f622.png</url>
      <title>DEV Community: Li Xixiong</title>
      <link>https://dev.to/lixixiong999</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/lixixiong999"/>
    <language>en</language>
    <item>
      <title>Use Claude Code, Cursor and Cline with one OpenAI-compatible key (GPT, Claude, Gemini, DeepSeek)</title>
      <dc:creator>Li Xixiong</dc:creator>
      <pubDate>Mon, 26 Oct 2026 19:19:14 +0000</pubDate>
      <link>https://dev.to/lixixiong999/use-claude-code-cursor-and-cline-with-one-openai-compatible-key-gpt-claude-gemini-deepseek-475p</link>
      <guid>https://dev.to/lixixiong999/use-claude-code-cursor-and-cline-with-one-openai-compatible-key-gpt-claude-gemini-deepseek-475p</guid>
      <description>&lt;p&gt;&lt;em&gt;Disclosure: I work on &lt;a href="https://www.666gogogo.com/en/?utm_source=devto&amp;amp;utm_medium=article" rel="noopener noreferrer"&gt;666 AI&lt;/a&gt;, the gateway used in the examples below. The setup pattern works with any OpenAI-compatible gateway.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;If you switch between models a lot, you end up with several API keys, several bills, and a different config in every tool. Gateways fix that: one key, one balance, and the tool only needs two fields changed — the &lt;strong&gt;base URL&lt;/strong&gt; and the &lt;strong&gt;key&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Below are working configs for the most common tools.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. The two values you need
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Base URL (OpenAI format):&lt;/strong&gt; &lt;code&gt;https://YOUR-ENDPOINT/v1&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Base URL (Anthropic format, for Claude Code):&lt;/strong&gt; &lt;code&gt;https://YOUR-ENDPOINT&lt;/code&gt; — note: &lt;em&gt;no&lt;/em&gt; &lt;code&gt;/v1&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Key:&lt;/strong&gt; &lt;code&gt;sk-...&lt;/code&gt; from your gateway console&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Quick check that it works:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl https://YOUR-ENDPOINT/v1/chat/completions &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-H&lt;/span&gt; &lt;span class="s2"&gt;"Authorization: Bearer &lt;/span&gt;&lt;span class="nv"&gt;$KEY&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-H&lt;/span&gt; &lt;span class="s2"&gt;"Content-Type: application/json"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="s1"&gt;'{"model":"deepseek-v4-flash","messages":[{"role":"user","content":"hi"}]}'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A JSON response means you're done.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Claude Code
&lt;/h2&gt;

&lt;p&gt;Claude Code speaks the Anthropic protocol, so point it at the Anthropic-format address:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# ~/.zshrc or ~/.bashrc&lt;/span&gt;
&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;ANTHROPIC_BASE_URL&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"https://YOUR-ENDPOINT"&lt;/span&gt;
&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;ANTHROPIC_AUTH_TOKEN&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"YOUR_KEY"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Reopen the terminal and run &lt;code&gt;claude&lt;/code&gt;. The most common mistake is adding &lt;code&gt;/v1&lt;/code&gt; here — don't.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Cursor
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Settings → Models → OpenAI API Key&lt;/li&gt;
&lt;li&gt;Turn on &lt;strong&gt;Override OpenAI Base URL&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Paste &lt;code&gt;https://YOUR-ENDPOINT/v1&lt;/code&gt; and your key, click &lt;strong&gt;Verify&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Add the model names you want to use (e.g. &lt;code&gt;claude-sonnet-5-5&lt;/code&gt;, &lt;code&gt;gemini-3.5-flash&lt;/code&gt;)&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  4. Cline / Roo Code
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;API Provider: &lt;strong&gt;OpenAI Compatible&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Base URL: &lt;code&gt;https://YOUR-ENDPOINT/v1&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;API Key: your key&lt;/li&gt;
&lt;li&gt;Model ID: any model from the catalog&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  5. Python / Node (official SDKs, unchanged)
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;openai&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;OpenAI&lt;/span&gt;

&lt;span class="n"&gt;client&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;OpenAI&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;api_key&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;YOUR_KEY&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;base_url&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;https://YOUR-ENDPOINT/v1&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;resp&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;chat&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;completions&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;create&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;claude-sonnet-5-5&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;messages&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;[{&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;role&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;user&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;content&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Explain this regex: ^&lt;/span&gt;&lt;span class="se"&gt;\\&lt;/span&gt;&lt;span class="s"&gt;d{3}-&lt;/span&gt;&lt;span class="se"&gt;\\&lt;/span&gt;&lt;span class="s"&gt;d{4}$&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;}],&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;resp&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;choices&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;content&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Switching models is now a one-word change (&lt;code&gt;claude-sonnet-5-5&lt;/code&gt; → &lt;code&gt;gemini-3.5-flash&lt;/code&gt; → &lt;code&gt;deepseek-v4-flash&lt;/code&gt;), with no new SDK and no new key.&lt;/p&gt;

&lt;h2&gt;
  
  
  Things worth knowing
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Streaming, tool calling and vision&lt;/strong&gt; work the same as the official APIs, as long as the model supports them.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Prompt caching:&lt;/strong&gt; put the unchanging part (system prompt, project files) first and the varying part last. The order decides the cache hit rate, and cached tokens are billed much cheaper.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Set a spend cap per key&lt;/strong&gt;, and use one key per project. If a key leaks, you lose one project's budget, not everything.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Why bother
&lt;/h2&gt;

&lt;p&gt;A common split is Claude for refactors, DeepSeek for cheap bulk tasks and Gemini for long documents. With all three behind one key, the editor config never changes. Only the model name does.&lt;/p&gt;

&lt;p&gt;If you want to try the gateway in these examples, signup is free and there's a daily free chat allowance: &lt;a href="https://www.666gogogo.com/en/?utm_source=devto&amp;amp;utm_medium=article" rel="noopener noreferrer"&gt;666gogogo.com&lt;/a&gt;. Full docs: &lt;a href="https://www.666gogogo.com/en/docs.html?utm_source=devto&amp;amp;utm_medium=article" rel="noopener noreferrer"&gt;Documentation&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>api</category>
      <category>llm</category>
      <category>tools</category>
    </item>
  </channel>
</rss>
