<?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: APIVAI</title>
    <description>The latest articles on DEV Community by APIVAI (@mupromax).</description>
    <link>https://dev.to/mupromax</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%2F3978088%2F58e79879-33b7-405b-9773-fbeb3b4bb54a.png</url>
      <title>DEV Community: APIVAI</title>
      <link>https://dev.to/mupromax</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/mupromax"/>
    <language>en</language>
    <item>
      <title>Dify with Claude and GPT: every field of the OpenAI-API-compatible plugin, explained</title>
      <dc:creator>APIVAI</dc:creator>
      <pubDate>Fri, 16 Oct 2026 07:33:36 +0000</pubDate>
      <link>https://dev.to/mupromax/dify-with-claude-and-gpt-every-field-of-the-openai-api-compatible-plugin-explained-4995</link>
      <guid>https://dev.to/mupromax/dify-with-claude-and-gpt-every-field-of-the-openai-api-compatible-plugin-explained-4995</guid>
      <description>&lt;p&gt;&lt;em&gt;Disclosure: I run APIVAI, the gateway used in the examples below. The setup is the same for any endpoint that speaks the OpenAI or Anthropic format.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://docs.dify.ai" rel="noopener noreferrer"&gt;Dify&lt;/a&gt; is an open-source platform for building LLM apps: chatbots, agents, workflows and knowledge-base (RAG) apps. It reaches models through model provider plugins, and with a third-party gateway there are enough fields that it's easy to fill one in wrong. This post goes through the actual fields of Dify's official &lt;code&gt;openai_api_compatible&lt;/code&gt; plugin (version 0.0.68) and the &lt;code&gt;anthropic&lt;/code&gt; plugin.&lt;/p&gt;

&lt;h2&gt;
  
  
  Which provider plugin?
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Plugin&lt;/th&gt;
&lt;th&gt;Address field&lt;/th&gt;
&lt;th&gt;Models&lt;/th&gt;
&lt;th&gt;Best for&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;OpenAI-API-compatible&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;API Base URL: &lt;code&gt;https://api.apivai.com/v1&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;Claude and GPT&lt;/td&gt;
&lt;td&gt;One provider for every model; you type the model IDs&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Anthropic&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;API URL: &lt;code&gt;https://api.apivai.com&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;Claude only&lt;/td&gt;
&lt;td&gt;Claude only, in the native format with prompt caching&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Start with &lt;strong&gt;OpenAI-API-compatible&lt;/strong&gt;: you type each model ID yourself, so a new model works as soon as the gateway lists it.&lt;/p&gt;

&lt;p&gt;Providers live on the &lt;strong&gt;Model Provider&lt;/strong&gt; page: under &lt;strong&gt;Integrations&lt;/strong&gt; in current Dify Cloud, under &lt;strong&gt;Settings&lt;/strong&gt; in the account menu in older self-hosted versions. Each provider applies to the whole workspace, and only owners and admins can change it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 1: Install the plugin
&lt;/h2&gt;

&lt;p&gt;Open &lt;strong&gt;Model Provider&lt;/strong&gt;, find &lt;strong&gt;OpenAI-API-compatible&lt;/strong&gt; in the list of providers you can install (or on the &lt;a href="https://marketplace.dify.ai/" rel="noopener noreferrer"&gt;Dify Marketplace&lt;/a&gt;) and click &lt;strong&gt;Install&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 2: Add a model
&lt;/h2&gt;

&lt;p&gt;On the &lt;strong&gt;OpenAI-API-compatible&lt;/strong&gt; card, click &lt;strong&gt;Add Model&lt;/strong&gt; and fill in:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Field&lt;/th&gt;
&lt;th&gt;Value&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Model Type&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;LLM&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Model Name&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;claude-sonnet-4-6&lt;/code&gt; (the exact model ID)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Model display name&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;optional, e.g. "Claude Sonnet 4.6"&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;API Key&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;your key&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;API Base URL&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;https://api.apivai.com/v1&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;model name for API endpoint&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;leave empty&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Completion mode&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Chat&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Model context size&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;no larger than the model's context window&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Upper bound for max tokens&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;8192 or more&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Function Call Type&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Tool Call&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Stream function calling&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Support&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;API Type&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Chat Completions API (/chat/completions)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Leave the rest at their defaults. Older versions of the plugin call the address field &lt;strong&gt;API endpoint URL&lt;/strong&gt;; the value is the same.&lt;/p&gt;

&lt;p&gt;The fields people most often misread:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Model Name&lt;/strong&gt; is what Dify actually sends to the API, so it must be the exact ID. The display name is only for the interface.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Model context size&lt;/strong&gt; is the limit Dify uses when it fits history and retrieved knowledge into the prompt. A value below the model's real window is fine and keeps long chats cheaper.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Upper bound for max tokens&lt;/strong&gt; only sets how high &lt;strong&gt;Max Tokens&lt;/strong&gt; can go in your apps. Thinking is on by default and counts as output, so leave room above 4096.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Function Call Type: Tool Call&lt;/strong&gt; is what lets Agent apps use native tool calling.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;When you click &lt;strong&gt;Save&lt;/strong&gt;, Dify sends a test request and only saves if it passes. Repeat &lt;strong&gt;Add Model&lt;/strong&gt; for each model you want, with the same key and address, for example &lt;code&gt;gpt-5.5&lt;/code&gt; and &lt;code&gt;claude-haiku-4-5&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Take model IDs from the API:&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.apivai.com/v1/models &lt;span class="nt"&gt;-H&lt;/span&gt; &lt;span class="s2"&gt;"Authorization: Bearer your-key"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step 3: Use the models
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;In an app's model selector, pick your model under OpenAI-API-compatible and set &lt;strong&gt;Max Tokens&lt;/strong&gt; to 4096 or more.&lt;/li&gt;
&lt;li&gt;In a workflow, each &lt;strong&gt;LLM&lt;/strong&gt; node picks its own model, so cheap and strong models can sit in the same flow.&lt;/li&gt;
&lt;li&gt;Under &lt;strong&gt;Default Models&lt;/strong&gt; on the Model Provider page, set the &lt;strong&gt;System Reasoning Model&lt;/strong&gt; as the workspace default.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Alternative: the Anthropic plugin for Claude
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Install the &lt;strong&gt;Anthropic&lt;/strong&gt; plugin and open its setup.&lt;/li&gt;
&lt;li&gt;Set &lt;strong&gt;API Key&lt;/strong&gt; to your key and &lt;strong&gt;API URL&lt;/strong&gt; to &lt;code&gt;https://api.apivai.com&lt;/code&gt;. Do &lt;strong&gt;not&lt;/strong&gt; add &lt;code&gt;/v1&lt;/code&gt;; the plugin's Anthropic client appends &lt;code&gt;/v1/messages&lt;/code&gt; itself. Leave &lt;strong&gt;Enable request metadata&lt;/strong&gt; on Disabled.&lt;/li&gt;
&lt;li&gt;Some IDs in the plugin's built-in model list match the gateway's (such as &lt;code&gt;claude-sonnet-4-6&lt;/code&gt;); others have different or dated names. If a model is missing or returns "model not found", click &lt;strong&gt;Add Model&lt;/strong&gt; on the Anthropic card and type the exact ID.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Which model for which job
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Question Classifier nodes, extraction, high-volume Q&amp;amp;A: &lt;code&gt;claude-haiku-4-5&lt;/code&gt; or &lt;code&gt;gpt-6-luna&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Default for chatbots and agents: &lt;code&gt;claude-sonnet-4-6&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Agents with many tools, long documents: &lt;code&gt;claude-sonnet-5-5&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Only the hardest reasoning nodes: &lt;code&gt;claude-opus-5-5&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A routing workflow (a cheap model classifies first, then hands the hard cases to a strong one) is the most common way to keep Dify costs down.&lt;/p&gt;

&lt;h2&gt;
  
  
  Common errors
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Credentials validation fails on save / 401&lt;/strong&gt;: the key is incomplete or deleted. Also check that &lt;strong&gt;API Base URL&lt;/strong&gt; has &lt;code&gt;/v1&lt;/code&gt; exactly once.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;402 / insufficient_quota&lt;/strong&gt;: the key's budget is used up, or what's left is too little for one request to an expensive model (Opus, Sonnet 4.6 hit this first). Add budget to the key or move that node to a cheaper model. A key stops working with a little still on it; that remainder isn't lost, and deleting the key returns it to your account balance.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;404&lt;/strong&gt;: OpenAI-API-compatible needs &lt;code&gt;https://api.apivai.com/v1&lt;/code&gt;, without &lt;code&gt;/chat/completions&lt;/code&gt;; the Anthropic plugin needs &lt;code&gt;https://api.apivai.com&lt;/code&gt; without &lt;code&gt;/v1&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Model not found&lt;/strong&gt;: &lt;strong&gt;Model Name&lt;/strong&gt; holds a display name instead of the ID, or you used a dated name from the Anthropic plugin's built-in list.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Empty or cut-off answers&lt;/strong&gt;: &lt;strong&gt;Max Tokens&lt;/strong&gt; in the app is too low (thinking uses output tokens); raise it to 4096 or more, and make sure &lt;strong&gt;Upper bound for max tokens&lt;/strong&gt; is high enough.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The agent never calls tools&lt;/strong&gt;: &lt;strong&gt;Function Call Type&lt;/strong&gt; isn't set to &lt;strong&gt;Tool Call&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Knowledge base errors&lt;/strong&gt;: a knowledge base needs an embedding model, and APIVAI doesn't provide embeddings. Set up a separate embedding provider for it; the LLM that writes the answer can still be Claude or GPT.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;429&lt;/strong&gt;: each key allows 60 requests per minute and 5 at once (extra ones wait in a queue for a while). For busy apps, give each app its own key.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What it costs
&lt;/h2&gt;

