Skip to main content

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:

  1. Exact match — if a model name appears in a provider's MODELS list
  2. Prefix match — gpt-* → OpenAI, claude-* → Anthropic, gemini-* → Google, mistral-* → Mistral, model:tag → Ollama
  3. Default provider — the DEFAULT_PROVIDER fallback

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

Metadata

Release files for swiftllm-py 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for swiftllm-py 0.3.0
File Size Uploaded
swiftllm_py-0.3.0.tar.gz 47.3 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for swiftllm-py 0.3.0
File
swiftllm_py-0.3.0-cp313-cp313-manylinux_2_28_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.28+ x86-64 Details
swiftllm_py-0.3.0-cp313-cp313-manylinux_2_28_aarch64.whl CPython 3.13 CPython 3.13 Linux glibc 2.28+ ARM64 Details
swiftllm_py-0.3.0-cp312-cp312-win_amd64.whl CPython 3.12 CPython 3.12 Windows x86-64 Details
swiftllm_py-0.3.0-cp312-cp312-manylinux_2_28_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.28+ x86-64 Details
swiftllm_py-0.3.0-cp312-cp312-manylinux_2_28_aarch64.whl CPython 3.12 CPython 3.12 Linux glibc 2.28+ ARM64 Details
swiftllm_py-0.3.0-cp312-cp312-macosx_11_0_arm64.whl CPython 3.12 CPython 3.12 macOS 11.0+ ARM64 Details
swiftllm_py-0.3.0-cp312-cp312-macosx_10_12_x86_64.whl CPython 3.12 CPython 3.12 macOS 10.12+ x86-64 Details
swiftllm_py-0.3.0-cp311-cp311-manylinux_2_28_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.28+ x86-64 Details
swiftllm_py-0.3.0-cp311-cp311-manylinux_2_28_aarch64.whl CPython 3.11 CPython 3.11 Linux glibc 2.28+ ARM64 Details
swiftllm_py-0.3.0-cp310-cp310-manylinux_2_28_x86_64.whl CPython 3.10 CPython 3.10 Linux glibc 2.28+ x86-64 Details
swiftllm_py-0.3.0-cp310-cp310-manylinux_2_28_aarch64.whl CPython 3.10 CPython 3.10 Linux glibc 2.28+ ARM64 Details

Total release size: 25.0 MB

Release files / swiftllm_py-0.3.0.tar.gz

Download URL swiftllm_py-0.3.0.tar.gz
Size 47.3 kB
Tags Source
SHA-256 checksum
How to use checksums
7ed7e533a52e5c0dcdba9e4ef547547e22146b35596cbc39ab9a80fcb4e80980
BLAKE2b-256 checksum
How to use checksums
fe45997bd24676acc6daebcd95ef9ea0282b261e0435ad932c4d46d9cb513c40
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via maturin/1.12.6

Release files / swiftllm_py-0.3.0-cp313-cp313-manylinux_2_28_x86_64.whl

Download URL swiftllm_py-0.3.0-cp313-cp313-manylinux_2_28_x86_64.whl
Size 2.2 MB
Tags CPython 3.13 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
21de6ace404ad62bb866afc43f1e36b5c40d62172d48ebedc808a5ab0534e045
BLAKE2b-256 checksum
How to use checksums
38cb6c6e0a771e6ff18a868d7e0f4f5acd04c219933a5d619242bbb6313658a6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via maturin/1.12.6

Release files / swiftllm_py-0.3.0-cp313-cp313-manylinux_2_28_aarch64.whl

Download URL swiftllm_py-0.3.0-cp313-cp313-manylinux_2_28_aarch64.whl
Size 2.2 MB
Tags CPython 3.13 Linux glibc 2.28+ ARM64
SHA-256 checksum
How to use checksums
5843b60af1bfe0035627bca9d064052ed876b0248cc58812f323a6a6c1ac3068
BLAKE2b-256 checksum
How to use checksums
ea9ab0eaec01df965a714f95321cb685acfa9fb8e3fabd03c7bfc254b5d2248e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via maturin/1.12.6

Release files / swiftllm_py-0.3.0-cp312-cp312-win_amd64.whl

Download URL swiftllm_py-0.3.0-cp312-cp312-win_amd64.whl
Size 2.4 MB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
ea84cb3bce085c468ce963d64a92457ea8cd3bd2e5fbe52af112392df72c2c52
BLAKE2b-256 checksum
How to use checksums
b8aa0bca418721c955a1d9ca1889d4f1862fcb418fff41748afcc293e03c1623
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via maturin/1.12.6

Release files / swiftllm_py-0.3.0-cp312-cp312-manylinux_2_28_x86_64.whl

