大模型网摘deepseek.wang

Tools · 2026-11-19

LLM API Gateways and Proxies: LiteLLM, one-api, and OpenRouter

Once you connect more than a couple of models, the tooling question arrives: five vendors mean five sets of keys, five error formats, and five invoices. An API gateway (proxy) layer solves this — it unifies different providers behind a single OpenAI-compatible interface and, along the way, handles routing, key management, and usage tracking. This roundup covers three common options, based on public documentation as of publication.

LiteLLM: The Established Unification Layer

LiteLLM is a widely used open-source library in the Python ecosystem. Its core idea is a unified OpenAI-format entry point for 100+ providers — model names take a provider/model form, so switching backends is a string change. It works as an SDK embedded in your app or as a standalone proxy server (LiteLLM Proxy) with virtual keys, budget caps, rate limits, and usage tracking. For teams that need to allocate quotas across projects and centralize billing, the proxy mode fits well.

one-api: Lightweight Self-Hosted Aggregation

one-api is an open-source project written in Go that deploys as a single binary. It aggregates multiple upstream channels into one OpenAI-format interface, with channel weighting, token grouping, and quota management — a common sight in self-hosted setups. Its strengths are light deployment and a simple admin panel, good for individuals or small teams keeping all their keys in one place; do check release notes before upgrading, since upstream API changes move fast.

OpenRouter: Hosted Aggregation

Unlike the two self-hosted options above, OpenRouter is a hosted service: one API key, one interface, access to hundreds of models, with per-model pricing and context lengths listed openly and some models on free tiers. For individual developers who don't want to maintain a gateway and want to compare and switch models quickly, it's a low-friction start. The trade-off: your traffic and keys pass through a third party, which data-sensitive businesses should evaluate themselves.

How to Choose

In practice, all of these speak OpenAI Chat Completions format — point your base_url at the gateway and change the model name. Code from our OpenAI compatibility notes and Python quickstart migrates almost unchanged. To compare how specific models behave behind a gateway, see the freshly updated Kimi K3.1 Pro vs deepseek-flash; for the coding-side ecosystem, our coding CLI agents roundup has you covered.

This article is compiled from publicly available sources.