&lt;p&gt;At the time of writing, most Claude models on APIVAI are 56–62% below Anthropic's list prices and GPT models up to 86% below OpenAI's; for example, Claude Sonnet 4.6 is $1.26 / $6.32 per million input / output tokens against the official $3 / $15. It's prepaid and billed per token, with no subscription. The full table is at &lt;a href="https://apivai.com/pricing" rel="noopener noreferrer"&gt;https://apivai.com/pricing&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Questions are welcome in the comments.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>claude</category>
      <category>openai</category>
      <category>dify</category>
    </item>
    <item>
      <title>Roo Code with Claude and GPT: OpenAI Compatible vs Anthropic, and one model per mode</title>
      <dc:creator>APIVAI</dc:creator>
      <pubDate>Mon, 12 Oct 2026 13:57:34 +0000</pubDate>
      <link>https://dev.to/mupromax/roo-code-with-claude-and-gpt-openai-compatible-vs-anthropic-and-one-model-per-mode-idf</link>
      <guid>https://dev.to/mupromax/roo-code-with-claude-and-gpt-openai-compatible-vs-anthropic-and-one-model-per-mode-idf</guid>
      <description>&lt;p&gt;&lt;em&gt;Disclosure: I run APIVAI, the gateway used in the examples below. The setup is the same for any endpoint that speaks both the OpenAI and Anthropic formats.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://roocodeinc.github.io/Roo-Code/providers/openai-compatible" rel="noopener noreferrer"&gt;Roo Code&lt;/a&gt; is an open-source coding agent for VS Code. It shares its roots with Cline but adds modes (Code, Architect, Ask, Debug) and configuration profiles. Used together, they let planning, coding and quick questions each run on a different model. This post covers the two provider types that work with a gateway, how to set up profiles per mode, and the common errors.&lt;/p&gt;

&lt;h2&gt;
  
  
  OpenAI Compatible or Anthropic?
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;/th&gt;
&lt;th&gt;OpenAI Compatible&lt;/th&gt;
&lt;th&gt;Anthropic&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Base URL&lt;/td&gt;
&lt;td&gt;&lt;code&gt;https://api.apivai.com/v1&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;https://api.apivai.com&lt;/code&gt; (no &lt;code&gt;/v1&lt;/code&gt;)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Models&lt;/td&gt;
&lt;td&gt;Claude and GPT&lt;/td&gt;
&lt;td&gt;Claude only&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Picking a model&lt;/td&gt;
&lt;td&gt;Type the model ID&lt;/td&gt;
&lt;td&gt;Choose from Roo Code's list&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Best for&lt;/td&gt;
&lt;td&gt;Mixing Claude and GPT, newest model IDs&lt;/td&gt;
&lt;td&gt;Long Claude sessions, with prompt caching&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The prompt caching part is worth a note. Roo Code's Anthropic provider adds &lt;code&gt;cache_control&lt;/code&gt; markers to the system prompt and recent messages, so repeated context is billed at the cache-read price, which is much lower than the full input price. An agent resends a lot of context on every step, so &lt;strong&gt;if you only use Claude, the Anthropic provider is usually cheaper&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 1: Set up OpenAI Compatible
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Open the Roo Code panel in VS Code, click the gear icon and go to &lt;strong&gt;Providers&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Set &lt;strong&gt;API Provider&lt;/strong&gt; to &lt;strong&gt;OpenAI Compatible&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Fill in the fields below and save.&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Field&lt;/th&gt;
&lt;th&gt;Value&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Base URL&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;https://api.apivai.com/v1&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;API Key&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;your key&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Model&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;claude-sonnet-4-6&lt;/code&gt; (or any ID from &lt;code&gt;GET /v1/models&lt;/code&gt;)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Max Output Tokens&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;8192 or more (at least 4096)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The base URL ends in &lt;code&gt;/v1&lt;/code&gt; exactly once; Roo Code appends &lt;code&gt;/chat/completions&lt;/code&gt; itself. Leave &lt;strong&gt;Context Window&lt;/strong&gt;, &lt;strong&gt;Image Support&lt;/strong&gt; and &lt;strong&gt;Computer Use&lt;/strong&gt; at their defaults unless you have a reason to change them. The Input/Output Price fields only change the cost estimate Roo Code shows; they don't affect billing.&lt;/p&gt;

&lt;p&gt;Roo Code uses native tool calling only, so the model must support function calling. The main Claude and GPT models do.&lt;/p&gt;

&lt;p&gt;To see which model IDs your key can use:&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.apivai.com/v1/models &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-H&lt;/span&gt; &lt;span class="s2"&gt;"Authorization: Bearer your-key"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step 2: Add an Anthropic profile (recommended if you only use Claude)
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;In &lt;strong&gt;Providers&lt;/strong&gt;, click the &lt;strong&gt;+&lt;/strong&gt; next to the profile selector and name the profile, for example "APIVAI Claude".&lt;/li&gt;
&lt;li&gt;Set &lt;strong&gt;API Provider&lt;/strong&gt; to &lt;strong&gt;Anthropic&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Paste your key into &lt;strong&gt;Anthropic API Key&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Tick &lt;strong&gt;Use custom base URL&lt;/strong&gt; and enter &lt;code&gt;https://api.apivai.com&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Choose a Claude model from the &lt;strong&gt;Model&lt;/strong&gt; dropdown.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Do &lt;strong&gt;not&lt;/strong&gt; add &lt;code&gt;/v1&lt;/code&gt; here. Roo Code passes this address to the Anthropic SDK, which appends &lt;code&gt;/v1/messages&lt;/code&gt; on its own, so &lt;code&gt;https://api.apivai.com/v1&lt;/code&gt; turns into &lt;code&gt;/v1/v1/messages&lt;/code&gt; and returns 404.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 3: Give each mode its own profile
&lt;/h2&gt;

&lt;p&gt;Roo Code remembers which profile you last used in each mode, and its mode settings let you assign a profile to a mode explicitly. All profiles can share the same key.&lt;/p&gt;

&lt;h2&gt;
  
  
  Which model for which job
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Mode&lt;/th&gt;
&lt;th&gt;Model&lt;/th&gt;
&lt;th&gt;Why&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Architect (planning)&lt;/td&gt;
&lt;td&gt;&lt;code&gt;claude-opus-5-5&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;A wrong plan wastes everything after it&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Code / Debug&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;claude-sonnet-4-6&lt;/code&gt; or &lt;code&gt;claude-sonnet-5-5&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;The everyday default&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Ask&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;claude-haiku-4-5&lt;/code&gt; or &lt;code&gt;gpt-6-luna&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;Just questions; cheap and fast is enough&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;If a task keeps going in circles on Sonnet, switch that task to Opus rather than making Opus your default. GPT models only work through an OpenAI Compatible profile.&lt;/p&gt;

&lt;h2&gt;
  
  
  Common errors
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;401 / invalid key&lt;/strong&gt;: the key is incomplete or deleted. With the Anthropic provider, also check that &lt;strong&gt;Use custom base URL&lt;/strong&gt; is ticked, or Roo Code sends your key to Anthropic directly.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;402 / insufficient_quota&lt;/strong&gt;: the key's budget is used up, or what's left is too little for one request to an expensive model (Opus, Sonnet 4.6 hit this first, so Architect on Opus is the usual place to see it). Add budget to the key or switch to a cheaper model. A key stops working with a little still on it; that remainder isn't lost, and deleting the key returns it to your account balance.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;404&lt;/strong&gt;: almost always &lt;code&gt;/v1&lt;/code&gt;. OpenAI Compatible needs &lt;code&gt;https://api.apivai.com/v1&lt;/code&gt; (one &lt;code&gt;/v1&lt;/code&gt;, no &lt;code&gt;/chat/completions&lt;/code&gt;); Anthropic needs &lt;code&gt;https://api.apivai.com&lt;/code&gt; without &lt;code&gt;/v1&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Model not found&lt;/strong&gt;: use the exact ID, such as &lt;code&gt;claude-sonnet-4-6&lt;/code&gt;, not the display name. Check it against &lt;code&gt;GET /v1/models&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Tool-calling errors&lt;/strong&gt;: switch to a model that supports function calling.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Empty or cut-off replies&lt;/strong&gt;: thinking is on by default and uses output tokens. Raise &lt;strong&gt;Max Output Tokens&lt;/strong&gt; to 8192 (at least 4096).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;429&lt;/strong&gt;: the default limit is 60 requests per minute per key. Long tasks can hit it; wait a moment or split work across several keys.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What it costs
&lt;/h2&gt;

