<?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: shiva prasad</title>
    <description>The latest articles on DEV Community by shiva prasad (@shiva_prasad_cc614c6ee026).</description>
    <link>https://dev.to/shiva_prasad_cc614c6ee026</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%2F4241573%2F74e7b48e-49fa-499a-8d8d-7a28b5e3aa78.png</url>
      <title>DEV Community: shiva prasad</title>
      <link>https://dev.to/shiva_prasad_cc614c6ee026</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/shiva_prasad_cc614c6ee026"/>
    <language>en</language>
    <item>
      <title>Free LLM APIs for coding assistants</title>
      <dc:creator>shiva prasad</dc:creator>
      <pubDate>Thu, 12 Nov 2026 18:00:04 +0000</pubDate>
      <link>https://dev.to/shiva_prasad_cc614c6ee026/free-llm-apis-for-coding-assistants-11me</link>
      <guid>https://dev.to/shiva_prasad_cc614c6ee026/free-llm-apis-for-coding-assistants-11me</guid>
      <description>&lt;h1&gt;
  
  
  Free LLM APIs for coding assistants
&lt;/h1&gt;

&lt;p&gt;Yes, you can point an editor plugin, a CLI coding agent, or a small script at an OpenAI-compatible base URL and a free-tier key. The setup is the same pattern as any other compatible API: a published base URL, the provider's key in the environment, and a model id copied from that provider's official docs.&lt;/p&gt;

&lt;p&gt;What changes is the volume. A chat playground sends one request when you press enter. A coding assistant may send many requests for a single edit, plus retries, plus context from your files. That is why published rate limits matter more here than for a one-line test, and why you should think carefully about relays before you index a private repository through a third-party host.&lt;/p&gt;

&lt;p&gt;The figures below come from the 12 November 2026 snapshot on &lt;a href="https://freellmapi.link/" rel="noopener noreferrer"&gt;Free LLM API Tokens&lt;/a&gt;. I will not invent quality scores, context-window sizes or latency numbers. When a quota is not published, I will say so.&lt;/p&gt;

&lt;h2&gt;
  
  
  What to configure in the tool
&lt;/h2&gt;

&lt;p&gt;Most OpenAI-compatible coding tools ask for three values:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;An &lt;strong&gt;API key&lt;/strong&gt;, which should come from the environment or the tool's secret store, not from a file inside the repo&lt;/li&gt;
&lt;li&gt;A &lt;strong&gt;base URL&lt;/strong&gt;, copied from the provider's docs or from the card on the &lt;a href="https://freellmapi.link/" rel="noopener noreferrer"&gt;provider list&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;A &lt;strong&gt;model id&lt;/strong&gt;, copied from the same provider, not from another catalogue&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If the tool has a "provider" dropdown, only use a preset if it matches the official host you intend. A preset that points at an unknown relay is still a relay. If the tool lets you set a maximum number of requests or a monthly budget, set one before the first large run.&lt;/p&gt;

&lt;p&gt;Do not commit the tool's local config if it contains the key. Add those files to &lt;code&gt;.gitignore&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why free tiers run out faster during coding
&lt;/h2&gt;

&lt;p&gt;Coding prompts include source files, diffs and logs. Token counts grow with context, not just with the size of the visible answer. Agents may re-read a file, call tools, and retry on a failed patch. If the provider counts input and output tokens toward a daily cap, a long debugging session can exhaust it even when the published number looked large in a table.&lt;/p&gt;

&lt;p&gt;Look at more than tokens per day. Requests per minute, requests per day, concurrent connections and maximum context size are all separate limits. A coding agent that fires parallel calls is often the first way people discover an unpublished RPM cap.&lt;/p&gt;

