Bansur Router

One endpoint for every AI provider.

A local AI gateway for coding tools. Bansur Router runs on your machine and turns 40+ providers and 800+ models into a single OpenAI-compatible endpoint — one API key, one config, no juggling.

$ npm install -g bansur-router
Read the docs GitHub
http://localhost:667/v1
40+providers connected
800+models behind one key
20–40%tokens saved per request
:667one local endpoint

Every tool wants its own setup. It doesn't have to be that way.

Coding tools multiply, each with its own keys, formats, and limits. Bansur Router collapses all of it into one local gateway.

The problem

A different key and format for every tool

Claude Code, Codex, Cursor, Cline — each provider speaks its own dialect and wants its own credentials configured separately.

With Bansur Router

One OpenAI-compatible endpoint

Every tool points at http://localhost:667/v1 with a single API key copied from the dashboard. Format translation between OpenAI, Claude, and Gemini happens inside the gateway.

The problem

Rate limits stop sessions cold

You hit a quota ceiling mid-task and the session dies — even though you have other subscriptions, cheaper APIs, and free tiers sitting idle.

With Bansur Router

3-tier smart fallback

Requests flow Subscription → Cheap → Free. When one tier hits its limit, the next takes over automatically and the session keeps going.

The problem

Subscription quota expires unused

Your plan resets whether you spent the quota or not. Without visibility, the most valuable tokens you own quietly evaporate.

With Bansur Router

Real-time quota tracking

Usage is tracked per account in real time, so subscription quota gets used before it resets — not after you've already paid for API calls.

The problem

Tool output eats your context

A single git diff or grep result can flood the prompt with thousands of tokens that add cost and noise, request after request.

With Bansur Router

RTK Token Saver

Tool outputs such as git diff, grep, and ls are compressed before they reach the model — saving 20–40% of tokens on every request.

The problem

One account is a single point of failure

One login, one quota pool, one expired token — and every connected tool goes down with it.

With Bansur Router

Multi-account round-robin

Add several accounts per provider and requests rotate across them, with OAuth tokens refreshed automatically in the background.

How it works

Your tools keep speaking plain OpenAI API. Bansur Router handles routing, translation, and fallback on your machine.

Your CLI tools

All configured the same way

  • Claude Code
  • OpenAI Codex
  • Cursor · Cline
  • OpenCode · Antigravity
  • GitHub Copilot · OpenClaw

Bansur Router

localhost:667/v1

  • Format translation — OpenAI ↔ Claude ↔ Gemini
  • RTK Token Saver — compresses tool output
  • Quota tracking & multi-account rotation
  • Request logging & usage analytics
TIER 1SubscriptionYour OAuth plans first — Claude Code, Codex, Copilot, Antigravity…
TIER 2CheapLow-cost API providers — GLM, MiniMax, Kimi and 40+ more.
TIER 3FreeFree tiers keep you running — Kiro AI, OpenCode Free, Vertex credits.

Built to keep you in flow

Routing is only the start. Bansur Router squeezes more out of every account and every token you already have.

01

RTK Token Saver

Compresses tool outputs like git diff, grep, and ls before they reach the model — 20–40% fewer tokens per request.

02

3-tier smart fallback

Subscription → Cheap → Free. When a tier hits its limit, the next one takes over. Rate limits never stop a session.

03

Quota tracking

Real-time usage per account, so subscription quota is spent before it resets instead of expiring unused.

04

Format translation

OpenAI ↔ Claude ↔ Gemini, translated on the fly. Tools and providers never need to speak the same dialect.

05

Multi-account round-robin

Connect several accounts per provider and let requests rotate across them automatically.

06

Auto token refresh

OAuth tokens refresh themselves in the background. No re-login rituals in the middle of a session.

07

Custom combos

Chain models and providers into your own combos and route requests through them by name.

08

Request logging

Inspect every request that passes through the gateway, right from the dashboard.

09

Usage analytics