&lt;p&gt;At the time of writing, most Claude models on APIVAI are 56–62% below Anthropic's list prices and GPT models up to 86% below OpenAI's; for example, Claude Sonnet 4.6 is $1.15 / $5.74 per million input / output tokens against the official $3 / $15. It's prepaid and billed per token, with no subscription. The full table is at &lt;a href="https://apivai.com/pricing" rel="noopener noreferrer"&gt;https://apivai.com/pricing&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Questions are welcome in the comments.&lt;/p&gt;

</description>
      <category>vscode</category>
      <category>ai</category>
      <category>claude</category>
      <category>programming</category>
    </item>
    <item>
      <title>Cherry Studio with Claude and GPT: adding a custom provider (and the /v1 question)</title>
      <dc:creator>APIVAI</dc:creator>
      <pubDate>Mon, 12 Oct 2026 13:56:56 +0000</pubDate>
      <link>https://dev.to/mupromax/cherry-studio-with-claude-and-gpt-adding-a-custom-provider-and-the-v1-question-23ob</link>
      <guid>https://dev.to/mupromax/cherry-studio-with-claude-and-gpt-adding-a-custom-provider-and-the-v1-question-23ob</guid>
      <description>&lt;p&gt;&lt;em&gt;Disclosure: I run APIVAI, the gateway used in the examples below. The setup is the same for any endpoint that speaks both the OpenAI and Anthropic formats.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://docs.cherryai.com.cn/docs/en-us/pre-basic/providers/zi-ding-yi-fu-wu-shang" rel="noopener noreferrer"&gt;Cherry Studio&lt;/a&gt; is a free desktop AI client for Windows, macOS and Linux, with assistants, knowledge bases, MCP tools and side-by-side answers from several models. It has no models of its own: you add a provider and a key. This post covers how to add a custom provider, whether the address needs &lt;code&gt;/v1&lt;/code&gt;, and the errors people run into most.&lt;/p&gt;

&lt;h2&gt;
  
  
  Custom provider or the built-in Anthropic provider?
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;/th&gt;
&lt;th&gt;Custom provider (OpenAI endpoint)&lt;/th&gt;
&lt;th&gt;Built-in Anthropic provider&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Where&lt;/td&gt;
&lt;td&gt;Settings → Model Services → + Add Provider&lt;/td&gt;
&lt;td&gt;Settings → Model Services → Anthropic&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Address&lt;/td&gt;
&lt;td&gt;&lt;code&gt;https://api.apivai.com&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;https://api.apivai.com&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Models&lt;/td&gt;
&lt;td&gt;Claude and GPT&lt;/td&gt;
&lt;td&gt;Claude only&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Best for&lt;/td&gt;
&lt;td&gt;One entry for every model&lt;/td&gt;
&lt;td&gt;Claude in its native Messages format&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;For most people the &lt;strong&gt;custom provider&lt;/strong&gt; is enough: one key, with Claude and GPT in the same model list. You can also set up both with the same key.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 1: Add a custom provider
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Click &lt;strong&gt;Settings&lt;/strong&gt; (the gear icon in the left navigation bar).&lt;/li&gt;
&lt;li&gt;Open &lt;strong&gt;Model Services&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;+ Add Provider&lt;/strong&gt; below the provider list.&lt;/li&gt;
&lt;li&gt;Fill in the dialog as below and click &lt;strong&gt;Add&lt;/strong&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Field&lt;/th&gt;
&lt;th&gt;Value&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Provider Name&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;anything you'll recognise, e.g. &lt;code&gt;APIVAI&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;API Key&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;your key&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;OpenAI endpoint (API Address)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;https://api.apivai.com&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;About &lt;code&gt;/v1&lt;/code&gt;: Cherry Studio wants the base address and appends &lt;code&gt;/v1/chat/completions&lt;/code&gt; itself, so &lt;code&gt;https://api.apivai.com&lt;/code&gt; becomes &lt;code&gt;https://api.apivai.com/v1/chat/completions&lt;/code&gt;. Current versions also accept &lt;code&gt;https://api.apivai.com/v1&lt;/code&gt; without doubling it, but never paste the full &lt;code&gt;/v1/chat/completions&lt;/code&gt; address. A trailing &lt;code&gt;#&lt;/code&gt; means "use this address exactly as typed"; you don't need it here.&lt;/p&gt;

&lt;p&gt;Older versions ask for a &lt;strong&gt;Provider Type&lt;/strong&gt; instead; choose &lt;strong&gt;OpenAI&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 2: Add the models
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Open the provider you just created.&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Get model list&lt;/strong&gt; and click the &lt;strong&gt;+&lt;/strong&gt; next to each model you want. Only models you've added with &lt;strong&gt;+&lt;/strong&gt; show up in the chat's model picker.&lt;/li&gt;
&lt;li&gt;Or click &lt;strong&gt;+&lt;/strong&gt; and type a model ID, such as &lt;code&gt;claude-sonnet-4-6&lt;/code&gt;, &lt;code&gt;claude-haiku-4-5&lt;/code&gt; or &lt;code&gt;gpt-5.5&lt;/code&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The list changes over time, so take IDs from &lt;strong&gt;Get model list&lt;/strong&gt; rather than from old screenshots.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 3: Test and switch it on
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Click &lt;strong&gt;Test&lt;/strong&gt; (named &lt;strong&gt;Check&lt;/strong&gt; in some versions) and pick a model. A success message means the key and address are right.&lt;/li&gt;
&lt;li&gt;Turn the provider on with the switch in the upper-right corner of the provider page. An enabled provider shows a green dot in the list.&lt;/li&gt;
&lt;li&gt;Pick the model from the drop-down at the top of a chat and send a message.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Optional: Claude through the built-in Anthropic provider
&lt;/h2&gt;

&lt;p&gt;In &lt;strong&gt;Model Services&lt;/strong&gt;, open &lt;strong&gt;Anthropic&lt;/strong&gt;, paste your key into &lt;strong&gt;API Key&lt;/strong&gt; and change &lt;strong&gt;API Address&lt;/strong&gt; from &lt;code&gt;https://api.anthropic.com&lt;/code&gt; to &lt;code&gt;https://api.apivai.com&lt;/code&gt;. Do &lt;strong&gt;not&lt;/strong&gt; add &lt;code&gt;/v1&lt;/code&gt;; the address has the same shape as Anthropic's own. Then click &lt;strong&gt;Get model list&lt;/strong&gt;, add the Claude models you want and switch the provider on. GPT models won't work here; they go through the custom provider above.&lt;/p&gt;

&lt;h2&gt;
  
  
  Which model for which job
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Default assistant (quick questions, translation, summaries): &lt;code&gt;claude-haiku-4-5&lt;/code&gt; or &lt;code&gt;gpt-6-luna&lt;/code&gt;, cheap and fast&lt;/li&gt;
&lt;li&gt;Main assistant (writing, code): &lt;code&gt;claude-sonnet-4-6&lt;/code&gt; or &lt;code&gt;claude-sonnet-5-5&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;The hardest analysis and reasoning: &lt;code&gt;claude-opus-5-5&lt;/code&gt;, only when you need it&lt;/li&gt;
&lt;li&gt;Comparing models: Cherry Studio can send one question to several models at once, which is the most direct way to compare them on your own tasks&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Every message resends the conversation so far, so long chats cost more per turn. Start a new topic when the subject changes.&lt;/p&gt;

&lt;h2&gt;
  
  
  What about knowledge bases?
&lt;/h2&gt;

&lt;p&gt;Chat works fine, but a knowledge base needs an embedding model to index your files, and APIVAI doesn't provide embeddings. Configure a separate embedding provider for the knowledge base in Cherry Studio; the assistant that answers can still be a Claude or GPT model. Image generation models aren't available either.&lt;/p&gt;

&lt;h2&gt;
  
  
  Common errors
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;401 / invalid API key&lt;/strong&gt;: the key is incomplete or has been deleted.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;402 / insufficient_quota&lt;/strong&gt;: the key's budget is used up, or what's left is too little for one request to an expensive model (Opus, Sonnet 4.6 hit this first). Add budget to the key or switch to a cheaper model. A key stops working with a little still on it; that remainder isn't lost, and deleting the key returns it to your account balance.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;404&lt;/strong&gt;: the address is wrong. The custom provider takes &lt;code&gt;https://api.apivai.com&lt;/code&gt;, without &lt;code&gt;/chat/completions&lt;/code&gt; and without a trailing &lt;code&gt;#&lt;/code&gt;; the Anthropic provider takes &lt;code&gt;https://api.apivai.com&lt;/code&gt; without &lt;code&gt;/v1&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Model not found&lt;/strong&gt;: the ID must match exactly (e.g. &lt;code&gt;claude-sonnet-4-6&lt;/code&gt;), not the display name. GPT models fail on the Anthropic provider.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Model missing from the chat picker&lt;/strong&gt;: the provider switch is off, or you fetched the list but didn't click &lt;strong&gt;+&lt;/strong&gt; next to the model.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Empty or cut-off replies&lt;/strong&gt;: thinking tokens count towards the output limit. In &lt;strong&gt;Edit Assistant&lt;/strong&gt; → &lt;strong&gt;Model&lt;/strong&gt;, turn off &lt;strong&gt;Enable message length limit (MaxToken)&lt;/strong&gt; or set it to 4096 or more.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Replies arrive all at once, or the stream stops&lt;/strong&gt;: check the &lt;strong&gt;Streaming output (Stream)&lt;/strong&gt; switch on the same tab, and any proxy in Cherry Studio's network settings.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;429&lt;/strong&gt;: the default limit is 60 requests per minute per key. Comparing several models at once uses several requests; wait a moment and try again.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What it costs
&lt;/h2&gt;

