<?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.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>How to Use Cursor with a Cheap AI API (Save 90%)</title>
      <dc:creator>APIVAI</dc:creator>
      <pubDate>Wed, 10 Jun 2026 17:38:05 +0000</pubDate>
      <link>https://dev.to/mupromax/how-to-use-cursor-with-a-cheap-ai-api-save-90-4mbh</link>
      <guid>https://dev.to/mupromax/how-to-use-cursor-with-a-cheap-ai-api-save-90-4mbh</guid>
      <description>&lt;h2&gt;
  
  
  Cursor + Cheap AI API = Best Developer Experience
&lt;/h2&gt;

&lt;p&gt;Cursor is one of the most popular AI-powered IDEs. It supports custom API endpoints, which means you can route requests through a cheaper provider.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Use a Custom API?
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Option&lt;/th&gt;
&lt;th&gt;Cost&lt;/th&gt;
&lt;th&gt;Limitation&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Cursor Pro&lt;/td&gt;
&lt;td&gt;$20/month&lt;/td&gt;
&lt;td&gt;Rate limited&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Cursor + Official API&lt;/td&gt;
&lt;td&gt;$3-5/M tokens&lt;/td&gt;
&lt;td&gt;Expensive at scale&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Cursor + APIVAI&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;$0.77/M tokens&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;No limits, 90% cheaper&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Setup in 2 Minutes
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Step 1: Get Your API Key
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Sign up at &lt;a href="https://apivai.com/register" rel="noopener noreferrer"&gt;apivai.com&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Top up your balance ($10 minimum)&lt;/li&gt;
&lt;li&gt;Copy your API key from the dashboard&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Step 2: Configure Cursor
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Open Cursor Settings (Cmd+, or Ctrl+,)&lt;/li&gt;
&lt;li&gt;Go to &lt;strong&gt;Models&lt;/strong&gt; section&lt;/li&gt;
&lt;li&gt;Set &lt;strong&gt;Override OpenAI Base URL&lt;/strong&gt; to:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;https://api.apivai.com/v1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Set your &lt;strong&gt;API Key&lt;/strong&gt; to your APIVAI key&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Step 3: Select Your Model
&lt;/h3&gt;

&lt;p&gt;Choose from:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;claude-sonnet-4-6-20250514&lt;/code&gt; — Best balance (recommended)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;claude-opus-4-7-20250416&lt;/code&gt; — Most powerful&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;claude-haiku-4-5-20251001&lt;/code&gt; — Fastest, cheapest&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;gpt-5.4&lt;/code&gt; — OpenAI alternative&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Cost Savings Example
&lt;/h2&gt;

&lt;p&gt;A typical Cursor power user might make 50-100 AI requests per day:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Requests/day&lt;/th&gt;
&lt;th&gt;Cursor Pro&lt;/th&gt;
&lt;th&gt;APIVAI API&lt;/th&gt;
&lt;th&gt;Monthly Savings&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;50&lt;/td&gt;
&lt;td&gt;$20/mo (limited)&lt;/td&gt;
&lt;td&gt;~$4/mo&lt;/td&gt;
&lt;td&gt;$16&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;100&lt;/td&gt;
&lt;td&gt;$20/mo (heavily limited)&lt;/td&gt;
&lt;td&gt;~$8/mo&lt;/td&gt;
&lt;td&gt;$12 + no limits&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;200+&lt;/td&gt;
&lt;td&gt;Not possible&lt;/td&gt;
&lt;td&gt;~$16/mo&lt;/td&gt;
&lt;td&gt;Unlimited&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;With APIVAI, you get &lt;strong&gt;unlimited requests&lt;/strong&gt; — no rate limiting, no throttling.&lt;/p&gt;

&lt;h2&gt;
  
  
  Also Works With
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;VS Code&lt;/strong&gt; + Continue extension&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Neovim&lt;/strong&gt; + avante.nvim&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;JetBrains&lt;/strong&gt; + AI Assistant&lt;/li&gt;
&lt;li&gt;Any tool that supports OpenAI-compatible APIs&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Get Started
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://apivai.com/register" rel="noopener noreferrer"&gt;Sign up at apivai.com&lt;/a&gt; — takes 30 seconds, no credit card required.&lt;/p&gt;

</description>
      <category>cursor</category>
      <category>tutorial</category>
      <category>ide</category>
    </item>
    <item>
      <title>How to Set Up Claude Code with a Cheap API Provider</title>
      <dc:creator>APIVAI</dc:creator>
      <pubDate>Wed, 10 Jun 2026 17:32:39 +0000</pubDate>
      <link>https://dev.to/mupromax/how-to-set-up-claude-code-with-a-cheap-api-provider-2ogn</link>
      <guid>https://dev.to/mupromax/how-to-set-up-claude-code-with-a-cheap-api-provider-2ogn</guid>
      <description>&lt;h2&gt;
  
  
  What is Claude Code?
&lt;/h2&gt;

&lt;p&gt;Claude Code is Anthropic's official CLI tool that lets you use Claude directly in your terminal. It's incredibly powerful for coding, debugging, and automating development tasks.&lt;/p&gt;

&lt;p&gt;The problem? It uses the Anthropic API, which means you're paying $3/$15 per million tokens for Sonnet, or $5/$25 for Opus.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Solution: Use a Cheaper API Provider
&lt;/h2&gt;

&lt;p&gt;Instead of connecting directly to Anthropic, you can route Claude Code through APIVAI — an API gateway that offers the same models at up to 90% off.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What changes:&lt;/strong&gt; One environment variable (the base URL)&lt;br&gt;
&lt;strong&gt;What stays the same:&lt;/strong&gt; Everything else — same models, same quality, same features&lt;/p&gt;
&lt;h2&gt;
  
  
  Setup Guide
&lt;/h2&gt;
&lt;h3&gt;
  
  
  Prerequisites
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Claude Code installed (&lt;code&gt;npm install -g @anthropic-ai/claude-code&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;A APIVAI account (&lt;a href="https://apivai.com/register" rel="noopener noreferrer"&gt;sign up here&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;An API key from your APIVAI dashboard&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  Mac / Linux
&lt;/h3&gt;

&lt;p&gt;Add these to your &lt;code&gt;~/.bashrc&lt;/code&gt; or &lt;code&gt;~/.zshrc&lt;/code&gt; for permanent setup:&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_AUTH_TOKEN&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"your-apivai-api-key"&lt;/span&gt;
&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;ANTHROPIC_BASE_URL&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"https://api.apivai.com"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then run:&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;source&lt;/span&gt; ~/.bashrc  &lt;span class="c"&gt;# or source ~/.zshrc&lt;/span&gt;
claude
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Windows PowerShell
&lt;/h3&gt;

&lt;p&gt;Add to your PowerShell profile (&lt;code&gt;$PROFILE&lt;/code&gt;):&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_AUTH_TOKEN&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"your-apivai-api-key"&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_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="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then just run &lt;code&gt;claude&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  One-liner (temporary)
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Mac/Linux:&lt;/strong&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="nv"&gt;ANTHROPIC_AUTH_TOKEN&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"your-key"&lt;/span&gt; &lt;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; claude
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;PowerShell:&lt;/strong&gt;&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_AUTH_TOKEN&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"your-key"&lt;/span&gt;&lt;span class="p"&gt;;&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_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="p"&gt;;&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;h2&gt;
  
  
  Also Works With Codex CLI
&lt;/h2&gt;

&lt;p&gt;Since Codex 0.121+, you need a config file:&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;mkdir&lt;/span&gt; &lt;span class="nt"&gt;-p&lt;/span&gt; ~/.codex &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;cat&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; ~/.codex/config.toml &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="no"&gt;EOF&lt;/span&gt;&lt;span class="sh"&gt;'
model = "gpt-5.3-codex"
model_provider = "apivai"

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

&lt;/div&gt;



&lt;p&gt;Then run:&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="nv"&gt;OPENAI_API_KEY&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"your-apivai-key"&lt;/span&gt; codex
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Available Models
&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;Best For&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Claude Opus 4.7&lt;/td&gt;
&lt;td&gt;Most complex tasks, research&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Claude Opus 4.6&lt;/td&gt;
&lt;td&gt;Complex coding, analysis&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Claude Sonnet 4.6&lt;/td&gt;
&lt;td&gt;Best balance of speed and quality&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Claude Haiku 4.5&lt;/td&gt;
&lt;td&gt;Fast tasks, simple queries&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;GPT-5.4&lt;/td&gt;
&lt;td&gt;Alternative perspective&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;GPT-5.3 Codex&lt;/td&gt;
&lt;td&gt;Code generation&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Cost Comparison
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Daily Usage&lt;/th&gt;
&lt;th&gt;Official API&lt;/th&gt;
&lt;th&gt;APIVAI&lt;/th&gt;
&lt;th&gt;Monthly Savings&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Light (10 msgs/day)&lt;/td&gt;
&lt;td&gt;~$6/mo&lt;/td&gt;
&lt;td&gt;~$1.20/mo&lt;/td&gt;
&lt;td&gt;$4.80&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Medium (30 msgs/day)&lt;/td&gt;
&lt;td&gt;~$18/mo&lt;/td&gt;
&lt;td&gt;~$3.60/mo&lt;/td&gt;
&lt;td&gt;$14.40&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Heavy (100 msgs/day)&lt;/td&gt;
&lt;td&gt;~$60/mo&lt;/td&gt;
&lt;td&gt;~$12/mo&lt;/td&gt;
&lt;td&gt;$48&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

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

&lt;p&gt;&lt;strong&gt;"Unauthorized" error:&lt;/strong&gt; Make sure your API key starts with &lt;code&gt;sk-ant-&lt;/code&gt; and has sufficient balance.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;"Connection refused":&lt;/strong&gt; Check that &lt;code&gt;ANTHROPIC_BASE_URL&lt;/code&gt; is set to &lt;code&gt;https://api.apivai.com&lt;/code&gt; (no trailing slash, no /v1).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Slow responses:&lt;/strong&gt; First request may be slower due to prompt caching. Subsequent requests are faster.&lt;/p&gt;

&lt;h2&gt;
  
  
  Get Started
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;a href="https://apivai.com/register" rel="noopener noreferrer"&gt;Sign up at apivai.com&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Top up your balance (minimum $10)&lt;/li&gt;
&lt;li&gt;Copy your API key from the dashboard&lt;/li&gt;
&lt;li&gt;Set the environment variables and run &lt;code&gt;claude&lt;/code&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;That's it. Same Claude Code, 90% cheaper.&lt;/p&gt;

</description>
      <category>claudecode</category>
      <category>tutorial</category>
      <category>setupguide</category>
    </item>
    <item>
      <title>5 Best Cheap Claude API Alternatives in 2026</title>
      <dc:creator>APIVAI</dc:creator>
      <pubDate>Wed, 10 Jun 2026 17:32:35 +0000</pubDate>
      <link>https://dev.to/mupromax/5-best-cheap-claude-api-alternatives-in-2026-1891</link>
      <guid>https://dev.to/mupromax/5-best-cheap-claude-api-alternatives-in-2026-1891</guid>
      <description>&lt;h2&gt;
  
  
  Why Look for Claude API Alternatives?
&lt;/h2&gt;

&lt;p&gt;Anthropic's official Claude API pricing is steep:&lt;/p&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;Official Input&lt;/th&gt;
&lt;th&gt;Official Output&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Claude Opus 4.7&lt;/td&gt;
&lt;td&gt;$5/M tokens&lt;/td&gt;
&lt;td&gt;$25/M tokens&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Claude Sonnet 4.6&lt;/td&gt;
&lt;td&gt;$3/M tokens&lt;/td&gt;
&lt;td&gt;$15/M tokens&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Claude Haiku 4.5&lt;/td&gt;
&lt;td&gt;$1/M tokens&lt;/td&gt;
&lt;td&gt;$5/M tokens&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;For developers and startups, these costs add up quickly. A typical Claude Code session can burn through $5-10 per day. Here are the best alternatives.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. APIVAI — Best Overall (Up to 90% Off)
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Pricing:&lt;/strong&gt; From $0.77/M input, $3.86/M output (Sonnet 4.6)&lt;/p&gt;

&lt;p&gt;APIVAI is an API gateway that provides access to all Claude and GPT models through a single OpenAI-compatible API:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Drop-in replacement — change one URL&lt;/li&gt;
&lt;li&gt;Works with Claude Code, Cursor, Codex CLI&lt;/li&gt;
&lt;li&gt;Pay per token, no subscription&lt;/li&gt;
&lt;li&gt;No VPN needed, no region restrictions&lt;/li&gt;
&lt;li&gt;Supports Claude Opus 4.7, 4.6, Sonnet 4.6, Haiku 4.5, GPT-5.4
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Claude Code setup&lt;/span&gt;
&lt;span class="nv"&gt;ANTHROPIC_AUTH_TOKEN&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"your-key"&lt;/span&gt; &lt;span class="se"&gt;\&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="se"&gt;\&lt;/span&gt;
claude
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Best for:&lt;/strong&gt; Developers who want the cheapest Claude API access with zero setup friction.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. OpenRouter
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Pricing:&lt;/strong&gt; Close to official rates (small markup)&lt;/p&gt;

&lt;p&gt;OpenRouter aggregates multiple AI providers but prices are typically only 5-10% below official. Good selection of models but not the cheapest option.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Best for:&lt;/strong&gt; Users who need access to many different providers.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. AWS Bedrock
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Pricing:&lt;/strong&gt; Similar to official, volume discounts available&lt;/p&gt;

&lt;p&gt;Amazon Bedrock offers Claude models with enterprise features. Requires AWS account setup and IAM configuration. Not ideal for individual developers.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Best for:&lt;/strong&gt; Enterprise teams already on AWS.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Google Cloud Vertex AI
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Pricing:&lt;/strong&gt; Pay-as-you-go, competitive for high volume&lt;/p&gt;

&lt;p&gt;Vertex AI provides Claude models through Google Cloud. Complex setup, requires GCP account.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Best for:&lt;/strong&gt; Teams using Google Cloud infrastructure.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Direct Anthropic API with Prompt Caching
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Pricing:&lt;/strong&gt; Official rates, but 90% off cached tokens&lt;/p&gt;

&lt;p&gt;Using Anthropic's prompt caching can reduce costs significantly for repetitive workloads, but only helps with cache-eligible tokens.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Best for:&lt;/strong&gt; Specific use cases with highly repetitive prompts.&lt;/p&gt;

&lt;h2&gt;
  
  
  Price Comparison Table
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Provider&lt;/th&gt;
&lt;th&gt;Sonnet Input&lt;/th&gt;
&lt;th&gt;Sonnet Output&lt;/th&gt;
&lt;th&gt;Setup&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Anthropic (Official)&lt;/td&gt;
&lt;td&gt;$3.00&lt;/td&gt;
&lt;td&gt;$15.00&lt;/td&gt;
&lt;td&gt;Credit card, region limited&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;APIVAI&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;$0.77&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;$3.86&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Email signup, crypto payment&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;OpenRouter&lt;/td&gt;
&lt;td&gt;$2.85&lt;/td&gt;
&lt;td&gt;$14.25&lt;/td&gt;
&lt;td&gt;Account required&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;AWS Bedrock&lt;/td&gt;
&lt;td&gt;$3.00&lt;/td&gt;
&lt;td&gt;$15.00&lt;/td&gt;
&lt;td&gt;AWS account + IAM&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Verdict
&lt;/h2&gt;

&lt;p&gt;For most developers, &lt;strong&gt;APIVAI offers the best value&lt;/strong&gt; — same models, same quality, up to 90% cheaper. No complex cloud setup, no subscription, and it works as a drop-in replacement for any tool that supports OpenAI or Anthropic APIs.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://apivai.com" rel="noopener noreferrer"&gt;Get started at apivai.com →&lt;/a&gt;&lt;/p&gt;

</description>
      <category>claudeapi</category>
      <category>comparison</category>
      <category>2026</category>
    </item>
    <item>
      <title>How to Use Claude Code and GPT API at 90% Off</title>
      <dc:creator>APIVAI</dc:creator>
      <pubDate>Wed, 10 Jun 2026 17:27:05 +0000</pubDate>
      <link>https://dev.to/mupromax/how-to-use-claude-code-and-gpt-api-at-90-off-1ndk</link>
      <guid>https://dev.to/mupromax/how-to-use-claude-code-and-gpt-api-at-90-off-1ndk</guid>
      <description>&lt;h2&gt;
  
  
  The Problem: AI APIs Are Expensive
&lt;/h2&gt;

&lt;p&gt;If you're a developer using Claude Code, Cursor, or building with AI APIs, you know the costs add up fast:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Service&lt;/th&gt;
&lt;th&gt;Cost&lt;/th&gt;
&lt;th&gt;Limitation&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Claude Pro&lt;/td&gt;
&lt;td&gt;$20/month&lt;/td&gt;
&lt;td&gt;Rate limited, no API access&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Anthropic API (Sonnet)&lt;/td&gt;
&lt;td&gt;$3/$15 per M tokens&lt;/td&gt;
&lt;td&gt;Requires credit card, region restrictions&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;OpenAI API (GPT-5.4)&lt;/td&gt;
&lt;td&gt;$3/$10 per M tokens&lt;/td&gt;
&lt;td&gt;Same issues&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;APIVAI&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;$0.69/$3.43 per M tokens&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;No subscription, no restrictions&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;That's a &lt;strong&gt;77% savings&lt;/strong&gt; on Claude Sonnet alone.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is APIVAI?
&lt;/h2&gt;

&lt;p&gt;APIVAI is an AI API gateway that gives you access to the same Claude and GPT models through a single, OpenAI-compatible API:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;All models, one API key&lt;/strong&gt; — Claude Opus 4.7, Opus 4.6, Sonnet 4.6, Haiku 4.5, GPT-5.4, GPT-5.3 Codex&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;90% cheaper&lt;/strong&gt; than official API pricing&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;No subscription&lt;/strong&gt; — pay per token, starting from $10&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;No VPN needed&lt;/strong&gt; — works from anywhere&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Drop-in replacement&lt;/strong&gt; — change one URL, everything else stays the same&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  How to Use with Claude Code
&lt;/h2&gt;

&lt;p&gt;Just set two environment variables:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Mac/Linux:&lt;/strong&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="nv"&gt;ANTHROPIC_AUTH_TOKEN&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"your-apivai-key"&lt;/span&gt; &lt;span class="se"&gt;\&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="se"&gt;\&lt;/span&gt;
claude
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Windows PowerShell:&lt;/strong&gt;&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_AUTH_TOKEN&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"your-apivai-key"&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_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="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;p&gt;Same Claude Code experience, 90% cheaper.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to Use with Cursor
&lt;/h2&gt;

&lt;p&gt;Go to &lt;strong&gt;Cursor Settings &amp;gt; Models &amp;gt; Override OpenAI Base URL&lt;/strong&gt; and set:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;https://api.apivai.com/v1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Real Cost Comparison
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Usage Pattern&lt;/th&gt;
&lt;th&gt;Official API&lt;/th&gt;
&lt;th&gt;APIVAI&lt;/th&gt;
&lt;th&gt;Savings&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Casual (50 msgs/mo)&lt;/td&gt;
&lt;td&gt;$1.75&lt;/td&gt;
&lt;td&gt;$0.35&lt;/td&gt;
&lt;td&gt;80%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Daily user (20 msgs/day)&lt;/td&gt;
&lt;td&gt;$12.25&lt;/td&gt;
&lt;td&gt;$2.45&lt;/td&gt;
&lt;td&gt;80%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Developer (10M tokens/mo)&lt;/td&gt;
&lt;td&gt;$45+&lt;/td&gt;
&lt;td&gt;$9&lt;/td&gt;
&lt;td&gt;80%&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;No monthly fee. Pay only for what you use.&lt;/p&gt;

&lt;h2&gt;
  
  
  API Compatibility
&lt;/h2&gt;

&lt;p&gt;Works with any OpenAI-compatible tool: Claude Code, Cursor, Continue, Aider, Open Interpreter, and more.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="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-apivai-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;response&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-20250514&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;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Get Started
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Sign up at apivai.com — email + verification code&lt;/li&gt;
&lt;li&gt;Top up — starting from $10 via cryptocurrency&lt;/li&gt;
&lt;li&gt;Set your base URL to api.apivai.com and start coding&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;em&gt;No subscription. No VPN. No restrictions.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>claudecode</category>
      <category>gptapi</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>How to Use APIVAI as an OpenAI-Compatible API Gateway</title>
      <dc:creator>APIVAI</dc:creator>
      <pubDate>Wed, 10 Jun 2026 17:27:01 +0000</pubDate>
      <link>https://dev.to/mupromax/how-to-use-apivai-as-an-openai-compatible-api-gateway-5ghm</link>
      <guid>https://dev.to/mupromax/how-to-use-apivai-as-an-openai-compatible-api-gateway-5ghm</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Many developer tools, command-line utilities, and AI applications support OpenAI-compatible endpoints. APIVAI provides a gateway-style API experience that lets developers test and integrate AI models through familiar request patterns without rewriting every client from scratch.&lt;/p&gt;

&lt;p&gt;This guide focuses on practical integration details: OpenAI-compatible request structure, &lt;code&gt;/v1/models&lt;/code&gt;, &lt;code&gt;/v1/chat/completions&lt;/code&gt;, API key authentication, Python, Node.js, cURL examples, streaming responses, and configuration notes for Claude Code and Cursor.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is an OpenAI-compatible API gateway?
&lt;/h2&gt;

&lt;p&gt;An OpenAI-compatible API gateway exposes request and response patterns that are familiar to developers who have used OpenAI-style APIs. The most important pieces are a base URL, Bearer token authentication, JSON request bodies, a &lt;code&gt;model&lt;/code&gt; field, a &lt;code&gt;messages&lt;/code&gt; array, response &lt;code&gt;choices&lt;/code&gt;, and optional streaming.&lt;/p&gt;

&lt;p&gt;For APIVAI, the default OpenAI-compatible base URL is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;https://api.apivai.com/v1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Compatibility can vary by client and feature. Treat the gateway as a developer-friendly integration layer, then test the specific models, parameters, and tools your application depends on.&lt;/p&gt;

&lt;h2&gt;
  
  
  When should developers use APIVAI?
&lt;/h2&gt;

&lt;p&gt;Use APIVAI when you want to test OpenAI-compatible request flows, connect local scripts, try Python, Node.js, or cURL examples, configure tools that support custom OpenAI-compatible base URLs, or check model availability before hardcoding model names.&lt;/p&gt;

&lt;p&gt;It is also useful when you want a cost-effective API gateway for development workflows while keeping your application code close to standard OpenAI-compatible patterns.&lt;/p&gt;

&lt;h2&gt;
  
  
  Basic environment variables
&lt;/h2&gt;

&lt;p&gt;For macOS and Linux:&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;APIVAI_API_KEY&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"YOUR_APIVAI_API_KEY"&lt;/span&gt;
&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;APIVAI_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;APIVAI_MODEL&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"YOUR_MODEL_NAME"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For 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;APIVAI_API_KEY&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"YOUR_APIVAI_API_KEY"&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;APIVAI_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="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;APIVAI_MODEL&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"YOUR_MODEL_NAME"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Keep your API key outside source control. Use environment variables, a local secret manager, or your deployment platform's secret store.&lt;/p&gt;

&lt;h2&gt;
  
  
  Discover available models
&lt;/h2&gt;

&lt;p&gt;Before hardcoding a model name, call &lt;code&gt;/v1/models&lt;/code&gt; and inspect the response. This helps avoid configuration drift when a client, model alias, or provider-side availability changes.&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="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$APIVAI_BASE_URL&lt;/span&gt;&lt;span class="s2"&gt;/models"&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;"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;A typical response includes a &lt;code&gt;data&lt;/code&gt; array. Choose a model ID from that list and set it as &lt;code&gt;APIVAI_MODEL&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Send a chat completion with cURL
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$APIVAI_BASE_URL&lt;/span&gt;&lt;span class="s2"&gt;/chat/completions"&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;"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": "'&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$APIVAI_MODEL&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s1"&gt;'",
    "messages": [
      { "role": "system", "content": "You are a concise developer assistant." },
      { "role": "user", "content": "Explain API gateway routing in one paragraph." }
    ]
  }'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If the request succeeds, read &lt;code&gt;choices[0].message.content&lt;/code&gt; from the JSON response.&lt;/p&gt;

&lt;h2&gt;
  
  
  Python example
&lt;/h2&gt;

&lt;p&gt;The OpenAI Python SDK can be pointed at APIVAI by changing the &lt;code&gt;base_url&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&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="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;environ&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;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="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;environ&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;APIVAI_BASE_URL&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;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="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;chat&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;completions&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;create&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;environ&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;APIVAI_MODEL&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="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;You write clear developer documentation.&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="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Give me a short API gateway checklist.&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="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;response&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;h2&gt;
  
  
  Node.js example
&lt;/h2&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;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;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="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_BASE_URL&lt;/span&gt; &lt;span class="o"&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="p"&gt;});&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;response&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;client&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="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_MODEL&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="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="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;You are a practical coding assistant.&lt;/span&gt;&lt;span class="dl"&gt;"&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="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Write a small JSON API testing checklist.&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="p"&gt;],&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;

&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;response&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;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Streaming example
&lt;/h2&gt;

&lt;p&gt;Streaming is useful for CLIs, chat interfaces, and tools that should display tokens as they arrive. Enable &lt;code&gt;stream: true&lt;/code&gt; and iterate over chunks.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&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="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;environ&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;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="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;environ&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;APIVAI_BASE_URL&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;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="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;stream&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;chat&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;completions&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;create&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;environ&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;APIVAI_MODEL&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;Stream three API debugging tips.&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;}],&lt;/span&gt;
    &lt;span class="n"&gt;stream&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="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;chunk&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;stream&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;delta&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;chunk&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;delta&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;content&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;delta&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;delta&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;end&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;""&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;flush&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;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Claude Code configuration notes
&lt;/h2&gt;

&lt;p&gt;Claude Code primarily expects Anthropic-style configuration. Some gateway setups expose Claude-compatible routes separately from OpenAI-compatible routes, so verify the current APIVAI dashboard or documentation before assuming a single base URL works for every client.&lt;/p&gt;

&lt;p&gt;For Claude Code, the common pattern is to set an auth token and base URL for the CLI, then run a small test prompt:&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_AUTH_TOKEN&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"YOUR_APIVAI_API_KEY"&lt;/span&gt;
&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;ANTHROPIC_BASE_URL&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"https://api.apivai.com"&lt;/span&gt;
claude
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If your Claude Code version changes its provider configuration format, prefer the official client configuration mechanism and keep APIVAI as the custom endpoint.&lt;/p&gt;

&lt;h2&gt;
  
  
  Cursor configuration notes
&lt;/h2&gt;

&lt;p&gt;Cursor and similar editors may allow a custom OpenAI-compatible base URL. Use:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;https://api.apivai.com/v1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then set your APIVAI API key in the tool's API key field and choose a model that appears in &lt;code&gt;/v1/models&lt;/code&gt;. If a specific model does not appear in the editor UI, test it first with cURL or a small script before relying on it in daily coding work.&lt;/p&gt;

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

&lt;p&gt;If you receive &lt;code&gt;401 Unauthorized&lt;/code&gt;, check that the &lt;code&gt;Authorization&lt;/code&gt; header is exactly &lt;code&gt;Bearer YOUR_APIVAI_API_KEY&lt;/code&gt;, the key has not been pasted with spaces, and the environment variable is loaded in the shell running your script.&lt;/p&gt;

&lt;p&gt;If you receive &lt;code&gt;404 Not Found&lt;/code&gt;, confirm that your base URL includes &lt;code&gt;/v1&lt;/code&gt; for OpenAI-compatible calls and that the path is &lt;code&gt;/chat/completions&lt;/code&gt; or &lt;code&gt;/models&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;If you receive a model error, call &lt;code&gt;/v1/models&lt;/code&gt; again and copy the exact model ID from the response. Avoid guessing model names from older examples.&lt;/p&gt;

&lt;p&gt;If streaming does not render in your tool, test the same request without &lt;code&gt;stream: true&lt;/code&gt;. Some clients buffer streamed output or require a separate streaming parser.&lt;/p&gt;

&lt;p&gt;If a third-party tool behaves differently from your script, compare the exact base URL, headers, model name, and JSON body. Small differences such as a missing &lt;code&gt;/v1&lt;/code&gt; or an unsupported parameter can change the result.&lt;/p&gt;

&lt;h2&gt;
  
  
  Integration checklist
&lt;/h2&gt;

&lt;p&gt;Start with &lt;code&gt;/v1/models&lt;/code&gt;, choose a model ID, run a non-streaming &lt;code&gt;/v1/chat/completions&lt;/code&gt; request, add streaming only after the basic request works, and then configure your editor or CLI.&lt;/p&gt;

&lt;p&gt;This approach keeps the first integration small and observable. Once the request path, authentication, and model selection are working, you can move the same pattern into a larger application.&lt;/p&gt;

</description>
      <category>openaicompatible</category>
      <category>apigateway</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>How to Cut Your Claude API Costs (Without Switching Models)</title>
      <dc:creator>APIVAI</dc:creator>
      <pubDate>Wed, 10 Jun 2026 17:21:27 +0000</pubDate>
      <link>https://dev.to/mupromax/how-to-cut-your-claude-api-costs-without-switching-models-45ne</link>
      <guid>https://dev.to/mupromax/how-to-cut-your-claude-api-costs-without-switching-models-45ne</guid>
      <description>&lt;h2&gt;
  
  
  Where Claude API costs actually go
&lt;/h2&gt;

&lt;p&gt;Most large Claude bills are not caused by the model choice alone — they come from sending more tokens than necessary, on a more expensive model than the task needs, without caching anything. Before switching providers, it is worth fixing the parts you control. This guide walks through practical ways to cut Claude (and GPT) API costs, then where a discount gateway fits in.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Match the model to the task
&lt;/h2&gt;

&lt;p&gt;Opus-class models are worth it for hard reasoning and agentic work, but a lot of real traffic — classification, extraction, short rewrites, routing — runs fine on a smaller, much cheaper model. A common pattern is to route easy requests to a cheap model and only escalate to a frontier model when needed.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Task&lt;/th&gt;
&lt;th&gt;Reasonable model tier&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Classification, routing, extraction&lt;/td&gt;
&lt;td&gt;Cheapest (Haiku-class)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;General chat, summaries, drafts&lt;/td&gt;
&lt;td&gt;Mid (Sonnet-class)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Hard reasoning, agents, long context&lt;/td&gt;
&lt;td&gt;Frontier (Opus-class)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  2. Use prompt caching for repeated context
&lt;/h2&gt;

&lt;p&gt;If you send the same large system prompt, instructions, or document on every call, prompt caching lets the provider reuse that prefix at a large discount instead of re-billing it each time. Put the stable content first and the variable user input last, so the cacheable prefix stays identical across requests. For agents and RAG that resend the same context repeatedly, this is often the single biggest saving.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Trim tokens you are paying for
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Shorten bloated system prompts — every request pays for them.&lt;/li&gt;
&lt;li&gt;Cap &lt;code&gt;max_tokens&lt;/code&gt; to what the task needs instead of leaving a huge ceiling.&lt;/li&gt;
&lt;li&gt;Summarize or window long chat history rather than resending the entire transcript.&lt;/li&gt;
&lt;li&gt;Strip boilerplate from retrieved documents before adding them to context.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  4. Stream to cut perceived cost, not real cost
&lt;/h2&gt;

&lt;p&gt;Streaming does not reduce token cost, but it improves responsiveness, which lets you use a cheaper model without the UX feeling slow. That can let you downgrade a tier for interactive features.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Use a discounted, OpenAI-compatible gateway
&lt;/h2&gt;

&lt;p&gt;After you have optimized usage, the remaining lever is the per-token price itself. A gateway like APIVAI resells Claude and GPT models at a steep discount off official pricing behind an OpenAI- and Anthropic-compatible API, so you keep all of the optimizations above and simply lower the unit price. It drops into existing code with a base-URL and key change.&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-haiku-4-5","messages":[{"role":"user","content":"Classify: refund request"}]}'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  A simple cost checklist
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Route easy work to the cheapest capable model.&lt;/li&gt;
&lt;li&gt;Cache stable prompt prefixes.&lt;/li&gt;
&lt;li&gt;Cap &lt;code&gt;max_tokens&lt;/code&gt; and trim history and documents.&lt;/li&gt;
&lt;li&gt;Measure real token usage before and after each change.&lt;/li&gt;
&lt;li&gt;Lower the unit price with a discount gateway once usage is tight.&lt;/li&gt;
&lt;/ul&gt;

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

&lt;p&gt;Pick one of these levers and measure the difference on your real traffic. If you want the unit-price win with no code rewrite, create an APIVAI key, point your OpenAI-compatible client at the APIVAI base URL, and choose a model from &lt;code&gt;/v1/models&lt;/code&gt;.&lt;/p&gt;

</description>
      <category>cost</category>
      <category>claudeapi</category>
      <category>optimization</category>
    </item>
    <item>
      <title>Using an OpenAI-Compatible API with n8n, LangChain &amp; LlamaIndex</title>
      <dc:creator>APIVAI</dc:creator>
      <pubDate>Wed, 10 Jun 2026 17:21:23 +0000</pubDate>
      <link>https://dev.to/mupromax/using-an-openai-compatible-api-with-n8n-langchain-llamaindex-1ppc</link>
      <guid>https://dev.to/mupromax/using-an-openai-compatible-api-with-n8n-langchain-llamaindex-1ppc</guid>
      <description>&lt;h2&gt;
  
  
  One base URL change, three frameworks
&lt;/h2&gt;

&lt;p&gt;n8n, LangChain, and LlamaIndex all speak the OpenAI-compatible API. That means you can point them at any OpenAI-compatible gateway by changing the base URL and API key — no custom integration code. This guide shows the exact setting in each, using APIVAI (which resells Claude and GPT at a steep discount) as the endpoint.&lt;/p&gt;

&lt;p&gt;The APIVAI base URL is &lt;code&gt;https://api.apivai.com/v1&lt;/code&gt;. Pick a model from &lt;code&gt;/v1/models&lt;/code&gt; before hardcoding a name.&lt;/p&gt;

&lt;h2&gt;
  
  
  n8n
&lt;/h2&gt;

&lt;p&gt;In n8n, the OpenAI nodes (and the AI Agent / Chat Model nodes) accept a custom credential. Create an "OpenAI" credential and set:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;API Key: your APIVAI key&lt;/li&gt;
&lt;li&gt;Base URL: &lt;code&gt;https://api.apivai.com/v1&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Then choose a model ID returned by &lt;code&gt;/v1/models&lt;/code&gt; in the node. Existing n8n OpenAI nodes and agent workflows keep working — only the credential changed. This is the fastest way to run cheaper models inside automation flows.&lt;/p&gt;

&lt;h2&gt;
  
  
  LangChain (Python)
&lt;/h2&gt;

&lt;p&gt;LangChain's &lt;code&gt;ChatOpenAI&lt;/code&gt; takes a &lt;code&gt;base_url&lt;/code&gt; and &lt;code&gt;api_key&lt;/code&gt;. Set them and you are done.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;langchain_openai&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;ChatOpenAI&lt;/span&gt;
&lt;span class="n"&gt;llm&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;ChatOpenAI&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;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;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="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;llm&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;invoke&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Write one sentence about API gateways.&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="n"&gt;content&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The same pattern works for chains, agents, and tool calling — anything built on &lt;code&gt;ChatOpenAI&lt;/code&gt; inherits the endpoint.&lt;/p&gt;

&lt;h2&gt;
  
  
  LangChain (JavaScript)
&lt;/h2&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;ChatOpenAI&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;@langchain/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;llm&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;ChatOpenAI&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;claude-sonnet-4-6&lt;/span&gt;&lt;span class="dl"&gt;"&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="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;YOUR_APIVAI_API_KEY&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;configuration&lt;/span&gt;&lt;span class="p"&gt;:&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="p"&gt;});&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;res&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;llm&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;invoke&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Write one sentence about API gateways.&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;res&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;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  LlamaIndex (Python)
&lt;/h2&gt;

&lt;p&gt;LlamaIndex's OpenAI-compatible LLM wrapper accepts an &lt;code&gt;api_base&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;llama_index.llms.openai_like&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;OpenAILike&lt;/span&gt;
&lt;span class="n"&gt;llm&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;OpenAILike&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;api_base&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;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;is_chat_model&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="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;llm&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;complete&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Write one sentence about API gateways.&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;
  
  
  Verify before you build
&lt;/h2&gt;