See where tokens and quota actually go, per account and per provider.

10

Headroom token saver

A second token-saving layer that keeps large contexts lean before they are sent.

11

Cloud sync

Keep your configuration in sync across the machines you work on.

12

Deploy anywhere

Run it on your local machine, in Docker, or on a VPS — the same endpoint everywhere.

Providers, organized by how you pay

Subscriptions you already own, free tiers that cost nothing, and API providers priced per token — all behind the same endpoint.

OAuth subscriptions

Sign in with the accounts you already pay for. Bansur Router uses their quota first, before it resets.

Claude CodeCodexGitHub CopilotAntigravityGeminiiFlowWindsurfKiro

Free tiers

The last line of the fallback chain — and a perfectly good place to start.

  • Kiro AI — ~50 credits/month free, with Claude 4.5, GLM-5, and MiniMax
  • OpenCode Free — no authentication required
  • Vertex AI — $300 in free credits for new GCP accounts

API-key providers

40+ providers with pay-per-token pricing for the cheap tier of your fallback chain.

  • GLM — from $0.6 / 1M tokens
  • MiniMax — from $0.20 / 1M tokens
  • Kimi — and dozens more, all under one config

Self-hosted endpoints

Point Bansur Router at your own endpoints and mix them into the same routing, combos, and fallback tiers as everything else.

Your endpoint, your rules Same dashboard key

Running in three steps

From zero to a working endpoint in about a minute.

STEP 1

Install

One global npm package. Or pull the Docker image — bansur/router on Docker Hub, ghcr.io/mas-ajam/bansur-router on GHCR.

npm install -g bansur-router
STEP 2

Run

Start the gateway and open the dashboard to connect your providers and copy your API key.

bansur-router
# dashboard → http://localhost:667/dashboard
STEP 3

Configure your tool

Every CLI tool gets the same three values. Pick a model — for example kr/claude-sonnet-4.5.

Endpoint  http://localhost:667/v1
API Key   <from the dashboard>
Model     kr/claude-sonnet-4.5

Full getting-started guide

Getting Started

Bansur Router is a local AI gateway. It runs on your machine and gives every coding tool one OpenAI-compatible endpoint for 40+ providers and 800+ models.

The idea

Instead of configuring each CLI tool with each provider's key and format, you run Bansur Router once. It listens on http://localhost:667/v1, and every tool — Claude Code, Codex, Cursor, Cline, OpenCode, Antigravity, GitHub Copilot, OpenClaw — points at that single address with a single API key from the dashboard.

Behind the endpoint, Bansur Router translates request formats (OpenAI ↔ Claude ↔ Gemini), rotates accounts, tracks quota, compresses tool output, and falls back across three tiers — Subscription → Cheap → Free — so a rate limit never has to end your session.

Your first run

  1. Install — npm install -g bansur-router (or use Docker; see Installation).
  2. Start it — run bansur-router. The dashboard opens at http://localhost:667/dashboard.
  3. Connect a provider — sign in with an OAuth subscription or paste an API key (see Connecting Providers).
  4. Copy your API key from the dashboard and paste it into your CLI tool, together with the endpoint and a model id (see CLI Tools Setup).

Model ids carry the provider with them. For example, kr/claude-sonnet-4.5 routes to Claude Sonnet 4.5 through Kiro. List everything available with GET /v1/models.

Where things live

API endpointhttp://localhost:667/v1
Dashboardhttp://localhost:667/dashboard
Default port667
Current version1.0.5 · MIT license · open source

Installation

Three ways to run Bansur Router: the npm package, Docker, or from source. All of them serve the same endpoint on port 667.

npm (recommended)

Install the package globally, then run it:

npm install -g bansur-router
bansur-router

The dashboard is now at http://localhost:667/dashboard and the API at http://localhost:667/v1. To update later, stop the running instance first, then repeat the install command.

