Skip to main content
AI tutorials

Run Claude Code Through Infinite Claude Code with Streaming, Failover, and Local Fallback

Learn how to install Infinite Claude Code, verify its local Anthropic-compatible router, launch Claude Code, configure optional providers, monitor requests through the HUD, and distribute autonomous subagents across its model pool.

Run Claude Code Through Infinite Claude Code with Streaming, Failover, and Local Fallback

What Is Infinite Claude Code?

Infinite Claude Code is a dependency-free Node.js proxy that connects official Anthropic clients—including Claude Code CLI, Claude Desktop, and supported IDE extensions—to a pool of OpenAI-compatible model providers. It accepts Anthropic Messages API requests at /v1/messages, translates them into the provider format, and converts responses back into Anthropic-compatible real-time Server-Sent Events.

The project prioritizes free cloud models, supports optional provider credentials, and can fall back to a local Ollama instance. According to the project README, the router starts quickly, uses less than 30 MB of RAM, and consumes no CPU while idle.

The repository describes its preconfigured cloud pool as free to use. Provider availability, rate limits, model access, and pricing can still be changed by the external services involved, so review each provider's current terms before relying on it for ongoing workloads.

How the Router Works

The local router listens on 127.0.0.1:20129 by default. Claude Code sends an Anthropic-style request to this endpoint, after which Infinite Claude Code classifies the task, selects a suitable model, translates tool calls, and streams the result back to the client.

  1. Claude Code, Claude Desktop, or an IDE extension sends a request to /v1/messages.

  2. The semantic classifier inspects the prompt and available tools.

  3. The dispatcher selects a provider and model from its priority pool.

  4. If that provider is unavailable or rate-limited, the router moves to another configured provider.

  5. OpenAI-style function calls are translated into Anthropic tool-use messages.

  6. Response tokens are returned through real-time SSE streaming.

  7. If cloud routes are unavailable and Ollama is configured, the router can use a local model.

Key Features

Concurrent subagent dispatch

When Claude Code starts several subagents or background sessions, the swarm dispatcher can distribute concurrent requests across different providers instead of sending all work to one model. This is intended to reduce single-provider bottlenecks and rate-limit failures.

Semantic task routing

The router chooses models according to the apparent workload. The documented routing strategy favors reasoning models such as Nemotron 120B or Kimi K3 for architecture tasks, code-focused models such as North Mini Code or Qwen Coder for generation and file edits, and Nemotron Lightning for quick commands.

Tool-call repair

Some open-weight models produce malformed JSON in tool arguments. Infinite Claude Code includes an AST-based sanitizer that attempts to repair issues such as unescaped quotes or incomplete brackets before Claude Code executes the tool call.

Automatic provider failover

The project supports a prioritized pool covering OpenRouter, NVIDIA NIM, OmniRouter, 9Router, Groq, Cerebras, Together AI, Google Gemini, Mistral AI, OpenAI, Anthropic, and other optional services. A failed or rate-limited request can be retried through another available provider.

Monitoring dashboard

A browser-based HUD displays active subagents, provider activity, generated tokens, latency, and an estimated money-saved counter based on official Claude 3.7 Sonnet API pricing.

Offline fallback

Ollama can provide local resilience with models such as qwen3:4b or deepseek-r1. Local performance and tool reliability depend on the selected model and your hardware.

Prerequisites

  • Node.js 18 or newer.

  • Git for the manual installation methods.

  • Claude Code CLI, Claude Desktop, or a compatible IDE integration.

  • PowerShell on Windows or a shell on macOS and Linux.

  • Ollama only if you want local offline fallback.

The project itself does not require a Python environment or additional Node.js packages.

Install Infinite Claude Code

Option 1: Windows one-line installer

Open PowerShell and run the installer command from the repository:

& ([scriptblock]::Create((irm "https://raw.githubusercontent.com/juanitogit/infinite-claude-code/main/install.ps1")))

Because this command downloads and immediately executes a remote script, review install.ps1 first if required by your security policy.

Option 2: Manual Windows installation

git clone https://github.com/juanitogit/infinite-claude-code.git
cd infinite-claude-code
powershell -ExecutionPolicy Bypass -File .\install.ps1

Option 3: macOS or Linux installation

git clone https://github.com/juanitogit/infinite-claude-code.git
cd infinite-claude-code
chmod +x install.sh && ./install.sh

Choose an installation mode

The interactive installer offers two modes:

  • Express Install: configures the documented preconfigured free tier without asking for optional provider credentials.

  • Custom Install: prompts for API keys for additional providers. Press Enter to skip any provider you do not want to configure.

Verify the Local Router

From the repository directory, check the service status:

node bin/infinite-claude.js status

A healthy installation should report that Infinite Claude Code is active, identify the local URL as http://127.0.0.1:20129, confirm SSE streaming, and list the active providers in the pool.

