Prerequisites
- Python 3.10 or higher
- An API key for at least one provider, or a local server such as Ollama
Install the package
openai, pydantic and tiktoken. It works with openai 2.x and 3.x.
Faster JSON with the fast extra
The fast extra installs orjson, which RouteHub uses for JSON encoding and decoding when it is available.
Set a provider key
RouteHub reads each provider’s key from its environment variable on every call. Set the ones you need:api_key= to any call. See Providers for every variable name.
Verify the install
mock_response returns a real ChatCompletion without a network call or an API key, so you can check the install offline:
Next steps
Quickstart
Make your first real call
Configuration
Retries, timeouts, TLS and environment variables