shubh.
Links Creative Portfolio
← Back to blogs

How to Use Claude Code for Free: The Ultimate Setup Guide

How to Use Claude Code for Free: The Ultimate Setup Guide

If you've been wanting to build with Claude Code, Codex CLI, or Antigravity without paying steep API fees or hitting strict usage limits, this guide breaks down the complete workflow step-by-step.

Based on DevZoneX's tutorial, The ONLY Setup Guide You'll Need β€” Claude Code, Codex & Antigravity FREE [00:00], this method routes your requests through a local Smart AI Gateway (9-Router). By stacking multiple free provider tiers into a priority fallback chain, your setup automatically switches to the next available provider whenever one runs out of credits [01:20].

How the Free Gateway Architecture Works

Instead of connecting Claude Code directly to a single paid Anthropic API key, you route your requests through 9-Router:

  1. Smart AI Gateway (9-Router): Runs locally on your machine and presents an OpenAI or Anthropic-compatible API endpoint.
  2. Multi-Provider Connections: Connects free tiers from Kero AI (AWS Builder ID), Google AI Studio / Gemini CLI, OpenCode, Nvidia NIM, Aerolink, and OpenRouter [08:42].
  3. Smart Combo & Auto-Fallback: If your top priority model (e.g., Claude Opus 4.8 or Sonnet 4.5) hits a rate limit, the gateway instantly reroutes the prompt to GPT 5.5, Gemini 2.5 Pro, or DeepSeek V4 Flash without interrupting your terminal session [01:36].

Phase 1: Prerequisites & Tool Installation

Before setting up the gateway, make sure your system has the required developer tools installed [02:24]:

Phase 2: Installing & Launching 9-Router

9-Router is the local gateway software that manages your AI API connections and fallbacks [06:46].

  1. Open your terminal (PowerShell for Windows or Terminal for macOS) and install 9-Router [07:30]:Bash

    npx 9-router
    
  2. Launch the gateway interface [08:10]:Bash

    9router
    
  3. A browser window will automatically open at your local gateway dashboard. Log in using the default dashboard credentials [08:24].

Phase 3: Connecting Free AI Providers

Inside the 9-Router dashboard, navigate to the Providers tab and connect as many free accounts as possible [08:42]:

Phase 4: Creating Your Smart Fallback "Combo"

To prevent downtime, group your connected models into a single fallback sequence [35:18]:

  1. Go to Combos $\rightarrow$ Create Combo.
  2. Crucial Naming Rule: Name the combo claude-opus-free [35:28]. (Claude Desktop requires this exact naming convention to validate the model response).
  3. Set Model Priority (Top to Bottom):
    • Priority 1: Claude Opus 4.8 / Claude Sonnet 4.5 (via Aerolink or Kero AI) [36:03]
    • Priority 2: GPT 5.5 (via Free Models endpoint) [36:28]
    • Priority 3: Gemini 2.5 Pro (via Gemini CLI) [36:36]
    • Priority 4: DeepSeek V4 Flash (via OpenCode / Nvidia) [37:00]
    • Priority 5: OpenRouter Free Tier (Ultimate fallback) [37:09]

Phase 5: Configuring Claude Code & Desktop

Now, point Claude Code to your local 9-Router gateway [40:04].

1.Configure Claude Code CLI:

2 mins.

In 9-Router, go to CLI Tools $\rightarrow$ Claude Code. Select claude-opus-free as your active model and click Apply, or manually paste the generated config into ~/.claude/settings.json [40:15].

2.Verify Terminal Connection:

1 min.

Open a new terminal session and launch Claude Code:

Bash

claude

Prompt it with a test query (e.g., "Hi, which model are you running?"). Check the 9-Router console logs to verify that the query successfully routes through your combo [41:25].

3.Enable Developer Mode in Claude Desktop:

2 mins.

Open Claude Desktop, go to Help $\rightarrow$ Troubleshooting, and select Enable Developer Options [45:36].

4.Connect Claude Desktop to Local Gateway:

2 mins.

Go to Developer $\rightarrow$ Configure Third Party Inference [46:11]:

Bonus: Supercharge Claude Code with AutoHarness

The video highlights an open-source plugin called AutoHarness that acts as a self-learning skill layer for Claude Code [44:08]:

What AutoHarness Does: It silently monitors your coding sessions in the background. When it detects repeated patterns or workflows, it automatically converts them into reusable skills so Claude Code doesn't need to be retrained on your preferences every time [44:14].

To install AutoHarness, run the installation command provided in the repository directly inside your active Claude Code terminal [44:49].

Bonus: Setting Up Codex CLI & Antigravity

If you also want to use Codex CLI or Antigravity for free:

Key Takeaways

For complete video walkthroughs, repository links, and config scripts, check out the original tutorial video on YouTube: The ONLY Setup Guide You'll Need β€” Claude Code, Codex & Antigravity FREE [00:00].

Enjoyed this write-up? Consider supporting my work!

Sponsor on GitHub Support on Ko-fi Pay via UPI
On desktop? Scan the QR instead
UPI QR code to pay Shubh Gupta shubhgupta194@oksbi