Infinite Claude Code is ACTIVE and HEALTHY!
URL: http://127.0.0.1:20129
Streaming: ENABLED (SSE Real-time)
Active Providers in Pool: ...

If the service is not healthy, confirm that Node.js 18 or newer is available and that another application is not already using port 20129.

Launch Claude Code

Once the router is running and the installer has configured the client, launch Claude Code normally:

claude

You can then enter a coding request in the interactive session:

Inspect this project, explain its architecture, and identify the safest first refactoring task.

The request should be routed through the local proxy, with the answer streamed back as it is generated.

Try a Direct Task

Claude Code can also receive a prompt directly from the terminal:

claude "Review the authentication module and propose a refactoring plan"

This is useful for focused work that does not require starting with an empty interactive session. Model selection is handled by Infinite Claude Code's routing logic rather than by the command itself.

Monitor Requests in the Cyber HUD

Open the following local address while the router is active:

http://localhost:20129/hud

The HUD provides live telemetry for the current session, including:

  • The provider serving each request.

  • Generated token counts.

  • Request latency in milliseconds.

  • The number of active concurrent subagents.

  • An estimated savings counter based on Claude 3.7 Sonnet API pricing.

Use this dashboard to confirm that requests are being distributed across the configured pool and to spot providers with unusually high latency.

Configure Providers and Environment Variables

You can customize provider definitions in src/providers.js or supply credentials and endpoints through environment variables. The README documents the following variables:

  • OPENROUTER_API_KEY: custom OpenRouter credential. The documented default uses the preconfigured free tier.

  • NVIDIA_API_KEY: custom NVIDIA NIM credential. The repository documents a preconfigured NIM key as its default.

  • OMNIROUTER_API_KEY: custom OmniRouter credential.

  • ROUTER9_API_KEY: custom 9Router credential.

  • GROQ_API_KEY: optional Groq credential.

  • TOGETHER_API_KEY: optional Together AI credential.

  • OLLAMA_HOST: Ollama endpoint, defaulting to http://localhost:11434.

  • PORT: local proxy port, defaulting to 20129.

For example, a macOS or Linux shell can point the router at a different Ollama host and port before starting it:

export OLLAMA_HOST="http://localhost:11434"
export PORT="20129"

In PowerShell, the equivalent session variables are:

$env:OLLAMA_HOST = "http://localhost:11434"
$env:PORT = "20129"

Keep personal API keys outside source control. Do not commit shell profiles, environment files, or modified provider configuration containing secrets.

Set Up Ollama as a Local Fallback

Infinite Claude Code supports Ollama as its offline or emergency route. The README lists qwen3:4b and deepseek-r1 as example local models.

  1. Install and start Ollama separately.

  2. Make the desired model available in your Ollama installation.

  3. Leave OLLAMA_HOST at http://localhost:11434 or change it to your custom endpoint.

  4. Verify the Infinite Claude Code router again with the status command.

The local fallback is especially useful during internet outages, although model speed, context capacity, and coding quality will depend on the local model and available CPU, memory, or GPU resources.

Run Autonomous Subagents

For a task that benefits from decomposition, explicitly ask Claude Code to create concurrent subagents:

claude "Divide this task and use concurrent subagents in parallel to build the complete platform"

You can also dispatch a background task with the documented --bg option:

claude --bg "Refactor the authentication module and write unit tests"

The router is designed to distribute simultaneous subagent calls across separate providers. Watch the HUD while the task runs to observe swarm load and provider selection.

Advanced Tips

Match concurrency to provider availability

The project supports broad concurrency, but external providers can still impose their own rate limits or availability restrictions. Check the HUD and active provider list before launching a large set of background jobs.

Use optional keys to expand the pool

If the preconfigured routes are congested, Custom Install can add providers such as Groq or Together AI. A broader configured pool gives the failover system more routes, but each optional service may have separate quotas and terms.

Use the status command during troubleshooting

Run node bin/infinite-claude.js status before debugging the Claude client itself. This quickly distinguishes a local router problem from a model-provider or client issue.

Change the port when necessary

If port 20129 conflicts with another service, set PORT to another value. Make sure the Anthropic client configuration points to the same local endpoint after changing it.

Inspect provider configuration carefully

Advanced users can modify src/providers.js to customize models. Preserve the expected provider formats and test changes with a simple request before starting concurrent agents.

Protect proprietary code

Cloud-routed prompts may include source code, tool output, or project context. Review the privacy and data-handling policies of every enabled provider before using the router with confidential repositories. Prefer the Ollama route when work must remain local.

Conclusion

Infinite Claude Code provides a lightweight translation and routing layer between Anthropic clients and a large pool of cloud or local models. After running the installer, verify the service, launch claude, and use the HUD to monitor streaming, failover, and concurrent subagents. Optional provider keys and Ollama let you expand the pool or add local resilience as your workflow requires.

The project is maintained by JuaneX and distributed under the MIT License. Source code and installation scripts are available in the Infinite Claude Code repository.