npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

lina-router

v0.4.40

Published

Save 20-40% tokens. Route your AI coding tools to 40+ providers. Free models included.

Readme

LINA Router

Never stop coding. Route any AI tool to 40+ providers — and let the cheap ones write the boring parts.

npm Downloads License Stars

Get Started → · Docs · Site


| 40+ | 100+ | 20–40% | $0 | |:---:|:---:|:---:|:---:| | providers | models | tokens saved | to start |


What is this?

LINA Router is a local proxy that sits between your AI coding tools (Claude Code, Cursor, Cline, Codex, anything OpenAI-compatible) and the AI providers themselves. It does three things you didn't know you needed:

  1. Compresses tool outputs before they reach the model. git diff going from 4,200 tokens to 2,600. Every request, automatically.
  2. Falls back gracefully when your subscription quota runs out — to cheap APIs, then to free models. You never see a rate limit.
  3. Speaks every dialect. OpenAI, Anthropic, Gemini, custom — point your tool at localhost:20128/v1 and it just works.

Built for engineers who hate paying $50/month for tokens they could have saved. Runs entirely on your machine.


📐 How it routes

graph LR
    CLI[Your CLI Tool<br/>Claude Code · Cursor · Cline · Codex]
    LINA[LINA Router<br/>localhost:20128]
    Sub[Tier 1<br/>Subscription<br/>Claude · Copilot · Codex]
    Cheap[Tier 2<br/>Cheap APIs<br/>GLM · MiniMax · DeepSeek]
    Free[Tier 3<br/>Free Forever<br/>Kiro · OpenCode · Vertex]

    CLI -->|OpenAI-compatible| LINA
    LINA --> Sub
    LINA --> Cheap
    LINA --> Free

    style LINA fill:#D97757,stroke:#A85638,color:#fff
    style Sub fill:#FAF9F5,stroke:#D97757
    style Cheap fill:#FAF9F5,stroke:#D97757
    style Free fill:#FAF9F5,stroke:#D97757

⚡ Quick Start

npm install -g lina-router
lina-router

Dashboard opens at http://localhost:20128. Connect a free provider (Kiro takes 10 seconds, no signup), then point your tool:

export ANTHROPIC_BASE_URL=http://localhost:20128/v1
export ANTHROPIC_API_KEY=<your-lina-router-key>
claude

That's the entire install.


🧭 How fallback decides

When a request comes in, LINA Router asks three questions in order. The first yes wins:

flowchart TD
    Req[Incoming request]
    Q1{Subscription quota<br/>remaining?}
    Q2{Cheap-tier budget<br/>under limit?}
    Q3{Free provider<br/>available?}
    Sub[→ Route to subscription<br/>Claude / Copilot / Codex]
    Cheap[→ Route to cheap API<br/>$0.20–0.60 per 1M tokens]
    Free[→ Route to free<br/>Kiro · OpenCode · Vertex]
    Fail[Return error]

    Req --> Q1
    Q1 -->|yes| Sub
    Q1 -->|no| Q2
    Q2 -->|yes| Cheap
    Q2 -->|no| Q3
    Q3 -->|yes| Free
    Q3 -->|no| Fail

    style Req fill:#FAF9F5,stroke:#141413
    style Sub fill:#D97757,stroke:#A85638,color:#fff
    style Cheap fill:#D97757,stroke:#A85638,color:#fff
    style Free fill:#D97757,stroke:#A85638,color:#fff
    style Fail fill:#fff,stroke:#A85638

You can reorder tiers, lock specific models, or run multi-account round-robin within a tier. Whatever keeps you coding.


💎 Features

| | | |---|---| | 🚀 RTK Token Saver | Auto-compresses git diff, grep, ls, tree tool outputs before they reach the model. 20–40% smaller, same fidelity. | | 🔄 Auto Fallback | Subscription → Cheap → Free. Zero downtime, zero intervention. You'll know it switched because the dashboard told you. | | 👥 Multi-Account | Got three Claude Code accounts? LINA round-robins between them to dodge rate limits and squeeze every quota. | | 🌐 Universal | One endpoint. Works with Claude Code, Cursor, Cline, Codex, Copilot, Continue, OpenCode — anything OpenAI-compatible. |


🪶 RTK — the boring genius

Most of your tokens aren't prose. They're tool outputsgit diff against a 50-file refactor, grep -r across a monorepo, ls -la of a node_modules tree. RTK looks at those, strips the redundant parts, and forwards a leaner version. The model still gets what it needs. Your wallet doesn't.

flowchart LR
    Tool[CLI tool output<br/>git diff · grep · ls]
    Detect{Detected as<br/>tool_result?}
    Compress[RTK Compress<br/>strip redundant lines<br/>preserve semantics]
    Forward[Forward to model<br/>20–40% smaller]
    Forward2[Forward as-is]

    Tool --> Detect
    Detect -->|yes| Compress
    Detect -->|no| Forward2
    Compress --> Forward

    style Tool fill:#FAF9F5,stroke:#141413
    style Compress fill:#D97757,stroke:#A85638,color:#fff
    style Forward fill:#D97757,stroke:#A85638,color:#fff
    style Forward2 fill:#FAF9F5,stroke:#141413

One request rarely matters. Ten thousand do.


🛠️ Tools that work today


🌐 Providers

🔐 OAuth (your subscription)

🆓 Free forever

🔑 API key (40+ more)