&lt;p&gt;At the time of writing, most Claude models on APIVAI are 56–62% below Anthropic's list prices and GPT models up to 86% below OpenAI's; for example, Claude Sonnet 4.6 is $1.15 / $5.74 per million input / output tokens against the official $3 / $15. It's prepaid and billed per token, with no subscription. The full table is at &lt;a href="https://apivai.com/pricing" rel="noopener noreferrer"&gt;https://apivai.com/pricing&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Questions are welcome in the comments.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>claude</category>
      <category>openai</category>
      <category>productivity</category>
    </item>
    <item>
      <title>Cline with Claude and GPT through your own API gateway: OpenAI Compatible vs Anthropic, and the /v1 trap</title>
      <dc:creator>APIVAI</dc:creator>
      <pubDate>Mon, 12 Oct 2026 12:59:50 +0000</pubDate>
      <link>https://dev.to/mupromax/cline-with-claude-and-gpt-through-your-own-api-gateway-openai-compatible-vs-anthropic-and-the-v1-2c49</link>
      <guid>https://dev.to/mupromax/cline-with-claude-and-gpt-through-your-own-api-gateway-openai-compatible-vs-anthropic-and-the-v1-2c49</guid>
      <description>&lt;p&gt;&lt;em&gt;Disclosure: I run APIVAI, the gateway used in the examples below. The setup is the same for any endpoint that speaks both the OpenAI and Anthropic formats.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://docs.cline.bot/provider-config/openai-compatible" rel="noopener noreferrer"&gt;Cline&lt;/a&gt; is an open-source coding agent for VS Code. It reads your files, proposes edits and runs commands with your approval, but it ships without a model: you bring a provider and a key. Cline offers two provider types that work with a third-party gateway, and most setup errors come from mixing up their base URLs. Here is how they differ and how to fill in each one.&lt;/p&gt;

&lt;h2&gt;
  
  
  OpenAI Compatible or Anthropic?
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;/th&gt;
&lt;th&gt;OpenAI Compatible&lt;/th&gt;
&lt;th&gt;Anthropic&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Base URL&lt;/td&gt;
&lt;td&gt;&lt;code&gt;https://api.apivai.com/v1&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;https://api.apivai.com&lt;/code&gt; (no &lt;code&gt;/v1&lt;/code&gt;)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Models&lt;/td&gt;
&lt;td&gt;Claude and GPT&lt;/td&gt;
&lt;td&gt;Claude only&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Picking a model&lt;/td&gt;
&lt;td&gt;Type the model ID&lt;/td&gt;
&lt;td&gt;Choose from Cline's list&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Best for&lt;/td&gt;
&lt;td&gt;One setup for every model&lt;/td&gt;
&lt;td&gt;Claude in its native Messages format&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Pick &lt;strong&gt;OpenAI Compatible&lt;/strong&gt; if you want to switch between Claude and GPT, or use a model ID newer than Cline's built-in list. Pick &lt;strong&gt;Anthropic&lt;/strong&gt; if you only use Claude. The same key works in both, and you can switch at any time.&lt;/p&gt;

&lt;h2&gt;
  
  
  Setting up OpenAI Compatible
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Open the Cline panel in VS Code and click the gear icon.&lt;/li&gt;
&lt;li&gt;Set &lt;strong&gt;API Provider&lt;/strong&gt; to &lt;strong&gt;OpenAI Compatible&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Fill in the fields below, click &lt;strong&gt;Verify&lt;/strong&gt; if your version has it, and save.&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Field&lt;/th&gt;
&lt;th&gt;Value&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Base URL&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;https://api.apivai.com/v1&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;API Key&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;your key&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Model&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;claude-sonnet-4-6&lt;/code&gt; (or any ID from &lt;code&gt;GET /v1/models&lt;/code&gt;)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Max Output Tokens&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;8192 or more (at least 4096)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The base URL must end in &lt;code&gt;/v1&lt;/code&gt; exactly once, because Cline appends &lt;code&gt;/chat/completions&lt;/code&gt; itself. Leave &lt;strong&gt;Context Window&lt;/strong&gt;, &lt;strong&gt;Image Support&lt;/strong&gt; and &lt;strong&gt;Computer Use&lt;/strong&gt; at their defaults unless you know you need them. The Input/Output Price fields only change the cost estimate Cline shows; they don't affect billing.&lt;/p&gt;

&lt;p&gt;To see which model IDs your key can use:&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.apivai.com/v1/models &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-H&lt;/span&gt; &lt;span class="s2"&gt;"Authorization: Bearer your-key"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Copy IDs from that response rather than from old tutorials; the list changes.&lt;/p&gt;

&lt;h2&gt;
  
  
  Setting up Anthropic (Claude only)
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Set &lt;strong&gt;API Provider&lt;/strong&gt; to &lt;strong&gt;Anthropic&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Paste your key into &lt;strong&gt;Anthropic API Key&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Tick &lt;strong&gt;Use custom base URL&lt;/strong&gt; and enter &lt;code&gt;https://api.apivai.com&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Pick a Claude model from the dropdown.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Do &lt;strong&gt;not&lt;/strong&gt; add &lt;code&gt;/v1&lt;/code&gt; here. Cline's Anthropic client appends &lt;code&gt;/v1/messages&lt;/code&gt; on its own, so &lt;code&gt;https://api.apivai.com/v1&lt;/code&gt; turns into &lt;code&gt;/v1/v1/messages&lt;/code&gt; and returns 404. If the Claude model you want isn't in Cline's list yet, use the OpenAI Compatible provider and type the ID.&lt;/p&gt;

&lt;h2&gt;
  
  
  Which model for which job
&lt;/h2&gt;

&lt;p&gt;Cline re-sends the conversation and every file it has read on each step, so input tokens add up quickly and the price per token matters more than in a chat app. A practical split:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Everyday coding: &lt;code&gt;claude-sonnet-4-6&lt;/code&gt; or &lt;code&gt;claude-sonnet-5-5&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Hard bugs and large refactors, when Sonnet keeps going in circles: &lt;code&gt;claude-opus-5-5&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Renames, comments, small fixes: &lt;code&gt;claude-haiku-4-5&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;A second opinion: &lt;code&gt;gpt-5.5&lt;/code&gt; (OpenAI Compatible only)&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Common errors
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;401 / invalid key&lt;/strong&gt;: the key is incomplete or deleted. With the Anthropic provider, also check that &lt;strong&gt;Use custom base URL&lt;/strong&gt; is ticked, or Cline sends your key to Anthropic directly.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;402 / insufficient_quota&lt;/strong&gt;: the key's budget is used up, or what's left is too little for one request to an expensive model (Opus, Sonnet 4.6). Add budget to the key or switch to a cheaper model.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;404&lt;/strong&gt;: almost always &lt;code&gt;/v1&lt;/code&gt;. OpenAI Compatible needs &lt;code&gt;https://api.apivai.com/v1&lt;/code&gt; (one &lt;code&gt;/v1&lt;/code&gt;, no &lt;code&gt;/chat/completions&lt;/code&gt;); Anthropic needs &lt;code&gt;https://api.apivai.com&lt;/code&gt; without &lt;code&gt;/v1&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Model not found&lt;/strong&gt;: use the exact ID, such as &lt;code&gt;claude-sonnet-4-6&lt;/code&gt;, not the display name.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Empty or cut-off replies&lt;/strong&gt;: thinking is on by default and uses output tokens. Raise &lt;strong&gt;Max Output Tokens&lt;/strong&gt; to 8192 (at least 4096).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;429&lt;/strong&gt;: the default limit is 60 requests per minute per key. Long agent runs can hit it; wait a moment or split work across keys.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What it costs
&lt;/h2&gt;

&lt;p&gt;At the time of writing, most Claude models on APIVAI are 56–62% below Anthropic's list prices and GPT models up to 86% below OpenAI's; for example, Claude Sonnet 4.6 is $1.15 / $5.74 per million input / output tokens against the official $3 / $15. It's prepaid and billed per token, with no subscription. The full table is at &lt;a href="https://apivai.com/pricing" rel="noopener noreferrer"&gt;https://apivai.com/pricing&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Questions are welcome in the comments.&lt;/p&gt;