&lt;p&gt;A few official figures from the 12 November snapshot, to show how different the units can be:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Groq&lt;/strong&gt; publishes 200,000 tokens per day and 1,000 requests per day on listed models, with no card required. Limits vary by model. The documented base URL is &lt;code&gt;https://api.groq.com/openai/v1&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;NVIDIA Build / NIM&lt;/strong&gt; publishes a free trial on hosted models, with 40 requests per minute and 10,000 requests per day, and no card required. The documented base URL is &lt;code&gt;https://integrate.api.nvidia.com/v1&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;SambaNova Cloud&lt;/strong&gt; published 200,000 tokens per day per model as of 3 October, but only 20 requests per day, and a card is required. A low request cap will bind a chatty agent long before the token cap does.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;OVHcloud AI Endpoints&lt;/strong&gt; publishes keyless free access at 2 requests per minute per IP per model, with no card required.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Gemini API (Google AI Studio)&lt;/strong&gt; has a free tier on selected models, with per-model RPM and RPD on Google's own rate-limit page. Tokens per day are not published in the tracker. The notes also record that free-tier prompts may be used to improve Google products — read that policy before you send a private repo.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cloudflare Workers AI&lt;/strong&gt; publishes 10,000 Neurons per day, which is not a token count, and its base URL needs a real account id in place of &lt;code&gt;{ACCOUNT_ID}&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If tokens per day are marked "Not published", you still have a cap; you just cannot plan from a number the tracker recorded. Watch the official dashboard and stop on the first 429 response. Tight auto-retries will make the situation worse.&lt;/p&gt;

&lt;p&gt;Phone checks, cards and trial end dates also matter. A trial with a high daily cap and a card on file is not the same as an ongoing no-card free tier. Cerebras, for example, publishes 1,000,000 tokens per day during a $5, 30-day trial, with a card required.&lt;/p&gt;

&lt;h2&gt;
  
  
  Official provider, documented gateway, or relay?
&lt;/h2&gt;

&lt;p&gt;If the repository is private, prefer an official provider whose privacy terms you accept, or a model you run locally. Some official free tiers disclose that prompts may be used to improve the product. "Official" is not a synonym for "will not train on my code."&lt;/p&gt;

&lt;p&gt;Documented gateways can be convenient when you want to switch models through one base URL. They may also log prompts, and the model host behind a free route may log them too. OpenRouter is recorded in the snapshot as a gateway (not official), OpenAI compatible, with &lt;code&gt;:free&lt;/code&gt; models, a published limit of 50 requests per day until credits are bought, no card required, and a note that free-model providers may log prompts. Fifty requests per day is easy for a coding agent to spend on a single stubborn edit.&lt;/p&gt;

&lt;p&gt;Unofficial relays are a poor default for source code. The 12 November snapshot flagged 47 of 112 listed providers with a relay warning, including some of the largest advertised daily caps. NaraRouter and Flexlora were both recorded at 7 million tokens per day, both as relay-flagged gateways. A large cap does not make a relay safer for a private codebase. Hide those rows when you are choosing a host for work code.&lt;/p&gt;

&lt;p&gt;The coding-specific checklist, including rate-limit and key-safety notes, is in &lt;a href="https://freellmapi.link/guides/free-llm-apis-for-coding" rel="noopener noreferrer"&gt;Free LLM APIs for coding&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Keep a coding key from leaking
&lt;/h2&gt;

&lt;p&gt;Issue a key that is only used by the assistant, so you can revoke it without rotating everything else. Keep it out of shell history if you can, out of screenshots of errors, and out of issue trackers when a command fails. Do not paste source that contains &lt;code&gt;.env&lt;/code&gt; files into a prompt on a relay.&lt;/p&gt;

&lt;p&gt;If the assistant can run terminal commands, it may accidentally &lt;code&gt;echo&lt;/code&gt; the environment or print a debug HTTP dump. Treat that as a leak and revoke the key if a log might have been shared.&lt;/p&gt;

&lt;h2&gt;
  
  
  A small script that is easy to retarget
&lt;/h2&gt;

&lt;p&gt;For your own scripts, construct the client once and keep the model id in a variable or environment value. That way you can switch providers without rewriting the rest of the program.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;
&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;openai&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nc"&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="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;environ&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"API_KEY"&lt;/span&gt;&lt;span class="p"&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="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;environ&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"API_BASE_URL"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;complete&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;prompt&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;str&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="kt"&gt;str&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="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;environ&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"MODEL_ID"&lt;/span&gt;&lt;span class="p"&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="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"role"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"user"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"content"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;prompt&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;return&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="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="ow"&gt;or&lt;/span&gt; &lt;span class="s2"&gt;""&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Set &lt;code&gt;API_BASE_URL&lt;/code&gt; to the published base URL, including any &lt;code&gt;/v1&lt;/code&gt; suffix the provider documents. Do not hard-code a host you saw in an unofficial list if the tracker says the endpoint is not published — look it up on the official site instead.&lt;/p&gt;