Windows note: if npm fails with an EBUSY error during an update, Bansur Router is still running and Windows has locked its folder. Stop the process first (Ctrl+C in its terminal, or taskkill /F /IM node.exe), then install again.

Docker

Images are published to Docker Hub as bansur/router and to GHCR as ghcr.io/mas-ajam/bansur-router.

docker run -d --name bansur-router -p 667:667 bansur/router

The repository also ships a docker-compose.yml, so a compose-based deployment works out of the box:

services:
  bansur-router:
    image: bansur/router
    ports:
      - "667:667"

From source

Clone the repository, install dependencies, and build:

git clone https://github.com/mas-ajam/bansur-router
cd bansur-router
npm install
npm run build

For most people the npm package or the Docker image is the easier path — they are the same builds that ship in each release.

Connecting Providers

Providers are connected once, in the dashboard. After that, every tool using your Bansur Router key can reach all of them.

OAuth subscriptions

For subscription providers — Claude Code, Codex, GitHub Copilot, Antigravity, Gemini, iFlow, Windsurf, and Kiro — the flow is:

  1. Open the dashboard at http://localhost:667/dashboard and go to Providers.
  2. Pick the provider and choose Connect.
  3. Complete the provider's sign-in in the browser window that opens.
  4. The account appears in the dashboard, and its models become available through your endpoint.

Tokens are refreshed automatically, and you can connect more than one account per provider — requests round-robin across them, and quota is tracked per account so subscription quota is spent before it resets.

API-key providers

For the 40+ API-key providers, open the provider in the dashboard and paste its API key. Low-cost providers such as GLM (from $0.6/1M tokens), MiniMax (from $0.20/1M), and Kimi make a good "cheap" tier behind your subscriptions.

Free tiers worth connecting

  • Kiro AI — about 50 credits per month free, including Claude 4.5, GLM-5, and MiniMax models.
  • OpenCode Free — works with no authentication at all.
  • Vertex AI — new GCP accounts receive $300 in free credits.

Self-hosted endpoints

You can also register your own endpoints and mix them into the same routing, combos, and fallback tiers as the hosted providers.

Order matters. Bansur Router's fallback chain is Subscription → Cheap → Free. Connect at least one provider in each tier you care about, and a rate limit in one tier simply rolls the request into the next.

CLI Tools Setup

Every supported tool — Claude Code, OpenAI Codex, Cursor, Cline, OpenCode, Antigravity, GitHub Copilot, and OpenClaw — is configured with the same three values.

The three values

Endpointhttp://localhost:667/v1
API KeyYour Bansur Router API key, copied from the dashboard
ModelA model id from GET /v1/models — e.g. kr/claude-sonnet-4.5
Endpoint  http://localhost:667/v1
API Key   <copy from the dashboard>
Model     kr/claude-sonnet-4.5

Where exactly those values go depends on the tool — a custom OpenAI endpoint field, an environment variable, or a settings file — but the values themselves never change. That is the point of the gateway: reconfigure the router once, and every tool follows.

Switching models

There is nothing to reinstall when you want a different model. Change the model id in the tool to any id returned by GET /v1/models — 800+ models across 40+ providers are already behind the same key. Custom combos you define in the dashboard can also be used as model ids, chaining providers into a single named route.

Verifying the connection

Before opening your tool, confirm the gateway answers and lists models:

curl http://localhost:667/v1/models \
  -H "Authorization: Bearer <your-dashboard-api-key>"

If that returns a model list, any OpenAI-compatible tool configured with the same endpoint and key will work.

API Reference

Bansur Router speaks the OpenAI API. If a tool or library works with OpenAI's endpoints, it works with Bansur Router — just change the base URL.

Base URL & authentication

Base URLhttp://localhost:667/v1
Auth headerAuthorization: Bearer <dashboard API key>
Content typeapplication/json

List models

GET /v1/models returns every model reachable through your connected providers — 800+ across 40+ providers.

curl http://localhost:667/v1/models \
  -H "Authorization: Bearer <your-dashboard-api-key>"

