Skip to main content

llm-relay

Unified LLM usage management — API proxy, session diagnostics, multi-CLI orchestration.

한국어 | llms.txt

Features

  • Proxy: Transparent API proxy with cache/token monitoring and 12-strategy pruning
  • Detect: 7 detectors (orphan, stuck, bloat, synthetic, cache, resume, microcompact)
  • Recover: Session recovery and doctor (7 health checks)
  • Guard: 4-tier threshold daemon with dual-zone classification
  • Cost: Per-1% cost calculation and rate-limit header analysis
  • Orch: Multi-CLI orchestration (Claude Code, Codex CLI, Gemini CLI)
  • Display: Multi-CLI session monitor with provider badges and liveness detection
  • I18n: Multi-language support (English, Korean) with browser auto-detection and LLM_RELAY_LANG env
  • MCP: 8 tools via stdio transport (cli_delegate, cli_status, cli_probe, orch_delegate, orch_history, relay_stats, session_turns, session_history)

Install

One-command install (Windows native)

For Windows users who just want it running, after Python 3.9+ is installed:

irm https://raw.githubusercontent.com/ArkNill/llm-relay/main/scripts/install.ps1 | iex

That script pip installs llm-relay[all], starts the proxy as a Windows background daemon, health-gates it, and only then routes Claude Code through it. Routing is never activated unless the proxy actually responds, so this is safe to run on a machine where Claude Code is already configured -- the worst case is the install aborts with a clear message and leaves your existing setup untouched. See Prerequisites below for the Python requirement and venv guidance.

If you would rather do it by hand (Linux, macOS, or just to see each step), keep reading.

Prerequisites

  • Python 3.9 or newer (3.12 recommended). We do not bundle a Python runtime; install it once and llm-relay reuses it.
    • Windows: winget install Python.Python.3.12 or python.org/downloads
    • macOS: brew install python@3.12
    • Linux: your distribution's package manager (apt install python3.12, dnf install python3.12, etc.)
  • (Recommended) A virtual environment. Clean uninstall, no PATH surprises, isolated dependency tree.

1. Set up Python environment

Windows (pip)
python -m venv .venv
.venv\Scripts\activate
Windows (conda)
conda create -n llm-relay python=3.12
conda activate llm-relay
Linux / macOS (pip)
python3 -m venv .venv
source .venv/bin/activate

2. Install llm-relay

# Default (SQLite, zero-config)
pip install llm-relay

# With proxy + web dashboard
pip install llm-relay[proxy]

# With PostgreSQL support (long-term analytics + vector search)
pip install llm-relay[pg]

# With MCP server (Python 3.10+)
pip install llm-relay[mcp]

# Everything
pip install llm-relay[all]

3. Choose database

SQLite (default) PostgreSQL
Setup Zero-config Requires PG server
Best for Getting started, light usage Long-term data analytics, vector search
Install pip install llm-relay pip install llm-relay[pg]
Config (none needed) LLM_RELAY_DB=postgresql://user:pass@host/db

4. Initialize

llm-relay init

Quick Start

One-command setup

llm-relay init              # Auto-detect CLIs, configure proxy, start server

CLI commands

llm-relay scan              # Session health check (7 detectors)
llm-relay doctor            # Configuration health check (7 checks)
llm-relay recover           # Extract session context for resumption
llm-relay serve             # Start proxy server + web dashboard
llm-relay top               # Live terminal monitor (btop-style)
llm-relay service install   # Windows: background service + auto-start (no console window)
llm-relay service stop      # Windows: stop background service
llm-relay service uninstall # Windows: remove service + cleanup

Web dashboard

# Native (Linux/macOS/Windows)
llm-relay serve --port 8080

Then open:

  • /dashboard/ — CLI status, cost, delegation history, Turn Monitor (alive sessions only; ?include_dead=1 to bypass)
  • /display/ — Turn counter with CC/Codex/Gemini session cards (alive filter: CC via cc_pid+TTY fallback, Codex/Gemini via fd-open; Windows uses mtime+process detection)
  • /history/ — Session conversation history browser. Stored turns keep message text only: inline base64 image/document payloads are replaced by source.omitted_bytes.

MCP server

llm-relay-mcp               # stdio transport, 8 tools

API proxy for Claude Code

# Set in Claude Code
llm-relay connect   # Auto-configures Claude Code proxy

Agent-driven setup

If you would rather have your existing coding agent (Claude Code, Codex, Gemini) run the install for you, point it at docs/AGENT_SETUP.md. It is a structured playbook the agent follows step by step, using llm-relay env-fingerprint and llm-relay verify to probe and check each step without scraping output.

llm-relay env-fingerprint --format json        # state snapshot
llm-relay verify install --format json         # is the package usable?
llm-relay verify config --format json          # is local state set up?
llm-relay verify integration --cli claude-code # is the CLI wired?
llm-relay verify all                            # everything at once

Exit code is 0 on pass/warn, 1 on fail.

CLI Status

CLI Status
Claude Code Fully supported
OpenAI Codex Fully supported
Gemini CLI Display supported, oauth-personal has known 403 server-side bug (#25425)

Platform Support

Platform Mode Notes
Linux Native Full feature set, systemd recommended
macOS Native Full feature set
Windows Native llm-relay service install for background daemon (no console window)

Requirements

  • Python >= 3.9
  • MCP tools require Python >= 3.10

License

MIT

Ecosystem

Part of the QuartzUnit open-source ecosystem.

Metadata

Release files for llm-relay 0.9.7

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

Source distribution (sdist)

Source distribution for llm-relay 0.9.7
File Size Uploaded Provenance Actions
llm_relay-0.9.7.tar.gz 327.5 kB With provenance Details for llm_relay-0.9.7.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for llm-relay 0.9.7
File Interpreter ABI Platform Actions
llm_relay-0.9.7-py3-none-any.whl Python 3 none any Details for llm_relay-0.9.7-py3-none-any.whl

Total release size: 553.8 kB

Release files / llm_relay-0.9.7.tar.gz

Download URL llm_relay-0.9.7.tar.gz
Size 327.5 kB
Tags Source
SHA-256 checksum
How to use checksums
10d67c931b28da3652f336b387afa70eaa859cbe2b265dbfe857b37a3594fa1c
BLAKE2b-256 checksum
How to use checksums
2a595c7a0afd700dd60de3ac79bc4578a98b8cfcfd3067c73666abdcc7d4f3e6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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, 2026.

Transparency log

Release files / llm_relay-0.9.7-py3-none-any.whl

Download URL llm_relay-0.9.7-py3-none-any.whl
Size 226.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9333c10a86330e8929d7002d727d5243f1cffd41061e6c07b89e0d5ccec2be3e
BLAKE2b-256 checksum
How to use checksums
63b88653bc01f198be3af01f79a1f8c1f4e17d7249ef65ae5bb0d8f5f0f58f3e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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, 2026.

Transparency log

Security for llm-relay 0.9.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.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for llm_relay-0.9.7.tar.gz

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, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.9.7 This release

2 release files Full provenance

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