&lt;p&gt;Add a clear failure path for HTTP 429 and 401. A script that ignores those errors can sit in a retry loop until the day cap is gone.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to evaluate "good for coding" without inventing benchmarks
&lt;/h2&gt;

&lt;p&gt;A public tracker can tell you whether a compatible base URL is published, whether the allowance is a trial or an ongoing tier, whether a card is required in the public terms, and whether a relay has been flagged. It cannot honestly tell you which model is "best at Rust" or how many tokens of context you will get.&lt;/p&gt;

&lt;p&gt;If you need quality or latency, measure them on a public sample, or read the official model card. Start with one official provider, one short file, and a request cap in the tool. If that loop is stable, then consider more context or a second model id. If the official terms do not fit a private repository, do not try to solve that with an unofficial free relay.&lt;/p&gt;

&lt;p&gt;Re-check the official page before you depend on a number from any snapshot. Offers end. The same November list still carries rows for ended Hugging Face monthly credits, a removed Fireworks signup credit, and an Ollama Cloud plan that is no longer a free cloud tier.&lt;/p&gt;

</description>
      <category>coding</category>
      <category>llm</category>
      <category>openai</category>
      <category>python</category>
    </item>
    <item>
      <title>Official vs relay LLM gateways: risks and how to spot them</title>
      <dc:creator>shiva prasad</dc:creator>
      <pubDate>Thu, 12 Nov 2026 17:53:06 +0000</pubDate>
      <link>https://dev.to/shiva_prasad_cc614c6ee026/official-vs-relay-llm-gateways-risks-and-how-to-spot-them-lhb</link>
      <guid>https://dev.to/shiva_prasad_cc614c6ee026/official-vs-relay-llm-gateways-risks-and-how-to-spot-them-lhb</guid>
      <description>&lt;h1&gt;
  
  
  Official vs relay LLM gateways: risks and how to spot them
&lt;/h1&gt;

&lt;p&gt;An OpenAI-compatible &lt;code&gt;chat.completions&lt;/code&gt; call looks the same whether you are talking to a first-party API, a documented multi-model router, or an unofficial relay. The SDK will still return a string. The operator, the privacy policy, the logging and the way a free tier ends all belong to the service behind the base URL, and those are not the same.&lt;/p&gt;

&lt;p&gt;This article uses the classifications and published fields from the 12 November 2026 snapshot on &lt;a href="https://freellmapi.link/" rel="noopener noreferrer"&gt;Free LLM API Tokens&lt;/a&gt;. I will not invent a logging policy for a site that does not publish one, and I will not treat a large tokens-per-day figure as a security control.&lt;/p&gt;

&lt;h2&gt;
  
  
  Three kinds of service, not two
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Official provider&lt;/strong&gt;, in that tracker's data, means a model maker or a cloud that offers the API under its own name and documentation. You create an account with that organisation and, typically, call a base URL on its domain. Groq, Google's Gemini API, Cloudflare Workers AI, Mistral, SambaNova and Cerebras are official examples in the current list.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Gateway&lt;/strong&gt; is broader. A gateway sits in front of one or more models — sometimes its own, often someone else's — and gives you a single key and a single request format. Both official providers and gateways can be OpenAI compatible. Both can have a free allowance. They are not the same kind of dependency.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Relay warning&lt;/strong&gt; is a separate flag. It marks unofficial resellers or unclear operators. Do not treat every gateway as a relay, and do not treat every official row as a permanent free plan. Of the 112 providers in the 12 November snapshot, 37 were classified official and 75 as gateways, and 47 carried a relay warning.&lt;/p&gt;

&lt;p&gt;The comparison is written up at more length in the site's guides on &lt;a href="https://freellmapi.link/guides/official-vs-gateway-providers" rel="noopener noreferrer"&gt;official providers vs gateways&lt;/a&gt; and &lt;a href="https://freellmapi.link/guides/relay-gateway-risks" rel="noopener noreferrer"&gt;relay and gateway risks&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why the distinction matters if the code is identical
&lt;/h2&gt;

