RiteLLM
Overview
RiteLLM is a high-performance LLM (Large Language Model) gateway that provides a unified interface for interacting with multiple LLM providers. Built with Rust and exposed through elegant Python bindings, RiteLLM combines the speed of compiled systems programming with the ease of Python development.
✨ Key Features
- 🚀 Unified LLM Gateway: Single, consistent API for multiple LLM providers
- 🔌 Provider Support: Currently supports OpenAI, with more providers coming soon (Anthropic, Google, Cohere, and more)
- ⚡ Rust-Powered Performance: Core engine built in Rust for maximum speed and efficiency
- 📊 First-Class Observability: Built-in integration with Weights & Biases Weave for seamless tracing, monitoring, and debugging
- 🐍 Pythonic Interface: Clean, intuitive Python API that feels native to the ecosystem
- 🔒 Type-Safe: Full type hints for better IDE support and code quality
- 🌊 Streaming Support: Real-time streaming responses for better user experience
🚀 Installation
Install RiteLLM using pip:
uv pip install ritellm
💻 Quick Start
Basic Usage
from ritellm import completion
# Define your messages
messages = [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Explain what Rust is in one sentence."}
]
# Make a completion request
response = completion(
model="openai/gpt-3.5-turbo",
messages=messages,
temperature=0.7,
max_tokens=100
)
# Access the response
print(response["choices"][0]["message"]["content"])
print(f"Tokens used: {response['usage']['total_tokens']}")
Streaming Responses
For real-time streaming of responses:
from ritellm import completion
messages = [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Write a short poem about Rust."}
]
# Enable streaming
response = completion(
model="openai/gpt-3.5-turbo",
messages=messages,
stream=True
)
# Stream the response
for chunk in response:
if "choices" in chunk and len(chunk["choices"]) > 0:
content = chunk["choices"][0]["delta"].get("content", "")
if content:
print(content, end="", flush=True)
With Weave Tracing
RiteLLM has first-class support for Weave, enabling automatic tracing and monitoring of your LLM calls:
import weave
from ritellm import completion
# Initialize Weave
weave.init(project_name="my-llm-project")
# Wrap completion with Weave's op decorator for automatic tracing
messages = [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "What is the capital of France?"}
]
response = weave.op(completion)(
model="openai/gpt-3.5-turbo",
messages=messages,
temperature=0.7
)
# Your calls are now automatically traced in Weave!
🙏 Gratitude
ritellm is highly inspired by litellm and its simple API design.
Release files for ritellm 0.1.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| ritellm-0.1.7.tar.gz | 188.1 kB | Details |
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| ritellm-0.1.7-cp313-cp313-macosx_11_0_arm64.whl | CPython 3.13 | CPython 3.13 | macOS 11.0+ ARM64 | Details |
| ritellm-0.1.7-cp313-cp313-macosx_10_12_x86_64.whl | CPython 3.13 | CPython 3.13 | macOS 10.12+ x86-64 | Details |
| ritellm-0.1.7-cp39-cp39-win_amd64.whl | CPython 3.9 | CPython 3.9 | Windows x86-64 | Details |
| ritellm-0.1.7-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl | CPython 3.8 | CPython 3.8 | Linux glibc 2.17+ x86-64 | Details |
Total release size: 7.6 MB
Release files / ritellm-0.1.7.tar.gz
| Download URL | ritellm-0.1.7.tar.gz |
|---|---|
| Size | 188.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
459c7764ad948b45643778cc54da08aa3bb5df0ec1ccea721e054bb16444918d
|
|
BLAKE2b-256 checksum How to use checksums |
2589c20b0210c559c2acee329c35ec7e9f46539c96e087938b7046ab7b0c0f80
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 22, 2025.
Transparency logRelease files / ritellm-0.1.7-cp313-cp313-macosx_11_0_arm64.whl
| Download URL | ritellm-0.1.7-cp313-cp313-macosx_11_0_arm64.whl |
|---|---|
| Size | 1.8 MB |
| Tags | CPython 3.13 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
e39afe91b7b9d43b973182cc8b17f428c5c9f43e9fedb8b66e06ed4e7e0d4eec
|
|
BLAKE2b-256 checksum How to use checksums |
21aefcc9f17754c0a491ee3f826cd49e6b7a7a2c3ec67802afb3e5d5a05a5031
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 22, 2025.
Transparency logRelease files / ritellm-0.1.7-cp313-cp313-macosx_10_12_x86_64.whl
| Download URL | ritellm-0.1.7-cp313-cp313-macosx_10_12_x86_64.whl |
|---|---|
| Size | 1.9 MB |
| Tags | CPython 3.13 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
ddd356284875552e43121ed23641ac43ad3e160cd4822c4362436f5d52a0c5c0
|
|
BLAKE2b-256 checksum How to use checksums |
82c024815fd1fd2640fde43be23b942dcd7a2ade8def5fca432d3d2e907ad25f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 22, 2025.
Transparency logRelease files / ritellm-0.1.7-cp39-cp39-win_amd64.whl
| Download URL | ritellm-0.1.7-cp39-cp39-win_amd64.whl |
|---|---|
| Size | 1.6 MB |
| Tags | CPython 3.9 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
8d93da6c69104309de66591354643d48ba8315c09e732408e7e7c39cc4f4a7e0
|
|
BLAKE2b-256 checksum How to use checksums |
ff84fa55b12adac76a5ac37460666465d21fefc51e374a8de8f6d3ac6e9c8502
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 22, 2025.
Transparency logRelease files / ritellm-0.1.7-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | ritellm-0.1.7-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 2.0 MB |
| Tags | CPython 3.8 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
21594b11024c9ce824ad86d07f86ff08685f93a41ae069834ac251288dd19e5c
|
|
BLAKE2b-256 checksum How to use checksums |
f05385f1ec2646ba4f30d0c316f8bbbca45ceaadd5424c540a3ee560d7793408
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 22, 2025.
Transparency log