The two-faced AI routing gateway
Project description
Janus
The two-faced gateway for AI coding tools. Janus sits at the threshold of every AI call — facing the developer on one side and every provider on the other.
Janus is a local-first, single-user AI routing gateway. It exposes OpenAI/Anthropic-compatible HTTP endpoints that your coding tools (Claude Code, Codex, Cursor, Cline, ...) talk to, then translates and routes each request to 40+ AI providers — without either side needing to know the other exists.
Quickstart
# Install
pip install -e .
# Generate default config
janus config-init
# Start the server
janus serve --port 20128
Point your coding tool at http://localhost:20128/v1 and start routing.
📚 Documentation · Contributing · Changelog
Docker
# Create config in the persistent volume
mkdir -p janus-data
cp ~/.janus/config.yaml janus-data/config.yaml # or create one with janus config-init
# Build and run
docker compose up -d
The SQLite database and config persist in ./janus-data/. Environment variables
from .env are passed through for ${ENV_VAR} resolution in config.
Configuration
Janus reads YAML config from ~/.janus/config.yaml with ${ENV_VAR} token
resolution. Generate a template with janus config-init.
server:
port: 20128
host: 127.0.0.1
require_api_key: false
providers:
- id: openai
prefix: openai
api_type: openai_compat
base_url: https://api.openai.com/v1
api_key: ${OPENAI_API_KEY}
models: [gpt-4o, gpt-4o-mini, o3, o4-mini]
- id: anthropic
prefix: anthropic
api_type: anthropic
base_url: https://api.anthropic.com
api_key: ${ANTHROPIC_API_KEY}
models: [claude-sonnet-4-20250514, claude-opus-4-20250514]
combos:
- name: best-effort
models: [anthropic/claude-sonnet-4-20250514, openai/gpt-4o]
Supported Provider Types
api_type |
Use For |
|---|---|
openai_compat |
Any OpenAI-compatible API (OpenAI, Groq, Together, DeepSeek, OpenRouter, Mistral, Fireworks, Perplexity, xAI, ...) |
anthropic |
Direct Anthropic API |
gemini |
Direct Google Gemini API |
opencode_free |
OpenCode Zen free tier |
Known Provider Base URLs
| Provider | base_url |
|---|---|
| OpenAI | https://api.openai.com/v1 |
| Groq | https://api.groq.com/openai/v1 |
| Together AI | https://api.together.xyz/v1 |
| DeepSeek | https://api.deepseek.com/v1 |
| OpenRouter | https://openrouter.ai/api/v1 |
| Mistral | https://api.mistral.ai/v1 |
| Fireworks | https://api.fireworks.ai/inference/v1 |
| Perplexity | https://api.perplexity.ai |
| xAI (Grok) | https://api.x.ai/v1 |
| Qwen/DashScope | https://dashscope.aliyuncs.com/compatible-mode/v1 |
Client Setup
Point your coding tools at Janus:
Claude Code / Anthropic tools:
export ANTHROPIC_BASE_URL=http://localhost:20128/v1
OpenAI tools (Codex, Cursor, etc.):
export OPENAI_BASE_URL=http://localhost:20128/v1
export OPENAI_API_KEY=sk-janus-yourkey # if require_api_key is on
Features
- Fallback routing — multi-account rotation with cooldowns (429->60s, 5xx->30s, auth->300s, network->15s)
- Combos — named ordered model sequences (e.g.,
"model": "best-effort") - Token savers — RTK compression (default ON), Caveman terse prompt, Ponytail lazy-dev prompt
- Budgets — daily spending limits per API key or global, with warn/block thresholds
- Analytics — cost tracking, spend trends, success rates, per-model/provider/key breakdowns
- Pricing — 28 builtin model prices, YAML-overridable, cache token rates
- Dashboard — HTMX UI at
/dashboardwith charts, budget management, usage stats
CLI Reference
| Command | Description |
|---|---|
janus serve |
Start the gateway server |
janus config-init |
Generate default config YAML |
janus config-path |
Print config file path |
janus keys create/list/revoke |
Manage API keys |
janus usage stats/cost/by-key |
Usage and cost reports |
janus budgets list/set/delete |
Manage spending budgets |
janus pricing list/show |
View model pricing |
Development
git clone https://github.com/amanverasia/Janus.git
cd Janus
python -m venv .venv
pip install -e ".[dev]"
# Run tests
.venv/bin/python -m pytest
# Lint + typecheck
.venv/bin/ruff check src/janus/ tests/
.venv/bin/mypy src/janus/
# Start dev server
.venv/bin/janus serve --port 20128 --reload
Tech Stack
Python 3.11+ / FastAPI / httpx / Pydantic v2 / aiosqlite / Jinja2 / HTMX / Chart.js
License
GPL-3.0 © 2026 Aman Verasia
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 Distribution
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 janus_ai-0.2.0.tar.gz.
File metadata
- Download URL: janus_ai-0.2.0.tar.gz
- Upload date:
- Size: 217.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
50dd631ae4d8cf2c64de4bb81021e7179752a4d974138221f9839c39580ac0d2
|
|
| MD5 |
eea76cc335750dd7eeadf3136986abae
|
|
| BLAKE2b-256 |
6ac17db63ecfce545fea5520873cf516684807aa91a8aa3fbe7189abd1131d27
|
Provenance
The following attestation bundles were made for janus_ai-0.2.0.tar.gz:
Publisher:
publish.yml on amanverasia/Janus
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
janus_ai-0.2.0.tar.gz -
Subject digest:
50dd631ae4d8cf2c64de4bb81021e7179752a4d974138221f9839c39580ac0d2 - Sigstore transparency entry: 1950905937
- Sigstore integration time:
-
Permalink:
amanverasia/Janus@640cd16c11714a381bcee601458013621cd870eb -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/amanverasia
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@640cd16c11714a381bcee601458013621cd870eb -
Trigger Event:
push
-
Statement type:
File details
Details for the file janus_ai-0.2.0-py3-none-any.whl.
File metadata
- Download URL: janus_ai-0.2.0-py3-none-any.whl
- Upload date:
- Size: 85.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2f1552d5acf0a2d2366e1446c192450ec217c42ea6d84af006f0fbfc8fc2d542
|
|
| MD5 |
3aff95863d5e074368b4e2ad6fe32397
|
|
| BLAKE2b-256 |
2b981fdc7d80e8ef670efd7613c3b8ab50d9faa60b6bad6f4c69774bd2cba206
|
Provenance
The following attestation bundles were made for janus_ai-0.2.0-py3-none-any.whl:
Publisher:
publish.yml on amanverasia/Janus
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
janus_ai-0.2.0-py3-none-any.whl -
Subject digest:
2f1552d5acf0a2d2366e1446c192450ec217c42ea6d84af006f0fbfc8fc2d542 - Sigstore transparency entry: 1950906107
- Sigstore integration time:
-
Permalink:
amanverasia/Janus@640cd16c11714a381bcee601458013621cd870eb -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/amanverasia
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@640cd16c11714a381bcee601458013621cd870eb -
Trigger Event:
push
-
Statement type: