Skip to content
All posts
·5 min readtutorialclaude-codesetupvibe-coding

How to Set Up Claude Code Cheaper (2-Min Guide)

Set up Claude Code with aiapi.cheap and pay 70-80% less. Two ENV vars, one terminal command, and you're vibe coding for cheap. Works for Cursor too.

Why Bother?

Claude Code is amazing. Anthropic's subscription tiers run $20/month for Pro and $200/month for Max. If you only code on weekends, that's a lot of dead money. If you code daily, you'll burn through your quota by noon and start panicking about overages.

Better idea: pay-per-use through aiapi.cheap, only for what you actually use, at 70-80% off. Two environment variables and you're done.

This guide walks you through it in 2 minutes. Same setup works for Cursor, Cline, and anything else that speaks Anthropic's API format.

What You Need First

  • Claude Code installed (npm install -g @anthropic-ai/claude-code)
  • An aiapi.cheap account (free signup, 30 seconds)
  • $5+ in your aiapi.cheap balance (crypto, takes ~2 minutes to confirm)
  • A terminal
  • That's it. No new app to install, no config files to edit by hand.

    The Setup

    Step 1: Get Your API Key

    Log into aiapi.cheap, go to Dashboard → API Keys, click Create Key.

    Your key looks like sk-aic- followed by a long string. Copy it. Save it somewhere safe — we don't show it again after this screen.

    Step 2: Set Two Environment Variables

    Open your terminal. Run:

    export ANTHROPIC_API_KEY="sk-aic-your-key-goes-here"
    export ANTHROPIC_BASE_URL="https://aiapi.cheap/api/proxy"

    That's literally the whole config change. Claude Code reads these two variables and routes its requests through us instead of directly to Anthropic.

    Step 3: Make It Permanent

    Those export commands only last for your current terminal session. To make them permanent, add them to your shell config:

    For bash (most Linux):

    echo 'export ANTHROPIC_API_KEY="sk-aic-your-key"' >> ~/.bashrc
    echo 'export ANTHROPIC_BASE_URL="https://aiapi.cheap/api/proxy"' >> ~/.bashrc
    source ~/.bashrc

    For zsh (default on macOS):

    echo 'export ANTHROPIC_API_KEY="sk-aic-your-key"' >> ~/.zshrc
    echo 'export ANTHROPIC_BASE_URL="https://aiapi.cheap/api/proxy"' >> ~/.zshrc
    source ~/.zshrc

    For fish:

    set -Ux ANTHROPIC_API_KEY "sk-aic-your-key"
    set -Ux ANTHROPIC_BASE_URL "https://aiapi.cheap/api/proxy"

    Now every new terminal you open is already configured.

    Step 4: Test It

    In a fresh terminal, navigate to any project folder and run:

    claude

    Ask it something simple: "Explain what package.json does in one sentence."

    If you get a response, you're done. The request went through our proxy, hit Claude, and came back. You'll see the cost deducted from your aiapi.cheap balance in the dashboard within a few seconds.

    How to Verify It's Actually Using aiapi.cheap

    This is the part vibe coders always skip and then wonder why their bill at Anthropic is still piling up. Here's how to be sure:

    Check 1: Print Your ENV Vars

    echo $ANTHROPIC_BASE_URL

    This should print https://aiapi.cheap/api/proxy. If it prints nothing or the wrong URL, your shell config didn't load.

    Check 2: Watch Your Dashboard

    Log into aiapi.cheap and ask Claude Code a question. Within 5-10 seconds, you should see a new entry in your usage logs with the model name and cost. If nothing shows up, your requests are still going to Anthropic directly.

    Check 3: Check Anthropic

    If you have an existing Anthropic account, log in there. After a Claude Code session, check usage. If the number didn't move, you're correctly using aiapi.cheap.

    Common Issues

    `Invalid API key` Error

    Make sure you copied the entire key including the sk-aic- prefix. Spaces or quotes mess things up. Try re-copying from the dashboard.

    `Connection refused` or Timeout

    Check ANTHROPIC_BASE_URL — it should be exactly https://aiapi.cheap/api/proxy with no trailing slash. Missing the https:// is a common gotcha.

    Claude Code Says "Insufficient Balance"

    You ran out of aiapi.cheap credit. Top up via the dashboard. We require crypto only — USDT or USDC are fastest.

    The Subscription Still Charges Me

    If you previously had Claude Pro/Max and don't want it anymore, cancel it directly with Anthropic. Setting our ENV vars doesn't cancel their subscription — those are separate systems.

    Use It With Cursor Too

    Same ENV vars work for Cursor. Open Cursor settings → Models → API Keys, paste your sk-aic-* key, set the base URL to https://aiapi.cheap/api/proxy. Save. Done.

    Works the same way for any tool that speaks the Anthropic API format. Cline, Aider, basically anything with "Claude" in the docs.

    What About Cost Savings?

    If you do 4 hours of vibe coding daily on Claude Sonnet, you're probably spending $80-120/month at official rates. With aiapi.cheap Pro ($19 lifetime), the same usage runs about $15-25/month.

    For the full math, see the cheap Claude Code breakdown.

    Why This Works

    Claude Code is just a CLI that talks to the Anthropic Messages API. It reads ANTHROPIC_BASE_URL and ANTHROPIC_API_KEY from environment variables. Whatever URL you give it, that's where requests go.

    We operate a proxy at https://aiapi.cheap/api/proxy that accepts the exact same Anthropic Messages API format, forwards your request to the real Claude API with our credits, and streams the response back. Your code thinks it's talking to Anthropic directly.

    For more info on what Claude Code can do, check Anthropic's Claude Code documentation.

    Recap

    1. Get a key from aiapi.cheap

    2. Top up with crypto

    3. export ANTHROPIC_API_KEY="sk-aic-..."

    4. export ANTHROPIC_BASE_URL="https://aiapi.cheap/api/proxy"

    5. Run claude and start coding

    See the welcome post for the broader pitch on multi-AI access, or jump straight to the docs for advanced config (custom rate limits, OpenAI SDK support, streaming options).

    Happy vibe coding.