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:
- Smart AI Gateway (
9-Router): Runs locally on your machine and presents an OpenAI or Anthropic-compatible API endpoint. - 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].
- 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]:
- Node.js (
>= v18) & Git [02:46] - Python (
>= 3.10) [04:18] - VS Code or your preferred IDE [04:52]
- Claude Code CLI & Claude Desktop App [05:04]
- Codex CLI & Antigravity (Optional, if you want full multi-tool support) [05:44]
Phase 2: Installing & Launching 9-Router
9-Router is the local gateway software that manages your AI API connections and fallbacks [06:46].
Open your terminal (PowerShell for Windows or Terminal for macOS) and install
9-Router[07:30]:Bashnpx 9-routerLaunch the gateway interface [08:10]:Bash
9routerA 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]:
- Kero AI (AWS Builder ID): Click Add Connection $\rightarrow$ AWS Builder ID [09:08]. Sign in with Google to get 50 free credits per account. Clear your browser cookies for AWS (
chrome://settings/content/all) between sign-ins to link multiple Gmail accounts [10:04]. - Google AI Studio / Gemini CLI: Add your free API key from Google AI Studio or connect via Gemini CLI OAuth to access Gemini 2.5 Pro and Flash models [15:53].
- OpenCode & Nvidia NIM: Add connections to get free access to DeepSeek V4 Flash, Qwen 3 Coder, and GLM models [14:51].
- OpenAI/Anthropic Compatible Providers (Aerolink & Free Models): Add custom endpoints for Claude Opus 4.8 / Sonnet 4.5 and GPT 5.5 [27:03].
Phase 4: Creating Your Smart Fallback "Combo"
To prevent downtime, group your connected models into a single fallback sequence [35:18]:
- Go to Combos $\rightarrow$ Create Combo.
- Crucial Naming Rule: Name the combo
claude-opus-free[35:28]. (Claude Desktop requires this exact naming convention to validate the model response). - 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]:
- Gateway Base URL: Enter your local 9-Router base URL (
http://localhost:XXXX/v1) [46:24]. - Gateway API Key: Enter any string (e.g.,
api-key) [46:37]. - Auth Scheme: Select
x-api-key[46:43]. - Click Apply Changes & Restart [46:56]. Select
claude-opus-freefrom the model dropdown.
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:
- Codex CLI: Navigate to CLI Tools $\rightarrow$ Codex CLI in 9-Router, select
GPT 5.5as the model, and apply the settings toconfig.toml[48:23]. - Antigravity: Run
9routeras Administrator [50:54]. Enable the MITM local server and update your systemhostsfile DNS records as prompted in the dashboard [51:51]. Route Antigravity requests directly through yourclaude-opus-freecombo [53:34].
Key Takeaways
- Zero Subscription Cost: By aggregating free credits across Google AI Studio, AWS Builder ID, and open endpoints, you get near-unlimited coding sessions [56:12].
- Seamless Failover: You won't be blocked when a single API rate-limits your session; 9-Router handles fallbacks transparently [01:43].
- Full Ecosystem Support: Works across Claude Code CLI, Claude Desktop App, Codex CLI, and Antigravity [56:26].
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!
On desktop? Scan the QR instead
shubhgupta194@oksbi