Skip to main content
RouteHub is the Swarms LLM gateway. It gives you one Python API for 20+ providers, including OpenAI, Anthropic, Gemini, Groq, xAI, DeepSeek, OpenRouter, Mistral, Ollama and any OpenAI-compatible server. Every response is the OpenAI SDK’s own type, so the code that reads a GPT response also reads a Claude or Llama response. RouteHub keeps litellm’s function names and module paths, so moving an existing codebase is mostly a change of import. It is built for speed: import routehub takes 5.5 ms and the gateway adds 0.004 ms to each call.

Installation

Install RouteHub with pip or uv

Quickstart

Make your first call in under a minute

Providers

Model strings and API key variables for every provider

Migrating from litellm

Swap litellm for RouteHub in an existing codebase

Why RouteHub

Performance

Measured on the same machine (macOS, Python 3.12) against litellm 1.76.1.
  • Import time is the median of 7 fresh processes. litellm’s GitHub fetch was turned off for its measurement, so the gap is pure import cost. RouteHub loads the OpenAI SDK on the first call, which brings import plus first call to 232 ms.
  • Overhead per call is the time each gateway adds to a bare OpenAI SDK call, measured against an instant mock server so network time is excluded. It is the median of 300 calls.
Fast startup matters most for serverless functions, CLI tools, test suites and short-lived agent processes, where an import alone can outweigh the work being done.
The full benchmark, covering cold start, per-call overhead, streaming, async throughput and connection reuse against LiteLLM, any-llm, aisuite and the bare provider SDKs, is in the RouteHub paper.

Resources

GitHub

Source code and issues

PyPI

Released packages

Paper

Design and benchmarks