&lt;p&gt;With an official API you can usually find a legal entity, a status page and a written data policy. You still have to read that policy. "Official" is not a synonym for "will not train on my prompts" or "will stay free." The Gemini API entry, for example, records that free-tier prompts may be used to improve Google products. Official free credits also end: the same snapshot records that Hugging Face's free monthly inference credits had ended, and that Fireworks AI's signup credit had been removed.&lt;/p&gt;

&lt;p&gt;With a documented gateway you must also ask where the model runs and who may store the prompt. A well-known example in the list is OpenRouter. It is recorded as a gateway (not official), OpenAI compatible, with a documented base URL of &lt;code&gt;https://openrouter.ai/api/v1&lt;/code&gt;. The published free allowance is &lt;code&gt;:free&lt;/code&gt; models, with a limit of 50 requests per day until credits are bought, and no card required. The notes say free-model providers may log prompts. That is a documented trade-off, not a hidden one, and it is a reason to keep private data out of &lt;code&gt;:free&lt;/code&gt; routes even without a relay flag.&lt;/p&gt;

&lt;p&gt;With an unofficial relay you may not get a clear answer at all. The site may present a long model list and a generous free allowance without saying where the request actually goes. A model name can be mapped to a different model than the one you expected. A free cap can disappear. A domain can change. Billing disputes and abuse reports are harder when the operator is unclear.&lt;/p&gt;

&lt;h2&gt;
  
  
  What a relay can see
&lt;/h2&gt;

&lt;p&gt;Your prompt, system instructions and any files you attach may be visible to the relay operator, and may be logged or reused. The operator may also send that text to a third-party model host with its own logging policy. If you pasted customer data, private source code, or an API key inside the prompt, you have now shared it with at least one extra party.&lt;/p&gt;

&lt;p&gt;A relay can also collect &lt;strong&gt;your&lt;/strong&gt; API keys if you are asked to paste a key from another provider into their dashboard so they can "bring your own key." That is a different, higher risk than using a key they issued for their own endpoint: you are trusting them with a credential that can spend money or read projects on the first-party account. A tracker should never ask you for a key. If a site does, stop.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to read the public signals
&lt;/h2&gt;

&lt;p&gt;You do not need a private investigation to do a first pass. Look at:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Who is named as the operator, and whether a company or legal entity is published&lt;/li&gt;
&lt;li&gt;Whether the docs live on that organisation's domain&lt;/li&gt;
&lt;li&gt;Whether the product is described as a router in front of other APIs&lt;/li&gt;
&lt;li&gt;Whether routing and logging are explained, including for free routes&lt;/li&gt;
&lt;li&gt;Whether a card, a phone check or a trial end date is published&lt;/li&gt;
&lt;li&gt;Whether the base URL is a typo-squatting lookalike of a well-known host&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Then read the tracker's badges as a set, not as a recommendation: official or gateway, relay warning or not, OpenAI compatibility, the written allowance, and whether a card is required. No single badge means "safe." Absence of a warning is not a certification.&lt;/p&gt;

&lt;h2&gt;
  
  
  A large tokens-per-day number does not offset the risk
&lt;/h2&gt;

&lt;p&gt;A published cap is a usage number, not a security control. In the 12 November snapshot, some of the highest daily figures belonged to relay-flagged gateways. NaraRouter and Flexlora were both recorded at 7 million tokens per day, both as gateways, both with a relay warning. APInex was recorded at 3 million tokens per day, also a relay-flagged gateway. Those rows are useful if you are comparing advertised allowances. They are a poor default for private data.&lt;/p&gt;

&lt;p&gt;By contrast, an official no-card tier can look small next to those numbers and still be the better default for learning or for private prompts. Groq's published allowance in the same snapshot was 200,000 tokens per day and 1,000 requests per day on listed models, with no card required. "Smaller advertised cap, clearer operator" is often the right trade.&lt;/p&gt;

&lt;p&gt;Card requirements appear in both categories. A card-backed official trial can be more constrained than a no-card official free tier with a smaller published number. Cerebras, for example, publishes 1,000,000 tokens per day during a $5, 30-day trial, with a card required. Compare the sentence in the allowance field, not only the category badge.&lt;/p&gt;

&lt;p&gt;If the card field is "Unspecified" or "Not published", do not treat that as "no card."&lt;/p&gt;

&lt;h2&gt;
  
  
  What you should never send through a flagged relay
&lt;/h2&gt;