&lt;p&gt;Whatever framework you use, run a tiny request first to confirm the endpoint, key, and model are wired correctly. A &lt;code&gt;401&lt;/code&gt; means the key is not being read; a &lt;code&gt;404&lt;/code&gt; usually means the base URL is missing &lt;code&gt;/v1&lt;/code&gt;; a model error means the configured name is not in the current &lt;code&gt;/v1/models&lt;/code&gt; response.&lt;/p&gt;

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

&lt;p&gt;Create an APIVAI key, drop the base URL into your n8n credential or your &lt;code&gt;ChatOpenAI&lt;/code&gt; / &lt;code&gt;OpenAILike&lt;/code&gt; config, pick a model from &lt;code&gt;/v1/models&lt;/code&gt;, and your existing framework code runs against cheaper models with no rewrite.&lt;/p&gt;

</description>
      <category>n8n</category>
      <category>langchain</category>
      <category>integration</category>
    </item>
    <item>
      <title>Best Cheap API for Cline, Aider &amp; Roo Code (Save 90%)</title>
      <dc:creator>APIVAI</dc:creator>
      <pubDate>Wed, 10 Jun 2026 17:14:14 +0000</pubDate>
      <link>https://dev.to/mupromax/best-cheap-api-for-cline-aider-roo-code-save-90-545j</link>
      <guid>https://dev.to/mupromax/best-cheap-api-for-cline-aider-roo-code-save-90-545j</guid>
      <description>&lt;h2&gt;
  
  
  Agentic coding tools are token-hungry
&lt;/h2&gt;

&lt;p&gt;Cline, Aider, and Roo Code are excellent at multi-step edits, but agentic coding sends a lot of tokens — reading files, planning, retrying, and re-sending context. On official pricing that adds up fast. All three accept a custom OpenAI- or Anthropic-compatible endpoint, so you can route them through a discount gateway like APIVAI and keep the same workflow at a lower unit price.&lt;/p&gt;

&lt;p&gt;The APIVAI base URL is &lt;code&gt;https://api.apivai.com/v1&lt;/code&gt;. List models with &lt;code&gt;/v1/models&lt;/code&gt; and pick one before configuring.&lt;/p&gt;

&lt;h2&gt;
  
  
  Cline (VS Code)
&lt;/h2&gt;

&lt;p&gt;Cline supports an OpenAI-compatible provider in its settings:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;API Provider: OpenAI Compatible&lt;/li&gt;
&lt;li&gt;Base URL: &lt;code&gt;https://api.apivai.com/v1&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;API Key: your APIVAI key&lt;/li&gt;
&lt;li&gt;Model: an ID from &lt;code&gt;/v1/models&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Cline also works with Anthropic-style models; if you select an Anthropic provider, use the APIVAI endpoint and a Claude model ID. Start with a small task to confirm routing before a large refactor.&lt;/p&gt;

&lt;h2&gt;
  
  
  Aider (CLI)
&lt;/h2&gt;

&lt;p&gt;Aider reads an OpenAI-compatible base URL and key from 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_API_BASE&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;"YOUR_APIVAI_API_KEY"&lt;/span&gt;
aider &lt;span class="nt"&gt;--model&lt;/span&gt; claude-sonnet-4-6
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For Claude models, Aider routes them through the same OpenAI-compatible base URL when configured this way. Use a cheaper model for routine edits and escalate only when a change is hard.&lt;/p&gt;

&lt;h2&gt;
  
  
  Roo Code (VS Code)
&lt;/h2&gt;

&lt;p&gt;Roo Code (a Cline fork) uses the same idea: choose the OpenAI Compatible provider, set the base URL to &lt;code&gt;https://api.apivai.com/v1&lt;/code&gt;, paste your APIVAI key, and pick a model from &lt;code&gt;/v1/models&lt;/code&gt;. Your existing Roo workflows and modes are unchanged.&lt;/p&gt;

&lt;h2&gt;
  
  
  Tips to keep agent costs down
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Start agents on a mid or cheap model; only switch to a frontier model for genuinely hard steps.&lt;/li&gt;
&lt;li&gt;Keep the working context tight — fewer files in context means fewer tokens per step.&lt;/li&gt;
&lt;li&gt;Confirm the endpoint with a one-line task before letting an agent run a long plan.&lt;/li&gt;
&lt;/ul&gt;

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

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;401&lt;/code&gt;: the key is missing or not saved in the tool's settings.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;404&lt;/code&gt;: the base URL is missing &lt;code&gt;/v1&lt;/code&gt; or includes it twice.&lt;/li&gt;
&lt;li&gt;Model error: the configured model is not in the current &lt;code&gt;/v1/models&lt;/code&gt; list — pick a returned ID.&lt;/li&gt;
&lt;/ul&gt;

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

&lt;p&gt;Create an APIVAI key, set the OpenAI-compatible base URL in Cline, Aider, or Roo Code, choose a model from &lt;code&gt;/v1/models&lt;/code&gt;, and run a small task. The same agent workflow now runs at a lower per-token cost.&lt;/p&gt;

</description>
      <category>cline</category>
      <category>aider</category>
      <category>agents</category>
    </item>
    <item>
      <title>How to Pay for AI APIs with Crypto, USDT, or No Credit Card</title>
      <dc:creator>APIVAI</dc:creator>
      <pubDate>Wed, 10 Jun 2026 17:14:11 +0000</pubDate>
      <link>https://dev.to/mupromax/how-to-pay-for-ai-apis-with-crypto-usdt-or-no-credit-card-h0i</link>
      <guid>https://dev.to/mupromax/how-to-pay-for-ai-apis-with-crypto-usdt-or-no-credit-card-h0i</guid>
      <description>&lt;h2&gt;
  
  
  Why pay for an AI API without a credit card
&lt;/h2&gt;

&lt;p&gt;A lot of developers cannot — or would rather not — put a credit card on a US AI provider. Cards get declined across borders, some regions are not supported, prepaid cards are rejected, and many people simply prefer not to attach a card to a metered service that could run up a bill. Paying with crypto, USDT, or a local method solves all of these while still giving you Claude and GPT access.&lt;/p&gt;

&lt;p&gt;This guide explains the options and how to start with APIVAI, which accepts crypto, USDT, and Alipay alongside cards.&lt;/p&gt;