Download URL swiftllm_py-0.3.0-cp312-cp312-manylinux_2_28_x86_64.whl
Size 2.2 MB
Tags CPython 3.12 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
aa14987680e66bed93c8ab437414dd34d2248d72476a4548fc4d5009fc0bb854
BLAKE2b-256 checksum
How to use checksums
a7333b4c1fb54f2be9ca4ce4e13f27f4d8a1cf1e14cc6adfd2291bd01d74dc45
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via maturin/1.12.6

Release files / swiftllm_py-0.3.0-cp312-cp312-manylinux_2_28_aarch64.whl

Download URL swiftllm_py-0.3.0-cp312-cp312-manylinux_2_28_aarch64.whl
Size 2.2 MB
Tags CPython 3.12 Linux glibc 2.28+ ARM64
SHA-256 checksum
How to use checksums
a8c80f3eca6693485a80d17488c333097b210df077df922ffb71d0a3c5b67a57
BLAKE2b-256 checksum
How to use checksums
90e577643dc841f04713c1ebb9a852a31f7c17e1df1b1241dadbb3e658cd0bc3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via maturin/1.12.6

Release files / swiftllm_py-0.3.0-cp312-cp312-macosx_11_0_arm64.whl

Download URL swiftllm_py-0.3.0-cp312-cp312-macosx_11_0_arm64.whl
Size 2.3 MB
Tags CPython 3.12 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
9533fa24e9328c19079693f4130710a3973cd2dfb6c349b3b4500bd65fb79e6f
BLAKE2b-256 checksum
How to use checksums
1a6d9565c8b085c7b9ade60a2c3ef111984ad91b633b76488f3b504966a917d2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via maturin/1.12.6

Release files / swiftllm_py-0.3.0-cp312-cp312-macosx_10_12_x86_64.whl

Download URL swiftllm_py-0.3.0-cp312-cp312-macosx_10_12_x86_64.whl
Size 2.5 MB
Tags CPython 3.12 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
9ef757fa60bbdb3ddd2f781c9e40c62d30128e23be1e70b5f399011cab61ce21
BLAKE2b-256 checksum
How to use checksums
e2a34f93f7ff6f7d64790881981d7927382686b50fd3307e1b1710599b2dcb2e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via maturin/1.12.6

Release files / swiftllm_py-0.3.0-cp311-cp311-manylinux_2_28_x86_64.whl

Download URL swiftllm_py-0.3.0-cp311-cp311-manylinux_2_28_x86_64.whl
Size 2.2 MB
Tags CPython 3.11 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
39c7db6d89deb2c446c1882ec314dc20b1fea149b03803cbdd0b73635c45429a
BLAKE2b-256 checksum
How to use checksums
1ace0059afc4be373bddc842d848db554ec457e4127dee3c83e1047db324a289
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via maturin/1.12.6

Release files / swiftllm_py-0.3.0-cp311-cp311-manylinux_2_28_aarch64.whl

Download URL swiftllm_py-0.3.0-cp311-cp311-manylinux_2_28_aarch64.whl
Size 2.2 MB
Tags CPython 3.11 Linux glibc 2.28+ ARM64
SHA-256 checksum
How to use checksums
11c10f81cf97dba507caf9dc4dbea23f44cb52099443ab1aa67cea9230c48d06
BLAKE2b-256 checksum
How to use checksums
9bd3299a9dd5722dc4b153c92697960c2be20ac9679192759434859fc2c78f44
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via maturin/1.12.6

Release files / swiftllm_py-0.3.0-cp310-cp310-manylinux_2_28_x86_64.whl

Download URL swiftllm_py-0.3.0-cp310-cp310-manylinux_2_28_x86_64.whl
Size 2.2 MB
Tags CPython 3.10 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
11ecaf3c2a8851c6e794bc62452af87c66e5115e488efac3e66b917e4365622d
BLAKE2b-256 checksum
How to use checksums
20b0d5747b647b6a28c9c9ca0b7ff838de77d51a1828c3fac33acc6ec16b2fb5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via maturin/1.12.6

Release files / swiftllm_py-0.3.0-cp310-cp310-manylinux_2_28_aarch64.whl

Download URL swiftllm_py-0.3.0-cp310-cp310-manylinux_2_28_aarch64.whl
Size 2.2 MB
Tags CPython 3.10 Linux glibc 2.28+ ARM64
SHA-256 checksum
How to use checksums
2532ff0c089eb4502c08de54f6b23df137fc9d0e55f191c3da9e89ffec9a224f
BLAKE2b-256 checksum
How to use checksums
c85cd19faf34f97f9538673fd73b83138ad1e681e62895f8ac8669a46646c285
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via maturin/1.12.6

Release history Release notifications | RSS feed

This release

0.3.0 This release

12 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page