</description>
      <category>cline</category>
      <category>ai</category>
      <category>vscode</category>
      <category>claude</category>
    </item>
    <item>
      <title>Pointing Codex CLI at your own API gateway: config.toml, keys and common errors</title>
      <dc:creator>APIVAI</dc:creator>
      <pubDate>Thu, 08 Oct 2026 11:06:46 +0000</pubDate>
      <link>https://dev.to/mupromax/pointing-codex-cli-at-your-own-api-gateway-configtoml-keys-and-common-errors-13nd</link>
      <guid>https://dev.to/mupromax/pointing-codex-cli-at-your-own-api-gateway-configtoml-keys-and-common-errors-13nd</guid>
      <description>&lt;p&gt;&lt;em&gt;Disclosure: I run APIVAI, the gateway used in the examples below. The same config works with any endpoint that supports the OpenAI Responses API.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Codex CLI talks to OpenAI by default, but it lets you define your own model provider in its config file. That means you can point it at another gateway with a few lines of TOML. Here is the setup, where the key goes, and the mistakes that cause most of the errors.&lt;/p&gt;

&lt;h2&gt;
  
  
  Codex uses the Responses API
&lt;/h2&gt;

&lt;p&gt;Unlike most tools, Codex CLI does not call &lt;code&gt;/v1/chat/completions&lt;/code&gt;. It uses OpenAI's &lt;strong&gt;Responses API&lt;/strong&gt; (&lt;code&gt;/v1/responses&lt;/code&gt;). Whatever endpoint you point it at has to support that API, or tool calls and streaming will break. The &lt;code&gt;wire_api = "responses"&lt;/code&gt; line in the config tells Codex which API to use.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 1: the config file
&lt;/h2&gt;

&lt;p&gt;Location:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;macOS / Linux: &lt;code&gt;~/.codex/config.toml&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Windows: &lt;code&gt;%USERPROFILE%\.codex\config.toml&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight toml"&gt;&lt;code&gt;&lt;span class="py"&gt;model&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"gpt-5.5"&lt;/span&gt;
&lt;span class="py"&gt;model_provider&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"apivai"&lt;/span&gt;

&lt;span class="nn"&gt;[model_providers.apivai]&lt;/span&gt;
&lt;span class="py"&gt;name&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"APIVAI"&lt;/span&gt;
&lt;span class="py"&gt;base_url&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"https://api.apivai.com/v1"&lt;/span&gt;
&lt;span class="py"&gt;env_key&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"OPENAI_API_KEY"&lt;/span&gt;
&lt;span class="py"&gt;wire_api&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"responses"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Field&lt;/th&gt;
&lt;th&gt;What it does&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;model&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Default model ID&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;model_provider&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Which provider to use; must match the &lt;code&gt;[model_providers.xxx]&lt;/code&gt; name&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;base_url&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Endpoint, &lt;strong&gt;with&lt;/strong&gt; &lt;code&gt;/v1&lt;/code&gt;; Codex appends &lt;code&gt;/responses&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;env_key&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Environment variable that holds the key&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;wire_api&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;responses&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Step 2: the key
&lt;/h2&gt;