&lt;h2&gt;
  
  
  The options, compared
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Method&lt;/th&gt;
&lt;th&gt;Card needed?&lt;/th&gt;
&lt;th&gt;Good for&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Crypto / USDT&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;No&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;Global access, privacy, no card declines&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Alipay&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;td&gt;Users in regions where Alipay is common&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Credit card&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;Users who already have a supported card&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Why crypto and USDT work well here
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;No card declines or cross-border rejections — it works the same everywhere.&lt;/li&gt;
&lt;li&gt;Prepaid and pay-as-you-go by nature: you top up a balance and spend it down, so there is no surprise monthly charge.&lt;/li&gt;
&lt;li&gt;USDT (a dollar-pegged stablecoin) keeps the amount predictable, unlike volatile coins.&lt;/li&gt;
&lt;li&gt;Less personal payment information attached to your usage.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  How to top up with crypto on APIVAI
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Create an account and get your API key.&lt;/li&gt;
&lt;li&gt;Open the balance / top-up page.&lt;/li&gt;
&lt;li&gt;Choose the crypto or USDT option and pay to the address shown.&lt;/li&gt;
&lt;li&gt;Once confirmed, your balance is credited and usable immediately.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Your balance then works across every model behind one OpenAI- and Anthropic-compatible API. There is no subscription — you only spend what you top up.&lt;/p&gt;

&lt;h2&gt;
  
  
  Using the balance
&lt;/h2&gt;

&lt;p&gt;After topping up, point any OpenAI-compatible client at the APIVAI base URL and send a request. The same key works for Claude and GPT models, in your own code, Cursor, Claude Code, Codex CLI, and agent tools.&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;
  
  
  Get started
&lt;/h2&gt;

&lt;p&gt;If a card is the only thing standing between you and Claude or GPT access, top up with crypto, USDT, or Alipay instead. Create a key, add a small balance, pick a model from &lt;code&gt;/v1/models&lt;/code&gt;, and send your first request — no card required.&lt;/p&gt;

</description>
      <category>crypto</category>
      <category>usdt</category>
      <category>payments</category>
    </item>
    <item>
      <title>How to Use Codex CLI with a Cheap GPT API (Save 90%)</title>
      <dc:creator>APIVAI</dc:creator>
      <pubDate>Wed, 10 Jun 2026 16:59:34 +0000</pubDate>
      <link>https://dev.to/mupromax/how-to-use-codex-cli-with-a-cheap-gpt-api-save-90-5a8b</link>
      <guid>https://dev.to/mupromax/how-to-use-codex-cli-with-a-cheap-gpt-api-save-90-5a8b</guid>
      <description>&lt;h2&gt;
  
  
  Use Codex CLI without paying full price
&lt;/h2&gt;

&lt;p&gt;OpenAI's Codex CLI is a fast way to edit code, run commands, and pair with a model directly from your terminal. The friction is cost: pointed at official endpoints, a busy day of agentic coding adds up quickly. The good news is that Codex CLI talks to an OpenAI-compatible endpoint, so you can route it through a cheaper gateway with a one-line change and keep the exact same workflow.&lt;/p&gt;

&lt;p&gt;This guide shows how to configure Codex CLI to use APIVAI, which resells GPT and Claude models at a steep discount off official pricing.&lt;/p&gt;

&lt;h2&gt;
  
  
  What you need
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Codex CLI installed and working.&lt;/li&gt;
&lt;li&gt;An APIVAI API key.&lt;/li&gt;
&lt;li&gt;The APIVAI base URL: &lt;code&gt;https://api.apivai.com/v1&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Step 1 — point Codex at the APIVAI endpoint
&lt;/h2&gt;

&lt;p&gt;Codex CLI reads an OpenAI-style base URL and API key from environment variables. Set them in the shell that launches Codex.&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;"YOUR_APIVAI_API_KEY"&lt;/span&gt;
&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;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="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;OPENAI_API_KEY&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"YOUR_APIVAI_API_KEY"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That is the whole change. Codex now sends its requests to APIVAI instead of the default endpoint, and your existing prompts, approvals, and file edits behave the same.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 2 — pick a model
&lt;/h2&gt;

&lt;p&gt;Before hardcoding a model name, list what your account can use and choose one from the response.&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 &lt;/span&gt;&lt;span class="nv"&gt;$OPENAI_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;Set the model Codex should use to one of the returned IDs, for example a GPT-class model for general coding. APIVAI exposes the OpenAI Responses API that Codex relies on, so tool calls and streaming work as expected.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 3 — run a small task first
&lt;/h2&gt;

&lt;p&gt;Start with a tiny, low-risk request to confirm routing before turning Codex loose on a real change.&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="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;If you get a normal response, the endpoint, key, and model are all wired correctly. From here, use Codex exactly as you would against the official API.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why route Codex through APIVAI
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Lower effective cost on GPT and Claude models, with no subscription.&lt;/li&gt;
&lt;li&gt;One OpenAI-compatible key that also works with Cursor, Claude Code, and your own scripts.&lt;/li&gt;
&lt;li&gt;Pay-as-you-go top-ups, including crypto and Alipay.&lt;/li&gt;
&lt;li&gt;Model discovery via &lt;code&gt;/v1/models&lt;/code&gt; so you avoid stale, hardcoded model names.&lt;/li&gt;
&lt;/ul&gt;

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

&lt;ul&gt;
&lt;li&gt;A &lt;code&gt;401&lt;/code&gt; usually means the key is missing or not exported in the shell that launched Codex.&lt;/li&gt;
&lt;li&gt;A &lt;code&gt;404&lt;/code&gt; often means the base URL is missing &lt;code&gt;/v1&lt;/code&gt; or has it twice.&lt;/li&gt;
&lt;li&gt;A model error means the configured model is not in the current &lt;code&gt;/v1/models&lt;/code&gt; response — pick a returned ID.&lt;/li&gt;
&lt;li&gt;If streaming looks stuck, confirm the client reads the response incrementally and retry a non-streaming request to isolate the issue.&lt;/li&gt;
&lt;/ul&gt;

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

&lt;p&gt;Create an API key, export the two environment variables above, choose a model from &lt;code&gt;/v1/models&lt;/code&gt;, and run a small Codex task to confirm everything works. Most existing OpenAI-compatible setups need only the base-URL and key change.&lt;/p&gt;

</description>
      <category>codexcli</category>
      <category>gptapi</category>
      <category>tutorial</category>
    </item>
  </channel>
</rss>