OpenRouter · GLM · Kimi · MiniMax · OpenAI · Anthropic · Gemini · DeepSeek · Groq · xAI · Mistral · Perplexity · Together · Fireworks · Cerebras · Cohere · NVIDIA · SiliconFlow · Nebius · Chutes · Hyperbolic · and 20 more, plus any OpenAI/Anthropic-compatible endpoint.


💰 Pricing reality check

| Tier | Provider | Cost | Best for | |---|---|---|---| | RTK (built-in) | LINA Router | $0 | Saves 20–40% on every request | | Subscription | Claude Code (Pro/Max) | $20–200/mo | Already a subscriber | | Subscription | Codex (Plus/Pro) | $20–200/mo | OpenAI heavy users | | Subscription | Copilot | $10–19/mo | GitHub-native | | Cheap | GLM-5 | $0.6 / 1M tokens | Budget backup | | Cheap | MiniMax M2.7 | $0.2 / 1M tokens | Cheapest paid option | | Cheap | Kimi K2.5 | $9 / mo flat | Predictable monthly | | Free | Kiro AI | $0 | Unlimited Claude 4.5 | | Free | OpenCode Free | $0 | No auth, no signup | | Free | Vertex AI | $300 credits | New GCP accounts |

The combo: RTK + Kiro + OpenCode = $0 cost, −40% tokens. We were not paid to recommend it; it's just the math.

No, LINA Router never bills you. The dashboard shows "saved $290 this month" — that's the money you didn't spend. It's an open-source binary running on your laptop. There is no card to charge.


🎯 Who this is for

"I have Claude Pro and keep hitting limits." LINA round-robins across your accounts, then falls back to Kiro free when you're out. Same model, no interruption.

"My GLM API bill keeps growing." RTK alone cuts 30% off every request. Free Kiro tier absorbs the rest. Bill goes down.

"I want to try Cursor without paying." Point Cursor at localhost:20128/v1. Connect Kiro. You now have Cursor running on free Claude 4.5.


📦 Install variants

git clone https://github.com/spooky-may/lina-routerrr.git
cd lina-routerrr
pnpm install
pnpm dev

Dashboard at localhost:20128. Hot reload enabled.

docker build -t lina-router .
docker run -d \
  --name lina-router \
  -p 20128:20128 \
  -v lina-router-data:/app/data \
  lina-router

Data persists in the lina-router-data volume.

git clone https://github.com/spooky-may/lina-routerrr.git
cd lina-routerrr && pnpm install && pnpm build
pm2 start ecosystem.config.cjs
pm2 save && pm2 startup

🧠 Tech under the hood

  • Runtime: Node.js 18+, Next.js 16 (App Router)
  • DB: SQLite (better-sqlite3) for local persistence
  • Cloud worker: Cloudflare Workers + D1 (optional, for cross-device sync)
  • Tunnel: Tailscale Funnel + Cloudflare Quick Tunnels
  • MITM (for Copilot/Kiro): mitmproxy with custom Node bridge
  • OAuth: 14+ provider-specific implementations (Claude, GitHub, Gemini, Cursor, …)
  • Telemetry: in-process event ring buffer + JSONL drain
  • Health: per-provider circuit breaker (closed → open → half-open)
  • All routing logic lives in open-sse/ (handlers, account fallback, combo routing)
  • Dashboard is a Next.js app at /dashboard
  • Provider OAuth flows in src/lib/oauth/services/{provider}.js
  • Database repos in src/lib/db/repos/
  • MCP plugin bridge: src/lib/mcp/stdioSseBridge.js exposes stdio MCP servers over SSE
  • Observability: src/lib/analytics/eventTelemetry.js (events) + src/lib/healthcheck/healthMonitor.js (circuit breakers)

LINA Router exposes an OpenAI-compatible /v1/chat/completions endpoint at localhost:20128. Models are referenced via prefixes that map to providers:

| Prefix | Meaning | |---|---| | kr/ | Kiro AI | | cx/ | Codex / OpenAI | | ag/ | Antigravity | | gh/ | GitHub Copilot (MITM) | | or/ | OpenRouter | | (any model id) | Default routing rules apply |

Example: kr/claude-sonnet-4.5 routes through Kiro using Claude 4.5.

Full OpenAPI spec at /api/openapi.json once you're running locally.

  • Dashboard won't open? Check port 20128. lsof -i :20128 (mac/linux) or netstat -ano | findstr :20128 (windows).
  • MITM error for Copilot/Kiro? Trust the LINA root CA. Dashboard → Settings → Install Certificate.
  • OAuth callback fails? Make sure no other tool is bound to localhost:20129. That's the callback port.
  • High RAM usage? SQLite cache. Run Settings → Maintenance → Compact DB.

❓ FAQ

Is LINA Router free? Yes. MIT licensed. No paywall, no telemetry-to-server, no "premium tier." You pay providers directly; LINA just routes.

Does it work offline? The router does (after install). Providers, obviously, don't.

Will my OAuth tokens leak? Tokens live in ~/.lina-router/ (or DATA_DIR) as SQLite rows. Same security model as your shell history. No cloud sync unless you explicitly enable it.

Can I add a custom provider? Yes. Dashboard → Providers → Custom → paste the endpoint. Anything OpenAI-compatible works out of the box.

Why "LINA"? It's just a name. No, there's no token.


🙏 Built on


LINA Router · GitHub · Site · Docs

MIT License — free as in beer, free as in speech.