打造 GoRoute:以 Go 編寫、RAM 佔用低於 15MB 的超輕量 LLM 閘道
Building GoRoute: An Ultra-Lightweight (<15MB RAM) LLM Gateway in Go
GoRoute 是以 Go 編寫、零依賴的 LLM 閘道及多智能體路由器,閒置時 RAM 佔用低於 6MB。它可編譯為單一 16MB 執行檔,支援遇到 429 限流時自動輪替帳戶及切換金鑰,亦可用單一命令設定 Claude Code、OpenCode、Codex、Cursor、Aider 和 Cline。
Most developers using terminal coding agents like Claude Code, OpenCode, Codex, or Cursor end up running an LLM router in the background to handle rate limits, multiple accounts, and model failovers.
Popular tools like OmniRoute and LiteLLM work, but running a full Node.js or Python runtime 24/7 just to proxy HTTP requests consumes 150MB to 300MB of RAM and introduces cold-start latency.
I wanted something that idles at < 6MB RAM, starts instantly, and never panics. So I built GoRoute.
What is GoRoute?
GoRoute is a zero-dependency, compiled LLM gateway and multi-agent router written in Go.
It acts as a local reverse proxy (http://127.0.0.1:8128) sitting between your developer agents and AI providers.
+-------------+ +-------------------+ +-----------------------+
| Claude Code | ----> | | ----> | Google Antigravity |
| OpenCode | ----> | GoRoute (Go Proxy)| ----> | OpenAI / Anthropic |
| Codex/Cursor| ----> | (<15MB RAM) | ----> | Custom Endpoints |
+-------------+ +-------------------+ +-----------------------+
Key Capabilities
- Sub-15MB Memory Footprint: Compiles to a single 16MB binary with zero external dependencies. Idles under 6MB RAM.
- Automatic 429 Failover & Round-Robin: Automatically rotates accounts and instantly fails over across keys if rate limits are hit.
-
Dual Protocol Translation: Speak OpenAI (
/v1/chat/completions) or Anthropic Messages API (/v1/messages) seamlessly. - 1-Click Agent Setup: Automatically configures Claude Code, OpenCode, Codex, Cursor, Aider, and Cline with a single command:
goroute setup all
- Seamless OmniRoute Migration: If you already have OmniRoute configured, import your existing credentials and routes in 1 second:
goroute import-omniroute
Installation & Quick Start
You can install GoRoute directly via curl:
curl -fsSL https://raw.githubusercontent.com/ziuus/goroute/main/install.sh | bash
Or run via npm:
npx goroute setup all
Once installed, check status:
goroute status
Check out the GitHub repo here: https://github.com/ziuus/goroute
I'd love to hear your feedback, feature requests, or questions!
來源:DEV Community · dev.to