When working with autonomous coding agents like Cline, managing multiple upstream AI providers — such as Google AI Studio, OpenRouter, and premium OAuth subscriptions — quickly becomes a maintenance bottleneck. Rate limits (HTTP 429), quota exhaustion, and fragmented API keys disrupt agentic loops mid-refactor.

9router solves this by acting as a lightweight, local reverse proxy and API gateway. It normalizes distinct upstream protocols into a single OpenAI-compatible endpoint (http://localhost:20128/v1), aggregates token balances, and implements automatic failover (Combos) across your providers.

Architecture Overview

Unified AI Orchestration: Setting Up 9router, Model Combos, and Cline in VS Code

Step 1: Install and Launch 9router

9router requires Node.js (v18+) and npm installed on your machine.

Install 9router globally:

bash
npm install -g 9router

Run

bash
9router

Open the Web UI:

  1. Navigate to http://localhost:20128 in your browser.
  • Default Password:123456(can be modified in Settings).

Step 2: Configure Gemini, Antigravity, and OpenRouter

1. Google Gemini via Google AI Studio

  1. Navigate to Google AI Studio and sign in.
  2. Click Get API key>Create API key in new project, and copy your key.
  3. In the 9router dashboard, go to the Providers tab and find Gemini.
  4. Click Add Connection, paste your API key, name it (e.g., gemini-main), and click Test&Save.
  5. Add your desired model IDs (such as gemini-2.5-pro or gemini-2.5-flash).
Unified AI Orchestration: Setting Up 9router, Model Combos, and Cline in VS Code

2. Antigravity (Google Gemini Pro OAuth)

If you have an active Gemini Pro / Google Workspace subscription:

  1. In the Providers tab, locate Antigravity.
  2. Click Add Connection / Build Authentication.
  3. Complete the OAuth sign-in flow in your browser to link your account.
  4. Verify that models like gemini-pro-agent appear under your active models list.
  5. ⚠️ Risk Notice: This provider uses a subscription/OAuth session not officially licensed for proxy/router use. Your account may be restricted or banned. Use at your own risk.
Unified AI Orchestration: Setting Up 9router, Model Combos, and Cline in VS Code

3. OpenRouter

  1. Go to OpenRouter.ai and create an account.
  2. Navigate to Keys, create a new API key, and copy it.
  3. In 9router, locate the OpenRouter provider card, click Add Connection, and enter the key.
  4. Go to OpenRouter’s model catalog, copy specific model identifiers (for example, free or paid models like deepseek/deepseek-r1 or nvidia/nemotron-3-ultra-550b-a55b:free), and add them to 9router.

Step 3: Create a Resilient Model Combo

A Combo is a virtual model identifier that groups several models together under a single alias with automatic routing policies:

  1. In 9router, navigate to the Combos tab and click Create Combo.
  2. Name the combo (e.g., code-agent).
  3. Add your configured models to the pool:
  • gemini/gemini-2.5-pro
  • antigravity/gemini-pro-agent
  • openrouter/deepseek-r1

Set the Routing Strategy:

  • Fallback (Recommended for Coding): Routes requests to the primary model first. If it encounters a rate limit (429) or failure, it automatically cascades down to the next model in the queue without interrupting your task.
  • Round-Robin: Distributes requests evenly across all providers to balance token quotas.
  • Click Save.
Unified AI Orchestration: Setting Up 9router, Model Combos, and Cline in VS Code

Step 4: Generate a 9router Master API Key

To authenticate downstream clients (like Cline or Chatbox) against your local 9router instance:

  1. In 9router, navigate to the Endpoints / Keys section.
  2. Click Create Key.
  3. Enter a label (e.g., vscode-cline) and click Create.
  4. Copy the generated master key (sk-...).
  5. Note your local endpoint URL:
  6. Plaintext
  • http://localhost:20128/v1

Step 5: Install and Configure Cline in VS Code

1.1. Install the Cline Extension: Search the extension marketplace.

  1. Open VS Code and open Extensions (Ctrl+Shift+X on Windows/Linux or Cmd+Shift+X on macOS).
  2. Search for Cline (by Saoud Rizwan) and click Install.
  3. Open the Cline panel via the robot icon on the Activity Bar.

2.2. Configure API Settings: Connect Cline to your local 9router gateway.

Click the Gear icon (⚙️ / Settings) in the top right of the Cline panel:

  • API Provider: Select OpenAI Compatible.
  • Base URL: Enter http://localhost:20128/v1.
  • API Key: Paste your 9router master key generated in Step 4.
  • Model ID: Enter your Combo name (e.g., code-agent).
  • Click Done to save the configuration.

3.3. Test the Setup: Verify execution loop and automatic failover.

  1. In the Cline chat window, switch the mode selector to Act Mode.
  2. Enter a test prompt:
text
Inspect @package.json and write a simple health check test.

Cline will route the request to 9router, which queries your primary Gemini model. If Gemini hits a rate limit, 9router seamlessly fails over to OpenRouter without breaking Cline’s execution loop.

Unified AI Orchestration: Setting Up 9router, Model Combos, and Cline in VS Code

Summary

With this architecture:

  • VS Code & Cline only ever need to know about one endpoint (http://localhost:20128/v1) and one local key.
  • 9router handles authentication multiplexing, protocol normalization, and real-time usage logging.
  • Combos ensure high availability, letting you maximize free tiers and premium quotas across Gemini, Antigravity, and OpenRouter without manual key rotation.