Chat completions

POST /v1/chat/completions is OpenAI-compatible. The model id selects the provider route — Bansur Router translates the request into the provider's native format (OpenAI, Claude, or Gemini) and back.

curl http://localhost:667/v1/chat/completions \
  -H "Authorization: Bearer <your-dashboard-api-key>" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "kr/claude-sonnet-4.5",
    "messages": [
      { "role": "user", "content": "Explain what a router does, in one sentence." }
    ]
  }'

What happens to a request

  1. The model id resolves to a provider route (or one of your custom combos).
  2. Tool outputs in the conversation are compressed by the RTK Token Saver.
  3. The request is translated into the provider's format and sent with the next account in the round-robin.
  4. If the tier is rate-limited, the request falls back: Subscription → Cheap → Free.
  5. The response is translated back into OpenAI format and logged to the dashboard.

FAQ

Short answers to the questions everyone asks first.

Is Bansur Router free?

The software is open source under the MIT license — free to use, modify, and self-host. What you pay for are the providers themselves: subscriptions you already own, pay-per-token APIs, or nothing at all if you stick to the free tiers.

Does it run locally?

Yes. Bansur Router runs on your own machine and serves its endpoint on localhost:667. You can also deploy it with Docker or on a VPS if you want it reachable beyond one machine.

Which tools does it work with?

Any tool that accepts an OpenAI-compatible endpoint — including Claude Code, OpenAI Codex, Cursor, Cline, OpenCode, Antigravity, GitHub Copilot, and OpenClaw. They all share the same endpoint, key, and model ids.

How many providers and models are there?

40+ providers and 800+ models, spanning OAuth subscriptions, free tiers, and API-key providers. Call GET /v1/models to see the exact list for your connected accounts.

What is the RTK Token Saver?

Tool outputs — git diffs, grep results, directory listings — are compressed before they are sent to the model. That saves roughly 20–40% of tokens per request, which means lower cost and more room in the context window.

What happens when I hit a rate limit?

The request falls back through three tiers: Subscription → Cheap → Free. As long as one tier has capacity, the session continues instead of stopping.

Can I use more than one account per provider?

Yes. Connect multiple accounts and Bansur Router rotates requests across them round-robin, tracks quota per account, and refreshes OAuth tokens automatically.

Troubleshooting

The failure modes people actually run into, and the fix for each.

The dashboard doesn't open

Make sure Bansur Router is actually running — start it with bansur-router and watch for startup errors. Then open http://localhost:667/dashboard. If the page still won't load, something else may already be using port 667; stop that process or the older Bansur Router instance first.

Windows update fails with EBUSY

npm install -g bansur-router@latest cannot replace files while the app is running — Windows locks the folder and npm reports EBUSY: resource busy or locked. Stop the running instance (Ctrl+C in its terminal, or taskkill /F /IM node.exe to be sure), then run the install again.

Provider connect fails: "client_secret is missing"

Your browser login succeeded but the dashboard reports Token exchange failed … "client_secret is missing" — you are on an old version. This was fixed in release 1.0.3; update to the latest version (npm install -g bansur-router@latest, stopping the app first on Windows) and connect again. Current releases connect Antigravity, Gemini, iFlow, and Windsurf out of the box.

Requests return 401

The API key in your tool doesn't match the one in the dashboard. Re-copy it from the dashboard exactly, and make sure the header is Authorization: Bearer <key> with no extra whitespace.

"Model not found"

Model ids are provider-prefixed and must match exactly. List the valid ids for your accounts with GET /v1/models — for example kr/claude-sonnet-4.5 — and check that the provider behind the prefix is connected.

Everything stops at a rate limit

Fallback only works if the next tier exists. Connect at least one cheap API provider and one free tier (Kiro AI or OpenCode Free) alongside your subscriptions, and add a second account to busy providers so round-robin has somewhere to rotate to. Quota in the dashboard shows which account is exhausted.