&lt;p&gt;Do not send anything you would not be willing to post in a public forum. In particular:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;API keys, passwords, cookies, or private tokens, including keys for other providers&lt;/li&gt;
&lt;li&gt;Customer records, health, financial or government identifiers&lt;/li&gt;
&lt;li&gt;Confidential source code, unreleased product plans, or internal documents&lt;/li&gt;
&lt;li&gt;Personal data about other people&lt;/li&gt;
&lt;li&gt;Content that the upstream provider would forbid&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If your workflow needs those inputs, use an official provider whose policy you accept, a contract that matches your requirements, or a model you run locally.&lt;/p&gt;

&lt;h2&gt;
  
  
  If you still want to try a gateway
&lt;/h2&gt;

&lt;p&gt;Use a throwaway prompt and a key that exists only on that site. Do not reuse a production key. Do not point a production app at a new base URL until you have read the terms and privacy policy. Prefer HTTPS base URLs copied from official docs or from a list that only repeats published endpoints. Revoke the key when you are done experimenting.&lt;/p&gt;

&lt;p&gt;A first "hello world" request is enough to test compatibility. It is not a reason to point your main repository at that base URL.&lt;/p&gt;

&lt;p&gt;If you later migrate from a gateway to an official API, and both are OpenAI compatible, keep the application code and change the environment: key, base URL, and model id. Test streaming, tools and JSON output, because they may differ even when a basic chat call works.&lt;/p&gt;

&lt;p&gt;The safe default is the same in every case: treat undocumented routes as public, keep keys in environment variables, and confirm terms on the official page before you rely on a free tier.&lt;/p&gt;

</description>
      <category>llm</category>
      <category>security</category>
      <category>ai</category>
      <category>openai</category>
    </item>
    <item>
      <title>Free OpenAI-compatible LLM APIs in 2026: how to switch `base_url` in Python and JS</title>
      <dc:creator>shiva prasad</dc:creator>
      <pubDate>Thu, 12 Nov 2026 17:52:16 +0000</pubDate>
      <link>https://dev.to/shiva_prasad_cc614c6ee026/free-openai-compatible-llm-apis-in-2026-how-to-switch-baseurl-in-python-and-js-268p</link>
      <guid>https://dev.to/shiva_prasad_cc614c6ee026/free-openai-compatible-llm-apis-in-2026-how-to-switch-baseurl-in-python-and-js-268p</guid>
      <description>&lt;h1&gt;
  
  
  Free OpenAI-compatible LLM APIs in 2026: how to switch &lt;code&gt;base_url&lt;/code&gt; in Python and JS
&lt;/h1&gt;

&lt;p&gt;You do not need a new SDK for every free LLM API. If a provider documents an OpenAI-compatible endpoint, the official Python and JavaScript &lt;code&gt;openai&lt;/code&gt; clients will talk to it after you change two things: the &lt;strong&gt;base URL&lt;/strong&gt; and the &lt;strong&gt;API key&lt;/strong&gt;. The model id is a third value, and it has to come from that same provider's docs or dashboard.&lt;/p&gt;

&lt;p&gt;This walkthrough uses only figures and endpoints that were published on the providers' own pages, as recorded in the 12 November 2026 snapshot on &lt;a href="https://freellmapi.link/" rel="noopener noreferrer"&gt;Free LLM API Tokens&lt;/a&gt;. When a quota is not published, I will say so rather than invent one. Always re-check the official page before you plan work around a daily cap; these numbers change.&lt;/p&gt;

&lt;h2&gt;
  
  
  What "OpenAI compatible" actually promises
&lt;/h2&gt;

&lt;p&gt;Compatibility means the server accepts the same &lt;em&gt;style&lt;/em&gt; of HTTP request that OpenAI's API uses — typically a &lt;code&gt;chat.completions&lt;/code&gt; call with a model id and a list of messages. It is not a promise that streaming, tool use, vision, batch jobs or embeddings all exist, or that they use the same names.&lt;/p&gt;

&lt;p&gt;Trackers that are careful about this will mark a provider as &lt;strong&gt;yes&lt;/strong&gt;, &lt;strong&gt;partial&lt;/strong&gt;, or &lt;strong&gt;not published&lt;/strong&gt;. "Yes" means they document a compatible endpoint. "Partial" means only some of the surface works that way. "Not published" means there is no clear public statement, not that the API is incompatible.&lt;/p&gt;

