A blazing-fast universal LLM gateway — call OpenAI, Anthropic, Gemini, Mistral & Ollama through one unified API.
Project description
swiftllm
A blazing-fast universal LLM gateway written in Rust. Route requests to OpenAI, Anthropic, Google Gemini, Mistral, Ollama, and more through a single OpenAI-compatible API.
┌──────────────┐ ┌───────────┐ ┌──────────┐
│ Your App │──────▶│ swiftllm │──────▶│ OpenAI │
│ (any SDK) │ │ :8080 │──────▶│ Anthropic│
└──────────────┘ └───────────┘──────▶│ Gemini │
──────▶│ Mistral │
──────▶│ Ollama │
└──────────┘
Why?
Most teams use multiple LLM providers. That means juggling different SDKs, API formats, and billing dashboards. swiftllm gives you:
- One endpoint — drop-in replacement for the OpenAI API. Use any SDK or tool that speaks OpenAI format.
- Automatic routing — requests route to the right provider based on model name (
gpt-4.1→ OpenAI,claude-sonnet-4-6→ Anthropic,gemini-2.0-flash→ Google,mistral-large-latest→ Mistral,llama3:latest→ Ollama). - Streaming support — full SSE streaming with format translation across all providers.
- Single binary — no runtime dependencies, no Docker required. Just download and run.
- ~1ms overhead — built in Rust with async I/O. Adds negligible latency.
Quick Start
Download pre-built binary
Grab the latest release for your platform from the Releases page:
# Linux
curl -L https://github.com/Elyeden0/swiftllm/releases/latest/download/swiftllm-linux-amd64.tar.gz | tar xz
chmod +x swiftllm
# macOS (Apple Silicon)
curl -L https://github.com/Elyeden0/swiftllm/releases/latest/download/swiftllm-macos-arm64.tar.gz | tar xz
chmod +x swiftllm
# Windows
# Download swiftllm-windows-amd64.zip from the releases page and extract it
Then configure and run:
# Copy the example .env and add your API keys
cp .env.example .env
# Edit .env with your API keys...
./swiftllm
The .env file must be placed in the same directory as the executable. swiftllm will refuse to start without it.
From source
git clone https://github.com/Elyeden0/swiftllm
cd swiftllm
cargo build --release
cp .env.example .env
# Edit .env with your API keys...
./target/release/swiftllm
Usage
Once running, point any OpenAI-compatible client at http://localhost:8080:
# Non-streaming
curl http://localhost:8080/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer your-proxy-api-key" \
-d '{
"model": "claude-sonnet-4-6",
"messages": [{"role": "user", "content": "Hello!"}]
}'
# Streaming
curl http://localhost:8080/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer your-proxy-api-key" \
-d '{
"model": "gpt-4o",
"messages": [{"role": "user", "content": "Tell me a joke"}],
"stream": true
}'
Works with the OpenAI Python SDK:
from openai import OpenAI
client = OpenAI(
base_url="http://localhost:8080/v1",
api_key="your-proxy-api-key",
)
# Use any model from any provider
response = client.chat.completions.create(
model="claude-sonnet-4-6", # Routes to Anthropic
messages=[{"role": "user", "content": "Hello!"}],
)
Configuration
All configuration is done through a .env file. See .env.example for all options.
PORT=8080
AUTH_API_KEYS=your-proxy-api-key
DEFAULT_PROVIDER=openai
OPENAI_API_KEY=sk-...
OPENAI_MODELS=gpt-4o,gpt-4.1,o3,o4-mini
OPENAI_PRIORITY=1
ANTHROPIC_API_KEY=sk-ant-...
ANTHROPIC_MODELS=claude-sonnet-4-6,claude-opus-4-6
ANTHROPIC_PRIORITY=2
GEMINI_API_KEY=your-gemini-key
GEMINI_MODELS=gemini-2.0-flash,gemini-2.0-pro
GEMINI_PRIORITY=3
MISTRAL_API_KEY=your-mistral-key
MISTRAL_MODELS=mistral-large-latest,codestral-latest
MISTRAL_PRIORITY=4
OLLAMA_BASE_URL=http://localhost:11434
OLLAMA_MODELS=llama3:latest,mistral:latest
OLLAMA_PRIORITY=10
You can also pass the path explicitly: swiftllm --env /path/to/.env
Model routing
Models are routed to providers in this order:
- Exact match — if a model name appears in a provider's
MODELSlist - Prefix match —
gpt-*→ OpenAI,claude-*→ Anthropic,gemini-*→ Google,mistral-*→ Mistral,model:tag→ Ollama - Default provider — the
DEFAULT_PROVIDERfallback
API Endpoints
| Endpoint | Description |
|---|---|
POST /v1/chat/completions |
Chat completions (streaming & non-streaming) |
GET /v1/models |
List all configured models |
GET /health |
Health check |
GET /api/stats |
Usage stats, cost tracking, cache metrics |
GET /dashboard |
Live web dashboard |
Roadmap
- Response caching (LRU with configurable TTL)
- Cost tracking & token counting dashboard
- Automatic failover with priority chains
- Embedded web dashboard
- Rate limiting per provider
- Google Gemini provider
- Tool/function call translation
- Request logging & analytics
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file swiftllm_py-0.3.0.tar.gz.
File metadata
- Download URL: swiftllm_py-0.3.0.tar.gz
- Upload date:
- Size: 47.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.12.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7ed7e533a52e5c0dcdba9e4ef547547e22146b35596cbc39ab9a80fcb4e80980
|
|
| MD5 |
52f477e5b02e6202e41a63be00da57ca
|
|
| BLAKE2b-256 |
fe45997bd24676acc6daebcd95ef9ea0282b261e0435ad932c4d46d9cb513c40
|
File details
Details for the file swiftllm_py-0.3.0-cp313-cp313-manylinux_2_28_x86_64.whl.
File metadata
- Download URL: swiftllm_py-0.3.0-cp313-cp313-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 2.2 MB
- Tags: CPython 3.13, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.12.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
21de6ace404ad62bb866afc43f1e36b5c40d62172d48ebedc808a5ab0534e045
|
|
| MD5 |
9306880037767f3de7d2a09129edb362
|
|
| BLAKE2b-256 |
38cb6c6e0a771e6ff18a868d7e0f4f5acd04c219933a5d619242bbb6313658a6
|
File details
Details for the file swiftllm_py-0.3.0-cp313-cp313-manylinux_2_28_aarch64.whl.
File metadata
- Download URL: swiftllm_py-0.3.0-cp313-cp313-manylinux_2_28_aarch64.whl
- Upload date:
- Size: 2.2 MB
- Tags: CPython 3.13, manylinux: glibc 2.28+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.12.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5843b60af1bfe0035627bca9d064052ed876b0248cc58812f323a6a6c1ac3068
|
|
| MD5 |
cad9b40a4f68508443cf8b263e7537c0
|
|
| BLAKE2b-256 |
ea9ab0eaec01df965a714f95321cb685acfa9fb8e3fabd03c7bfc254b5d2248e
|
File details
Details for the file swiftllm_py-0.3.0-cp312-cp312-win_amd64.whl.
File metadata
- Download URL: swiftllm_py-0.3.0-cp312-cp312-win_amd64.whl
- Upload date:
- Size: 2.4 MB
- Tags: CPython 3.12, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.12.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ea84cb3bce085c468ce963d64a92457ea8cd3bd2e5fbe52af112392df72c2c52
|
|
| MD5 |
b5e0b7fabea2af4025eee8788be6cb2a
|
|
| BLAKE2b-256 |
b8aa0bca418721c955a1d9ca1889d4f1862fcb418fff41748afcc293e03c1623
|
File details
Details for the file swiftllm_py-0.3.0-cp312-cp312-manylinux_2_28_x86_64.whl.
File metadata
- Download URL: swiftllm_py-0.3.0-cp312-cp312-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 2.2 MB
- Tags: CPython 3.12, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.12.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
aa14987680e66bed93c8ab437414dd34d2248d72476a4548fc4d5009fc0bb854
|
|
| MD5 |
057598c9593f76e0b5cef3e8f549a7e4
|
|
| BLAKE2b-256 |
a7333b4c1fb54f2be9ca4ce4e13f27f4d8a1cf1e14cc6adfd2291bd01d74dc45
|
File details
Details for the file swiftllm_py-0.3.0-cp312-cp312-manylinux_2_28_aarch64.whl.
File metadata
- Download URL: swiftllm_py-0.3.0-cp312-cp312-manylinux_2_28_aarch64.whl
- Upload date:
- Size: 2.2 MB
- Tags: CPython 3.12, manylinux: glibc 2.28+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.12.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a8c80f3eca6693485a80d17488c333097b210df077df922ffb71d0a3c5b67a57
|
|
| MD5 |
6367b6b7fd5a11dacfe58caeda4248e2
|
|
| BLAKE2b-256 |
90e577643dc841f04713c1ebb9a852a31f7c17e1df1b1241dadbb3e658cd0bc3
|
File details
Details for the file swiftllm_py-0.3.0-cp312-cp312-macosx_11_0_arm64.whl.
File metadata
- Download URL: swiftllm_py-0.3.0-cp312-cp312-macosx_11_0_arm64.whl
- Upload date:
- Size: 2.3 MB
- Tags: CPython 3.12, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.12.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9533fa24e9328c19079693f4130710a3973cd2dfb6c349b3b4500bd65fb79e6f
|
|
| MD5 |
0c9a85abae01f1b75f0a1ea7ad574df2
|
|
| BLAKE2b-256 |
1a6d9565c8b085c7b9ade60a2c3ef111984ad91b633b76488f3b504966a917d2
|
File details
Details for the file swiftllm_py-0.3.0-cp312-cp312-macosx_10_12_x86_64.whl.
File metadata
- Download URL: swiftllm_py-0.3.0-cp312-cp312-macosx_10_12_x86_64.whl
- Upload date:
- Size: 2.5 MB
- Tags: CPython 3.12, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.12.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9ef757fa60bbdb3ddd2f781c9e40c62d30128e23be1e70b5f399011cab61ce21
|
|
| MD5 |
bd4a87c2189c9015e62016ffa4720af8
|
|
| BLAKE2b-256 |
e2a34f93f7ff6f7d64790881981d7927382686b50fd3307e1b1710599b2dcb2e
|
File details
Details for the file swiftllm_py-0.3.0-cp311-cp311-manylinux_2_28_x86_64.whl.
File metadata
- Download URL: swiftllm_py-0.3.0-cp311-cp311-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 2.2 MB
- Tags: CPython 3.11, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.12.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
39c7db6d89deb2c446c1882ec314dc20b1fea149b03803cbdd0b73635c45429a
|
|
| MD5 |
1ffc95c4f96e8a88fe50bd8b9f307ba3
|
|
| BLAKE2b-256 |
1ace0059afc4be373bddc842d848db554ec457e4127dee3c83e1047db324a289
|
File details
Details for the file swiftllm_py-0.3.0-cp311-cp311-manylinux_2_28_aarch64.whl.
File metadata
- Download URL: swiftllm_py-0.3.0-cp311-cp311-manylinux_2_28_aarch64.whl
- Upload date:
- Size: 2.2 MB
- Tags: CPython 3.11, manylinux: glibc 2.28+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.12.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
11c10f81cf97dba507caf9dc4dbea23f44cb52099443ab1aa67cea9230c48d06
|
|
| MD5 |
4f58cc762fae47f370b410a0b268c977
|
|
| BLAKE2b-256 |
9bd3299a9dd5722dc4b153c92697960c2be20ac9679192759434859fc2c78f44
|
File details
Details for the file swiftllm_py-0.3.0-cp310-cp310-manylinux_2_28_x86_64.whl.
File metadata
- Download URL: swiftllm_py-0.3.0-cp310-cp310-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 2.2 MB
- Tags: CPython 3.10, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.12.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
11ecaf3c2a8851c6e794bc62452af87c66e5115e488efac3e66b917e4365622d
|
|
| MD5 |
2d011e801212722154911ae01ea4a351
|
|
| BLAKE2b-256 |
20b0d5747b647b6a28c9c9ca0b7ff838de77d51a1828c3fac33acc6ec16b2fb5
|
File details
Details for the file swiftllm_py-0.3.0-cp310-cp310-manylinux_2_28_aarch64.whl.
File metadata
- Download URL: swiftllm_py-0.3.0-cp310-cp310-manylinux_2_28_aarch64.whl
- Upload date:
- Size: 2.2 MB
- Tags: CPython 3.10, manylinux: glibc 2.28+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.12.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2532ff0c089eb4502c08de54f6b23df137fc9d0e55f191c3da9e89ffec9a224f
|
|
| MD5 |
acb37d3760e8a726f7fdf6ee69d9bbfc
|
|
| BLAKE2b-256 |
c85cd19faf34f97f9538673fd73b83138ad1e681e62895f8ac8669a46646c285
|