> ## Documentation Index
> Fetch the complete documentation index at: https://docs.swarms.world/llms.txt
> Use this file to discover all available pages before exploring further.

# Install RouteHub

> Install RouteHub from PyPI with pip or uv, with optional orjson support

## Prerequisites

* **Python 3.10 or higher**
* An API key for at least one provider, or a local server such as Ollama

## Install the package

```bash pip theme={null}
pip install -U routehub
```

```bash uv theme={null}
uv add routehub
```

```bash poetry theme={null}
poetry add routehub
```

```bash From source theme={null}
git clone https://github.com/The-Swarm-Corporation/RouteHub.git
cd RouteHub
pip install -e .
```

RouteHub has three direct dependencies: `openai`, `pydantic` and `tiktoken`. It works with openai 2.x and 3.x.

## Faster JSON with the `fast` extra

The `fast` extra installs [orjson](https://github.com/ijl/orjson), which RouteHub uses for JSON encoding and decoding when it is available.

```bash pip theme={null}
pip install "routehub[fast]"
```

```bash uv theme={null}
uv add "routehub[fast]"
```

> [!TIP]
>
> Set `ROUTEHUB_USE_ORJSON=0` to fall back to the standard `json` module without uninstalling orjson.

## Set a provider key

RouteHub reads each provider's key from its environment variable on every call. Set the ones you need:

```bash theme={null}
export OPENAI_API_KEY="sk-..."
export ANTHROPIC_API_KEY="sk-ant-..."
export GEMINI_API_KEY="..."
export GROQ_API_KEY="gsk_..."
```

You can also pass `api_key=` to any call. See [Providers](https://docs.swarms.world/routehub/providers.md) for every variable name.

> [!WARNING]
>
> Keep keys in a `.env` file or a secrets manager and never commit them. RouteHub never writes keys to logs, including with `set_verbose=True`.

## Verify the install

`mock_response` returns a real `ChatCompletion` without a network call or an API key, so you can check the install offline:

```python theme={null}
import routehub

print(routehub.__version__)

response = routehub.completion(
    model="gpt-5.4-mini",
    messages=[{"role": "user", "content": "ping"}],
    mock_response="pong",
)
print(response.choices[0].message.content)  # pong
```

## Next steps

> **[Quickstart](https://docs.swarms.world/routehub/quickstart.md)**
>
> Make your first real call

> **[Configuration](https://docs.swarms.world/routehub/configuration.md)**
>
> Retries, timeouts, TLS and environment variables


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.