<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
<channel>
<title>Coder Legion - Recent posts tagged openai-compatible</title>
<link>https://coderlegion.com/tag/openai-compatible</link>
<description>Powered by Question2Answer</description>
<item>
<title>Cline + any OpenAI-compatible gateway: Base URL ends at /v1</title>
<link>https://coderlegion.com/32654/cline-any-openai-compatible-gateway-base-url-ends-at-v1</link>
<description>&lt;p&gt;Cline (the independent VS Code / JetBrains coding agent — not affiliated with this post) has a first-party “OpenAI” provider and a separate &lt;strong&gt;OpenAI Compatible&lt;/strong&gt; provider. For a custom gateway you want the second one.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;1. Smoke-test outside the IDE&lt;/strong&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-bash&quot;&gt;export LLM_API_KEY='…'
export LLM_BASE_URL='https://api.china-aiapi.com/v1'

curl -sS &quot;$LLM_BASE_URL/models&quot; -H &quot;Authorization: Bearer $LLM_API_KEY&quot; | head
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Pick a &lt;code&gt;MODEL_ID&lt;/code&gt; that appears in that list.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;2. Cline settings&lt;/strong&gt;&lt;/p&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://api.china-aiapi.com/v1&lt;/code&gt; (stop at &lt;code&gt;/v1&lt;/code&gt;; do not append &lt;code&gt;/chat/completions&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;API Key → value of &lt;code&gt;$LLM_API_KEY&lt;/code&gt; (no &lt;code&gt;Bearer &lt;/code&gt; prefix)&lt;/li&gt;
&lt;li&gt;Model → &lt;code&gt;MODEL_ID&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Open &lt;strong&gt;Model Configuration&lt;/strong&gt; and set context window / max tokens yourself; custom providers do not infer them&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;3. Optional CLI shape&lt;/strong&gt; (if your Cline build ships &lt;code&gt;cline auth&lt;/code&gt;):&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-bash&quot;&gt;cline auth -p openai -k &quot;$LLM_API_KEY&quot; -b &quot;$LLM_BASE_URL&quot; -m &quot;MODEL_ID&quot;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Troubleshooting&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Symptom → Likely cause&lt;br&gt;
404 on chat → Base URL missing &lt;code&gt;/v1&lt;/code&gt; or has an extra &lt;code&gt;/v1/v1&lt;/code&gt;&lt;br&gt;
401 → Key not exported / pasted with trailing space&lt;br&gt;
Model not found → &lt;code&gt;MODEL_ID&lt;/code&gt; ≠ an id from &lt;code&gt;/models&lt;/code&gt;&lt;br&gt;
Tiny context / early cuts → Model Configuration left at defaults&lt;/p&gt;
&lt;p&gt;Happy to compare notes if anyone is wiring Cline through a corporate OpenAI-compatible proxy instead of a hosted gateway.&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;&lt;em&gt;Disclosure: I work on the APIGOTO team; independent of OpenAI, Anthropic and Google.&lt;/em&gt; Cline is an independent product. Example gateway used above is ours (pay-as-you-go, logs only if enabled in settings): &lt;a rel=&quot;nofollow&quot; href=&quot;https://www.china-aiapi.com/grokbot&quot;&gt;www.china-aiapi.com&lt;/a&gt; · &lt;code&gt;https://api.china-aiapi.com/v1&lt;/code&gt;&lt;/p&gt;
</description>
<category>Tutorials</category>
<guid isPermaLink="true">https://coderlegion.com/32654/cline-any-openai-compatible-gateway-base-url-ends-at-v1</guid>
<pubDate>Tue, 27 Oct 2026 09:22:37 +0000</pubDate>
</item>
</channel>
</rss>