&lt;p&gt;The key does not go in the config file. Codex reads it from the variable named in &lt;code&gt;env_key&lt;/code&gt;.&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="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;OPENAI_API_KEY&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"your-key"&lt;/span&gt;
codex &lt;span class="s2"&gt;"explain what this repo does in two sentences"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Windows PowerShell:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight powershell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$&lt;/span&gt;&lt;span class="nn"&gt;env&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="nv"&gt;OPENAI_API_KEY&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"your-key"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="n"&gt;codex&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"explain what this repo does in two sentences"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Start with a small question like this before you let it edit code.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 3: check the model ID
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl https://api.apivai.com/v1/models &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-H&lt;/span&gt; &lt;span class="s2"&gt;"Authorization: Bearer your-key"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To switch models for one run, pass &lt;code&gt;-m&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;codex &lt;span class="nt"&gt;-m&lt;/span&gt; gpt-5.5 &lt;span class="s2"&gt;"add unit tests for utils.py"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Common errors
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;401 Unauthorized&lt;/strong&gt;: Codex can't see the key. Check that the variable name in &lt;code&gt;env_key&lt;/code&gt; matches the one you set, and that it is set in the terminal you're using (&lt;code&gt;echo $OPENAI_API_KEY&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;404 Not Found&lt;/strong&gt;: &lt;code&gt;base_url&lt;/code&gt; must be &lt;code&gt;https://api.apivai.com/v1&lt;/code&gt;. Don't drop &lt;code&gt;/v1&lt;/code&gt;, and don't add &lt;code&gt;/responses&lt;/code&gt; yourself.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;"provider not found", or requests not reaching the gateway&lt;/strong&gt;: the &lt;code&gt;model_provider&lt;/code&gt; value must match the &lt;code&gt;[model_providers.xxx]&lt;/code&gt; name exactly, and you must be editing the right &lt;code&gt;config.toml&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Tool calls fail or output hangs&lt;/strong&gt;: &lt;code&gt;wire_api&lt;/code&gt; is missing or set to &lt;code&gt;chat&lt;/code&gt;, or the endpoint doesn't support the Responses API.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Model not found&lt;/strong&gt;: use an exact ID from &lt;code&gt;GET /v1/models&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;429&lt;/strong&gt;: the default limit is 60 requests per minute per key.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What it costs
&lt;/h2&gt;

&lt;p&gt;At the time of writing, GPT models on APIVAI are up to 86% below OpenAI's list prices and Claude models 56–62% below Anthropic's. It's prepaid and billed per token, with no subscription. The full table is at &lt;a href="https://apivai.com/pricing" rel="noopener noreferrer"&gt;https://apivai.com/pricing&lt;/a&gt;, and setup guides for other tools are at &lt;a href="https://apivai.com/blog" rel="noopener noreferrer"&gt;https://apivai.com/blog&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Questions are welcome in the comments.&lt;/p&gt;

</description>
      <category>openai</category>
      <category>ai</category>
      <category>cli</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Running Claude Code, Cursor and Codex CLI through one API key</title>
      <dc:creator>APIVAI</dc:creator>
      <pubDate>Wed, 07 Oct 2026 18:50:56 +0000</pubDate>
      <link>https://dev.to/mupromax/running-claude-code-cursor-and-codex-cli-through-one-api-key-3hjd</link>
      <guid>https://dev.to/mupromax/running-claude-code-cursor-and-codex-cli-through-one-api-key-3hjd</guid>
      <description>&lt;p&gt;&lt;em&gt;Disclosure: I run APIVAI, the gateway used in the examples below. The setup steps work the same way with any endpoint that speaks the Anthropic and OpenAI formats.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Most AI coding tools let you change the API base URL. That means you can point Claude Code, Cursor, Codex CLI, Cline and the official SDKs at a single gateway and manage one key and one balance instead of several.&lt;/p&gt;

&lt;h3&gt;
  
  
  Claude Code
&lt;/h3&gt;

&lt;p&gt;Claude Code speaks the Anthropic Messages format. Set two environment variables:&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="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://api.apivai.com"&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;
claude
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;On Windows PowerShell:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight powershell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$&lt;/span&gt;&lt;span class="nn"&gt;env&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="nv"&gt;ANTHROPIC_BASE_URL&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"https://api.apivai.com"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="nv"&gt;$&lt;/span&gt;&lt;span class="nn"&gt;env&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="nv"&gt;ANTHROPIC_AUTH_TOKEN&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"your-key"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="n"&gt;claude&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Cursor
&lt;/h3&gt;

&lt;p&gt;Settings → Models → API Keys: turn on &lt;strong&gt;Override OpenAI Base URL&lt;/strong&gt;, enter &lt;code&gt;https://api.apivai.com/v1&lt;/code&gt;, paste your key, then add the model IDs you want (for example &lt;code&gt;claude-sonnet-4-6&lt;/code&gt;).&lt;/p&gt;

&lt;h3&gt;
  
  
  OpenAI SDK (Python)
&lt;/h3&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://api.apivai.com/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;r&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-4-6&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;Hello&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;r&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;h3&gt;
  
  
  Common errors
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;401&lt;/strong&gt;: the key is wrong, or it was sent in the wrong header. Use &lt;code&gt;x-api-key&lt;/code&gt; or &lt;code&gt;Authorization: Bearer&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;404&lt;/strong&gt;: usually a &lt;code&gt;/v1&lt;/code&gt; mismatch. Anthropic-format tools use the root URL, OpenAI-format tools need &lt;code&gt;/v1&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;429&lt;/strong&gt;: the default limit is 60 requests per minute per key.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  What it costs
&lt;/h3&gt;

&lt;p&gt;At the time of writing, Claude models on APIVAI are 56–62% below Anthropic's list prices and GPT models up to 86% below OpenAI's. For example, Claude Sonnet 4.6 is $1.15 / $5.74 per million input / output tokens against the official $3 / $15. It's prepaid and pay-per-token, with no subscription. The full table is at &lt;a href="https://apivai.com/pricing" rel="noopener noreferrer"&gt;https://apivai.com/pricing&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Setup guides for Cline, Roo Code, Aider, Continue, Open WebUI and others are on the blog: &lt;a href="https://apivai.com/blog" rel="noopener noreferrer"&gt;https://apivai.com/blog&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Questions are welcome in the comments.&lt;/p&gt;

</description>
      <category>claude</category>
      <category>ai</category>
      <category>productivity</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>How to Connect Roo Code to APIVAI (Cheap API for an AI Coding Agent)</title>
      <dc:creator>APIVAI</dc:creator>
      <pubDate>Sun, 28 Jun 2026 20:07:22 +0000</pubDate>
      <link>https://dev.to/mupromax/how-to-connect-roo-code-to-apivai-cheap-api-for-an-ai-coding-agent-3l06</link>
      <guid>https://dev.to/mupromax/how-to-connect-roo-code-to-apivai-cheap-api-for-an-ai-coding-agent-3l06</guid>
      <description>&lt;h2&gt;
  
  
  Connect Roo Code to APIVAI
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://github.com/RooVetGit/Roo-Code" rel="noopener noreferrer"&gt;Roo Code&lt;/a&gt; (formerly Roo Cline) is a popular autonomous&lt;br&gt;
coding agent for VS Code. It supports OpenAI-compatible providers, so you can run it on APIVAI's&lt;br&gt;
Claude and GPT models — agentic edits cost a lot of tokens, so a cheap compatible gateway matters.&lt;/p&gt;
&lt;h2&gt;
  
  
  Configure the provider
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Open Roo Code's settings (the gear icon in the Roo panel).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;API Provider:&lt;/strong&gt; choose &lt;strong&gt;OpenAI Compatible&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Set:

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Base URL:&lt;/strong&gt; &lt;code&gt;https://api.apivai.com/v1&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;API Key:&lt;/strong&gt; your APIVAI key&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Model:&lt;/strong&gt; a name APIVAI serves (e.g. &lt;code&gt;claude-sonnet-4-6&lt;/code&gt; or &lt;code&gt;gpt-5.5&lt;/code&gt;)&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Save.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Roo Code now routes its requests through APIVAI.&lt;/p&gt;
&lt;h2&gt;
  
  
  Pick a model
&lt;/h2&gt;

&lt;p&gt;Confirm valid names:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl &lt;span class="nt"&gt;-s&lt;/span&gt; https://api.apivai.com/v1/models &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;$APIVAI_API_KEY&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Claude Sonnet is a strong default for agentic coding; use it for multi-step edits and reasoning.&lt;/p&gt;

&lt;h2&gt;
  
  
  Tips for agent workloads
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Agents send many large requests — a discounted gateway like APIVAI noticeably lowers the bill.&lt;/li&gt;
&lt;li&gt;Prefer a model with a large context window for big files/repos.&lt;/li&gt;
&lt;li&gt;Make sure streaming passes through so you see progress as the agent works.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Troubleshooting
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;401&lt;/strong&gt; — check the key and that the provider is "OpenAI Compatible" with Base URL ending &lt;code&gt;/v1&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;model_not_found&lt;/code&gt;&lt;/strong&gt; — use a name from &lt;code&gt;/v1/models&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Truncated output&lt;/strong&gt; — raise max tokens / pick a larger-context model.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  FAQ
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Does Roo Code work with APIVAI?&lt;/strong&gt; Yes — select "OpenAI Compatible", set Base URL&lt;br&gt;
&lt;code&gt;https://api.apivai.com/v1&lt;/code&gt; and your APIVAI key.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Which model for Roo Code?&lt;/strong&gt; Claude Sonnet for agentic coding and reasoning; GPT-5.5 for faster,&lt;br&gt;
cheaper runs.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why use a gateway for an agent?&lt;/strong&gt; Coding agents burn tokens; APIVAI's discounted, OpenAI-compatible&lt;br&gt;
access cuts the cost without changing your workflow.&lt;/p&gt;

&lt;h2&gt;
  
  
  Get started
&lt;/h2&gt;

&lt;p&gt;Set the OpenAI-compatible provider in Roo Code with APIVAI's base URL + key and a model from&lt;br&gt;
&lt;code&gt;/v1/models&lt;/code&gt;. Examples: &lt;a href="https://github.com/mupromax/apivai-api-examples" rel="noopener noreferrer"&gt;APIVAI examples repo&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>roocode</category>
      <category>tutorial</category>
      <category>agents</category>
    </item>
    <item>
      <title>How to Build a Telegram AI Bot with APIVAI (Cheap Claude &amp; GPT)</title>
      <dc:creator>APIVAI</dc:creator>
      <pubDate>Sun, 28 Jun 2026 20:07:18 +0000</pubDate>
      <link>https://dev.to/mupromax/how-to-build-a-telegram-ai-bot-with-apivai-cheap-claude-gpt-f66</link>
      <guid>https://dev.to/mupromax/how-to-build-a-telegram-ai-bot-with-apivai-cheap-claude-gpt-f66</guid>
      <description>&lt;h2&gt;
  
  
  Build a Telegram AI bot with APIVAI
&lt;/h2&gt;

&lt;p&gt;A Telegram AI bot is one of the quickest ways to ship an AI assistant: create a bot with BotFather,&lt;br&gt;
run a small script that forwards messages to an OpenAI-compatible model, and reply. APIVAI provides&lt;br&gt;
the model (Claude or GPT) at a fraction of list price, with crypto/USDT/Alipay payment.&lt;/p&gt;

&lt;p&gt;This guide is the full working bot.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Create the bot
&lt;/h2&gt;

&lt;p&gt;Message &lt;strong&gt;&lt;a class="mentioned-user" href="https://dev.to/botfather"&gt;@botfather&lt;/a&gt;&lt;/strong&gt; on Telegram → &lt;code&gt;/newbot&lt;/code&gt; → choose a name → copy the &lt;strong&gt;bot token&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. The bot (Node.js, long polling — no server needed)
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install &lt;/span&gt;node-telegram-bot-api openai
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&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="nx"&gt;TelegramBot&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;node-telegram-bot-api&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;OpenAI&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;openai&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;bot&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;TelegramBot&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;TELEGRAM_BOT_TOKEN&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;polling&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;ai&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="na"&gt;apiKey&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;APIVAI_API_KEY&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;baseURL&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;https://api.apivai.com/v1&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;SYSTEM&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;You are a helpful assistant. Answer concisely in the user's language.&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;history&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;Map&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt; &lt;span class="c1"&gt;// chatId -&amp;gt; messages[]&lt;/span&gt;

&lt;span class="nx"&gt;bot&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;on&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;message&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;async &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;msg&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nx"&gt;msg&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;text&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="nx"&gt;msg&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;text&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;startsWith&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;/&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;chatId&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;msg&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;chat&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;msgs&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;history&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;chatId&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="p"&gt;[{&lt;/span&gt; &lt;span class="na"&gt;role&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;system&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;content&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;SYSTEM&lt;/span&gt; &lt;span class="p"&gt;}];&lt;/span&gt;
  &lt;span class="nx"&gt;msgs&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;push&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;role&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;user&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;content&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;msg&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;text&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;

  &lt;span class="nx"&gt;bot&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;sendChatAction&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;chatId&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;typing&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;r&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;ai&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;chat&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&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="na"&gt;model&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;gpt-5.5&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;messages&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;msgs&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;slice&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;12&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="na"&gt;max_tokens&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;500&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;reply&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;r&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&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="nx"&gt;message&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;content&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

  &lt;span class="nx"&gt;msgs&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;push&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;role&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;assistant&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;content&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;reply&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;
  &lt;span class="nx"&gt;history&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;chatId&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;msgs&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;slice&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;12&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt; &lt;span class="c1"&gt;// keep recent context&lt;/span&gt;
  &lt;span class="nx"&gt;bot&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;sendMessage&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;chatId&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;reply&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;Set &lt;code&gt;TELEGRAM_BOT_TOKEN&lt;/code&gt; and &lt;code&gt;APIVAI_API_KEY&lt;/code&gt;, run &lt;code&gt;node bot.js&lt;/code&gt;, and message your bot.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Add commands &amp;amp; polish
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;/start&lt;/code&gt; → a welcome message; &lt;code&gt;/reset&lt;/code&gt; → clear that chat's history.&lt;/li&gt;
&lt;li&gt;Trim history (last ~12 messages) to control token cost.&lt;/li&gt;
&lt;li&gt;Stream long answers by editing the message as chunks arrive (optional).&lt;/li&gt;
&lt;li&gt;For groups, only respond when mentioned or replied to.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Pick the model
&lt;/h2&gt;

&lt;p&gt;GPT-5.5 for fast, natural, multilingual replies; Claude Sonnet for coding/long-reasoning bots.&lt;br&gt;
Switch by changing the &lt;code&gt;model&lt;/code&gt; string — it's OpenAI-compatible.&lt;/p&gt;

&lt;h2&gt;
  
  
  FAQ
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Can a Telegram bot use APIVAI?&lt;/strong&gt; Yes — it's a normal OpenAI chat call with the base URL set to&lt;br&gt;
&lt;code&gt;https://api.apivai.com/v1&lt;/code&gt;; the bot forwards messages and returns the reply.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Do I need a server?&lt;/strong&gt; No — long polling (above) runs anywhere Node runs. Use webhooks if you want&lt;br&gt;
a serverless deployment.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Which model should the bot use?&lt;/strong&gt; GPT-5.5 for general/multilingual chat; Claude Sonnet for&lt;br&gt;
code-heavy bots.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How do I control cost?&lt;/strong&gt; Trim conversation history and cap &lt;code&gt;max_tokens&lt;/code&gt;; APIVAI's per-token price&lt;br&gt;
is already low.&lt;/p&gt;

&lt;h2&gt;
  
  
  Get started
&lt;/h2&gt;

&lt;p&gt;Create a bot with BotFather, drop in the script with your APIVAI key, and run it. Examples:&lt;br&gt;
&lt;a href="https://github.com/mupromax/apivai-api-examples" rel="noopener noreferrer"&gt;APIVAI examples repo&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>telegram</category>
      <category>aibot</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>The Cheapest Way to Use Claude &amp; GPT APIs in 2026</title>
      <dc:creator>APIVAI</dc:creator>
      <pubDate>Thu, 25 Jun 2026 15:46:00 +0000</pubDate>
      <link>https://dev.to/mupromax/the-cheapest-way-to-use-claude-gpt-apis-in-2026-17kj</link>
      <guid>https://dev.to/mupromax/the-cheapest-way-to-use-claude-gpt-apis-in-2026-17kj</guid>
      <description>&lt;h2&gt;
  
  
  The cheapest way to use Claude &amp;amp; GPT in 2026
&lt;/h2&gt;

&lt;p&gt;If you run AI coding agents or apps all day, the API bill is usually your biggest cost. The good news: you rarely need to pay official list price. Because almost every tool speaks the &lt;strong&gt;OpenAI-compatible&lt;/strong&gt; API format, the model provider is just a configuration value — you can route to a cheaper compatible gateway without changing any code.&lt;/p&gt;

&lt;p&gt;This guide covers the cheapest, most practical way to access Claude and GPT models in 2026.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why it works: OpenAI-compatible everywhere
&lt;/h2&gt;

&lt;p&gt;Claude Code, Cursor, Cline, Codex CLI, and the official OpenAI/Anthropic SDKs all talk to an OpenAI-compatible endpoint. That means switching providers is two environment variables:&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="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;OPENAI_BASE_URL&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"https://api.apivai.com/v1"&lt;/span&gt;
&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;OPENAI_API_KEY&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"sk-your-key"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The tool doesn't care who is behind the URL, as long as it speaks the standard format.&lt;/p&gt;

&lt;h2&gt;
  
  
  What to look for in a cheap provider
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Factor&lt;/th&gt;
&lt;th&gt;Why it matters&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Price vs official&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;The whole point — aim for a large discount on input/output tokens&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;OpenAI-compatible&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Drop-in for existing tools, no rewrite&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Streaming passthrough&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Token-by-token output must keep working (real SSE, not buffered)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Model coverage&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Both Claude and GPT families behind one key&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Pay-as-you-go&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;No subscription; top up and spend down&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Payment options&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Cards, plus crypto/USDT/Alipay if you can't use a card&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  How APIVAI fits
&lt;/h2&gt;

&lt;p&gt;APIVAI is an OpenAI- and Anthropic-compatible gateway to Claude and GPT models at a fraction of list price. One key works across models, streaming is proxied as real chunks, and you can pay with crypto, USDT, or Alipay — no VPN, no subscription.&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.apivai.com/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;$APIVAI_API_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":"claude-sonnet-4-6","messages":[{"role":"user","content":"Hello"}]}'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Cut costs further
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Pick the right model per task — use a smaller/faster model for routine work and reserve the most powerful model for hard problems.&lt;/li&gt;
&lt;li&gt;Cache where you can; reuse context instead of resending it.&lt;/li&gt;
&lt;li&gt;Watch per-model context limits so you aren't paying for tokens you don't need.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Get started
&lt;/h2&gt;

&lt;p&gt;Create a key, call &lt;code&gt;GET /v1/models&lt;/code&gt; to see what's available, set the two environment variables, and send your first request. Your existing tools keep working — just cheaper.&lt;/p&gt;

</description>
      <category>cost</category>
      <category>2026</category>
      <category>cheapapi</category>
    </item>
    <item>
      <title>How to Use Continue.dev with a Cheap OpenAI-Compatible API</title>
      <dc:creator>APIVAI</dc:creator>
      <pubDate>Thu, 25 Jun 2026 15:45:56 +0000</pubDate>
      <link>https://dev.to/mupromax/how-to-use-continuedev-with-a-cheap-openai-compatible-api-3f53</link>
      <guid>https://dev.to/mupromax/how-to-use-continuedev-with-a-cheap-openai-compatible-api-3f53</guid>
      <description>&lt;h2&gt;
  
  
  Use Continue.dev with a cheap OpenAI-compatible API
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://continue.dev" rel="noopener noreferrer"&gt;Continue.dev&lt;/a&gt; is a popular open-source AI assistant for VS Code and JetBrains. Like most modern AI coding tools, it speaks the OpenAI-compatible API format — so you don't have to pay official list price. Point it at a cheaper compatible provider and everything works unchanged.&lt;/p&gt;

&lt;p&gt;This guide shows the exact Continue config to use an OpenAI-compatible gateway like APIVAI.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why it works
&lt;/h2&gt;

&lt;p&gt;Continue lets you define any model with a &lt;code&gt;provider: "openai"&lt;/code&gt; block and a custom &lt;code&gt;apiBase&lt;/code&gt;. That's all it takes to route through a discount gateway — the requests are standard OpenAI chat completions.&lt;/p&gt;

&lt;h2&gt;
  
  
  Configure Continue
&lt;/h2&gt;

&lt;p&gt;Open your Continue config (&lt;code&gt;~/.continue/config.json&lt;/code&gt;, or the YAML config in newer versions) and add a model:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"models"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"title"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"APIVAI - Claude Sonnet"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"provider"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"openai"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"model"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"claude-sonnet-4-6"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"apiBase"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"https://api.apivai.com/v1"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"apiKey"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"sk-your-apivai-key"&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That's it. Reload Continue and the model appears in the dropdown. Send a message to confirm it streams.&lt;/p&gt;

&lt;h2&gt;
  
  
  Pick a model that exists
&lt;/h2&gt;

&lt;p&gt;Model availability varies, so list what's available first instead of guessing:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl &lt;span class="nt"&gt;-s&lt;/span&gt; https://api.apivai.com/v1/models &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;$APIVAI_API_KEY&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Use a model name from that response for the &lt;code&gt;model&lt;/code&gt; field.&lt;/p&gt;

&lt;h2&gt;
  
  
  Things to verify
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Streaming&lt;/strong&gt; — Continue streams responses; make sure your provider passes real SSE chunks so output appears token by token.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Model name&lt;/strong&gt; — must match one the provider serves (avoids &lt;code&gt;model_not_found&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Context window&lt;/strong&gt; — pick a model whose context fits your codebase chunks.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Why APIVAI
&lt;/h2&gt;

&lt;p&gt;APIVAI is OpenAI- and Anthropic-compatible, covers Claude and GPT models behind one key, and is priced at a fraction of official list. Pay-as-you-go with crypto, USDT, or Alipay, no VPN required — handy if you can't or don't want to use a card.&lt;/p&gt;

&lt;h2&gt;
  
  
  Get started
&lt;/h2&gt;

&lt;p&gt;Grab a key, drop the config block above into Continue with a model from &lt;code&gt;/v1/models&lt;/code&gt;, and start coding at a fraction of the cost — no code changes, same workflow.&lt;/p&gt;

</description>
      <category>continuedev</category>
      <category>tutorial</category>
      <category>ide</category>
    </item>
    <item>
      <title>How to Run Whisper Locally for Real-Time Speech-to-Text (faster-whisper)</title>
      <dc:creator>APIVAI</dc:creator>
      <pubDate>Thu, 25 Jun 2026 15:45:29 +0000</pubDate>
      <link>https://dev.to/mupromax/how-to-run-whisper-locally-for-real-time-speech-to-text-faster-whisper-35df</link>
      <guid>https://dev.to/mupromax/how-to-run-whisper-locally-for-real-time-speech-to-text-faster-whisper-35df</guid>
      <description>&lt;h2&gt;
  
  
  Run Whisper locally for real-time speech-to-text
&lt;/h2&gt;

&lt;p&gt;For live translation and voice apps, you want speech-to-text that's fast and free per use — which&lt;br&gt;
means running Whisper &lt;strong&gt;locally&lt;/strong&gt; with &lt;code&gt;faster-whisper&lt;/code&gt;. It pairs perfectly with APIVAI for the&lt;br&gt;
translation step: Whisper turns audio into text locally, APIVAI (GPT-5.5) translates it cheaply over&lt;br&gt;
an OpenAI-compatible call, and you keep latency low and per-second cost at zero for the audio part.&lt;/p&gt;

&lt;p&gt;This guide gets local Whisper running for real-time use.&lt;/p&gt;

&lt;h2&gt;
  
  
  Install
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pip &lt;span class="nb"&gt;install &lt;/span&gt;faster-whisper
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;faster-whisper&lt;/code&gt; is a fast reimplementation of OpenAI's Whisper using CTranslate2. It runs on GPU&lt;br&gt;
(CUDA) or CPU.&lt;/p&gt;

&lt;h2&gt;
  
  
  Choose a model size
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Model&lt;/th&gt;
&lt;th&gt;Speed&lt;/th&gt;
&lt;th&gt;Accuracy&lt;/th&gt;
&lt;th&gt;Use&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;tiny&lt;/code&gt; / &lt;code&gt;base&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;fastest&lt;/td&gt;
&lt;td&gt;lower&lt;/td&gt;
&lt;td&gt;quick captions, weak hardware&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;small&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;fast&lt;/td&gt;
&lt;td&gt;good&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;recommended for live&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;medium&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;slower&lt;/td&gt;
&lt;td&gt;better&lt;/td&gt;
&lt;td&gt;accuracy over speed&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;large-v3&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;slowest&lt;/td&gt;
&lt;td&gt;best&lt;/td&gt;
&lt;td&gt;offline/high-accuracy jobs&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;For live captioning, &lt;code&gt;small&lt;/code&gt; on a GPU is the sweet spot.&lt;/p&gt;

&lt;h2&gt;
  
  
  Transcribe in near real time
&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;faster_whisper&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;WhisperModel&lt;/span&gt;

&lt;span class="n"&gt;model&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;WhisperModel&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;small&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;device&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;cuda&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;compute_type&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;float16&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;  &lt;span class="c1"&gt;# device="cpu", compute_type="int8" for CPU
&lt;/span&gt;
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;transcribe&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;audio_path&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;lang&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;zh&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;segments&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;_&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;transcribe&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;audio_path&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;language&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;lang&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;vad_filter&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;beam_size&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="sh"&gt;""&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;join&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;text&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;s&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;segments&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;strip&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Capture short audio chunks (1–3s) from the mic/OBS monitor and feed them in.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;vad_filter=True&lt;/code&gt; skips silence so you don't transcribe noise.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;beam_size=1&lt;/code&gt; favors speed for live use.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Hook it to translation (APIVAI)
&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;ai&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_APIVAI_API_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://api.apivai.com/v1&lt;/span&gt;&lt;span class="sh"&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;translate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;text&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;target&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Spanish&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;r&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;ai&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;gpt-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="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;system&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="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Translate to natural &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;target&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;. Output only the translation.&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="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="n"&gt;text&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;r&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;span class="nf"&gt;strip&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="nf"&gt;translate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;transcribe&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;chunk.wav&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Performance tips
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;GPU (&lt;code&gt;float16&lt;/code&gt;) is much faster than CPU; on CPU use &lt;code&gt;int8&lt;/code&gt; and a smaller model.&lt;/li&gt;
&lt;li&gt;Pre-load the model once and reuse it; don't reload per chunk.&lt;/li&gt;
&lt;li&gt;Keep chunks short; longer audio adds latency.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  FAQ
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Is local Whisper free?&lt;/strong&gt; Yes — &lt;code&gt;faster-whisper&lt;/code&gt; runs on your own hardware; there's no per-call&lt;br&gt;
cost. You only pay for the translation step (e.g. GPT-5.5 via APIVAI), which is cheap.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Does APIVAI provide Whisper?&lt;/strong&gt; No — APIVAI provides the OpenAI/Anthropic-compatible chat models&lt;br&gt;
(the translation step). Run Whisper locally for speech-to-text.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Which model size for live captions?&lt;/strong&gt; &lt;code&gt;small&lt;/code&gt; on a GPU — a good balance of speed and accuracy.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What latency can I expect?&lt;/strong&gt; With &lt;code&gt;small&lt;/code&gt; + short chunks, transcription is sub-second; end-to-end&lt;br&gt;
(STT → translate → caption) is typically ~1–2s.&lt;/p&gt;

&lt;h2&gt;
  
  
  Get started
&lt;/h2&gt;

&lt;p&gt;Install faster-whisper, run the transcribe loop, and send the text to APIVAI for translation.&lt;br&gt;
Examples: &lt;a href="https://github.com/mupromax/apivai-api-examples" rel="noopener noreferrer"&gt;APIVAI examples repo&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>whisper</category>
      <category>speechtotext</category>
      <category>realtimetranslation</category>
    </item>
    <item>
      <title>How to Build a Discord AI Bot with APIVAI (Cheap Claude &amp; GPT)</title>
      <dc:creator>APIVAI</dc:creator>
      <pubDate>Thu, 25 Jun 2026 15:45:26 +0000</pubDate>
      <link>https://dev.to/mupromax/how-to-build-a-discord-ai-bot-with-apivai-cheap-claude-gpt-149e</link>
      <guid>https://dev.to/mupromax/how-to-build-a-discord-ai-bot-with-apivai-cheap-claude-gpt-149e</guid>
      <description>&lt;h2&gt;
  
  
  Build a Discord AI bot with APIVAI
&lt;/h2&gt;

&lt;p&gt;A Discord AI bot lets your server chat with Claude or GPT. Create a bot application, run a small&lt;br&gt;
discord.js script that forwards messages to an OpenAI-compatible model, and reply. APIVAI provides&lt;br&gt;
the model at a fraction of list price, with crypto/USDT/Alipay payment.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Create the bot
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Go to the &lt;strong&gt;Discord Developer Portal&lt;/strong&gt; → New Application → &lt;strong&gt;Bot&lt;/strong&gt; → copy the &lt;strong&gt;bot token&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Enable the &lt;strong&gt;Message Content Intent&lt;/strong&gt; (Bot settings) so the bot can read messages.&lt;/li&gt;
&lt;li&gt;Invite the bot to your server (OAuth2 URL with the &lt;code&gt;bot&lt;/code&gt; scope and Send Messages permission).&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  2. The bot (discord.js)
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install &lt;/span&gt;discord.js openai
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&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="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;Client&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;GatewayIntentBits&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;discord.js&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;OpenAI&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;openai&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&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;Client&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;intents&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;GatewayIntentBits&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;Guilds&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;GatewayIntentBits&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;GuildMessages&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;GatewayIntentBits&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;MessageContent&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="nx"&gt;ai&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="na"&gt;apiKey&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;APIVAI_API_KEY&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;baseURL&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;https://api.apivai.com/v1&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;SYSTEM&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;You are a helpful assistant in a Discord server. Be concise.&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="nx"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;on&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;messageCreate&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;async &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;msg&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;msg&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;author&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;bot&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="c1"&gt;// respond when mentioned (so the bot isn't noisy)&lt;/span&gt;
  &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nx"&gt;msg&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;mentions&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;has&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;prompt&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;msg&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;content&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;replace&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sr"&gt;/&amp;lt;@!&lt;/span&gt;&lt;span class="se"&gt;?\d&lt;/span&gt;&lt;span class="sr"&gt;+&amp;gt;/g&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;""&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;trim&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
  &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;msg&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;channel&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;sendTyping&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;r&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;ai&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;chat&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&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="na"&gt;model&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;gpt-5.5&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;messages&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[{&lt;/span&gt; &lt;span class="na"&gt;role&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;system&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;content&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;SYSTEM&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;role&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;user&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;content&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;prompt&lt;/span&gt; &lt;span class="p"&gt;}],&lt;/span&gt;
    &lt;span class="na"&gt;max_tokens&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;500&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;});&lt;/span&gt;
  &lt;span class="nx"&gt;msg&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;reply&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;r&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&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="nx"&gt;message&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;content&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;slice&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="mi"&gt;1900&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt; &lt;span class="c1"&gt;// Discord 2000-char limit&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;

&lt;span class="nx"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;login&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;DISCORD_BOT_TOKEN&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Set &lt;code&gt;DISCORD_BOT_TOKEN&lt;/code&gt; and &lt;code&gt;APIVAI_API_KEY&lt;/code&gt;, run &lt;code&gt;node bot.js&lt;/code&gt;, and mention the bot in your server.&lt;/p&gt;

&lt;h2&gt;
  
  
  Polish
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Add slash commands (&lt;code&gt;/ask&lt;/code&gt;) for a cleaner UX.&lt;/li&gt;
&lt;li&gt;Keep short per-channel history for context; trim to control token cost.&lt;/li&gt;
&lt;li&gt;Split replies over 2000 chars into multiple messages.&lt;/li&gt;
&lt;li&gt;Pick GPT-5.5 for general chat, Claude Sonnet for coding help.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  FAQ
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Can a Discord bot use APIVAI?&lt;/strong&gt; Yes — it's a standard OpenAI chat call with base URL&lt;br&gt;
&lt;code&gt;https://api.apivai.com/v1&lt;/code&gt;; the bot forwards the message and posts the reply.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Which model should the bot use?&lt;/strong&gt; GPT-5.5 for general/multilingual chat; Claude Sonnet for code.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How do I keep it from being spammy?&lt;/strong&gt; Only respond when mentioned or via a slash command.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How do I control cost?&lt;/strong&gt; Trim history and cap &lt;code&gt;max_tokens&lt;/code&gt;; APIVAI's per-token price is already low.&lt;/p&gt;

&lt;h2&gt;
  
  
  Get started
&lt;/h2&gt;

&lt;p&gt;Create a bot app, drop in the script with your APIVAI key, and run it. Examples:&lt;br&gt;
&lt;a href="https://github.com/mupromax/apivai-api-examples" rel="noopener noreferrer"&gt;APIVAI examples repo&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>discord</category>
      <category>aibot</category>
      <category>tutorial</category>
    </item>
  </channel>
</rss>