&lt;p&gt;In the 12 November 2026 snapshot, the tracker listed 112 providers. Of those, 105 were marked OpenAI compatible, two were partial, one was not compatible, and four had no public statement recorded. That is a snapshot, not a ranking, and it is not a reason to skip the provider's own docs.&lt;/p&gt;

&lt;h2&gt;
  
  
  Pick a provider before you write any code
&lt;/h2&gt;

&lt;p&gt;Start with an &lt;strong&gt;official&lt;/strong&gt; provider if you are still learning, or if the prompt might include anything you would not post in public. Official, in the tracker's terms, means a model maker or a cloud that offers the API under its own name. Groq, Google's Gemini API, Cloudflare Workers AI, Mistral, SambaNova and Cerebras are examples in the current list.&lt;/p&gt;

&lt;p&gt;A &lt;strong&gt;gateway&lt;/strong&gt; sits in front of one or more models and gives you a single key and a single request format. Some gateways are well documented. Some are unofficial relays. A relay warning on a card means you should not send private data through that site, however large the advertised token cap looks. The 12 November snapshot flagged 47 of 112 entries with that warning, and classified 37 as official and 75 as gateways.&lt;/p&gt;

&lt;p&gt;Use the filters for "OpenAI compatible" and "No card needed" on the &lt;a href="https://freellmapi.link/" rel="noopener noreferrer"&gt;provider list&lt;/a&gt;, then open the official pricing or rate-limit page from the card. If tokens per day are marked "Not published", do not assume a number.&lt;/p&gt;

&lt;p&gt;A few published official figures, as of that snapshot:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Groq&lt;/strong&gt; publishes 200,000 tokens per day and 1,000 requests per day on listed models, with no card required. The documented base URL is &lt;code&gt;https://api.groq.com/openai/v1&lt;/code&gt;. Limits vary by model.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Gemini API (Google AI Studio)&lt;/strong&gt; has a free tier on selected Gemini models, with per-model RPM and RPD on Google's rate-limit page, and no card required. The documented compatible base URL is &lt;code&gt;https://generativelanguage.googleapis.com/v1beta/openai/&lt;/code&gt;. The tracker's notes also record that free-tier prompts may be used to improve Google products.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cloudflare Workers AI&lt;/strong&gt; publishes 10,000 Neurons per day — that unit is not tokens — and its base URL includes an &lt;code&gt;{ACCOUNT_ID}&lt;/code&gt; placeholder that you must replace. Do not treat the placeholder as a hostname.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;SambaNova Cloud&lt;/strong&gt; published 200,000 tokens per day per model as of 3 October, with 20 requests per day, and a card required.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cerebras&lt;/strong&gt; publishes 1,000,000 tokens per day during a $5, 30-day trial, with a card required. That is a trial, not an ongoing no-card tier.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Keep the key out of the source
&lt;/h2&gt;

&lt;p&gt;Store the key in an environment variable and read it at runtime. Do not paste it into a chat, a screenshot, a ticket, or a Git repository. If a key leaks, revoke it on the provider's dashboard and create a new one.&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;# current shell session only&lt;/span&gt;
&lt;span class="kd"&gt;export&lt;/span&gt; &lt;span class="nv"&gt;API_KEY&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"paste-the-provider-key-here"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;On Windows PowerShell the equivalent is &lt;code&gt;$env:API_KEY = "paste-the-provider-key-here"&lt;/code&gt;. A &lt;code&gt;.env&lt;/code&gt; file is fine only if that file is listed in &lt;code&gt;.gitignore&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Python: construct the official client with &lt;code&gt;base_url&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;Install the official &lt;code&gt;openai&lt;/code&gt; package, then pass &lt;code&gt;base_url&lt;/code&gt; and &lt;code&gt;api_key&lt;/code&gt;. Replace the base URL with the exact string from the provider's docs (or from the tracker card, if it repeats a published URL). Replace &lt;code&gt;MODEL_ID&lt;/code&gt; with a model id copied from that same provider — not from this article, and not from a different catalogue.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;
&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;openai&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nc"&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="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;environ&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"API_KEY"&lt;/span&gt;&lt;span class="p"&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="s2"&gt;"https://api.example.com/v1"&lt;/span&gt;&lt;span class="p"&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="s2"&gt;"MODEL_ID"&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="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"role"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"user"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"content"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Reply with the word ok."&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&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="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;To point this at Groq, for example, you would set &lt;code&gt;base_url&lt;/code&gt; to the published value &lt;code&gt;https://api.groq.com/openai/v1&lt;/code&gt; and copy a model id from Groq's docs. Some base URLs already end in &lt;code&gt;/v1&lt;/code&gt; or &lt;code&gt;/openai/v1&lt;/code&gt;. Copy them as published. Do not add a second &lt;code&gt;/v1&lt;/code&gt; unless the official docs say to.&lt;/p&gt;

&lt;h2&gt;
  
  
  JavaScript: the same two fields, on a server
&lt;/h2&gt;

&lt;p&gt;The official Node SDK uses &lt;code&gt;baseURL&lt;/code&gt; (camel case) and &lt;code&gt;apiKey&lt;/code&gt;. Do not embed a secret key in a browser bundle; call the provider from a server or a function you control.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nc"&gt;OpenAI&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s2"&gt;"openai"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;OpenAI&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;apiKey&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="no"&gt;API_KEY&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;baseURL&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"https://api.example.com/v1"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;resp&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&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="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"MODEL_ID"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;messages&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;role&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"user"&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;span class="s2"&gt;"Reply with the word ok."&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nb"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&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="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;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you already have application code written for OpenAI, this is often the only change you need, besides picking a model id that exists on the new host.&lt;/p&gt;

&lt;h2&gt;
  
  
  A raw HTTP request, if you would rather skip the SDK
&lt;/h2&gt;

&lt;p&gt;A compatible server usually accepts a JSON POST to &lt;code&gt;{base URL}/chat/completions&lt;/code&gt; with a bearer token. If the published base URL already includes a version suffix, you still append &lt;code&gt;/chat/completions&lt;/code&gt; unless the official docs say otherwise.&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://api.example.com/v1/chat/completions \
  -H &lt;span class="s2"&gt;"Authorization: Bearer $API_KEY"&lt;/span&gt; \
  -H &lt;span class="s2"&gt;"Content-Type: application/json"&lt;/span&gt; \
  -d &lt;span class="s1"&gt;'{"model":"MODEL_ID","messages":[{"role":"user","content":"Reply with the word ok."}]}'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If this returns an authentication error, the key or the header name may be wrong. If it returns a model error, the model id is usually wrong or not on the free tier. If it returns a rate-limit error, you have hit a published or unpublished cap.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why this article will not fill in a model id
&lt;/h2&gt;

&lt;p&gt;Model catalogues change. A name that worked last month may be paid-only, renamed, or removed from a free tier. A tracker can record allowances, compatibility and base URLs without pretending to be a live model directory. Official docs and the provider dashboard are the right source for the string you put in the &lt;code&gt;model&lt;/code&gt; field.&lt;/p&gt;

&lt;p&gt;The longer, step-by-step version of this setup lives in the site's guide on &lt;a href="https://freellmapi.link/guides/how-to-use-free-openai-compatible-apis" rel="noopener noreferrer"&gt;how to use free OpenAI-compatible APIs&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Test without burning the day's allowance
&lt;/h2&gt;

&lt;p&gt;Start with a one-line prompt and a low &lt;code&gt;max_tokens&lt;/code&gt; value if the API supports it. Read the dashboard, or any remaining-quota headers, before you run a loop. Free tiers often count both input and output tokens, and a retry loop can exhaust a daily cap in minutes.&lt;/p&gt;

&lt;p&gt;The common failures are practical: a typo in the base URL, a second &lt;code&gt;/v1&lt;/code&gt; on a URL that already has one, an unset environment variable, a model id copied from a different provider, or an offer that has ended since the last snapshot.&lt;/p&gt;

&lt;p&gt;Once a test request works, keep client construction in one module, log the provider name and model id (never the key), and add basic backoff on HTTP 429. If you outgrow a free tier, switch the base URL, the key and the model id rather than rewriting the rest of the app — that is the point of compatibility.&lt;/p&gt;

</description>
      <category>python</category>
      <category>javascript</category>
      <category>openai</category>
      <category>llm</category>
    </item>
  </channel>
</rss>
