Your AI Coding Assistant's Best Friend A blazing-fast local proxy for AI coding assistants that gives you complete visibility into every LLM interaction. Zero configuration, sub-millisecond overhead, and powerful debugging capabilities.
What's inside
___---___
.-- --.
./ () .-. \.
/ o . ( ) \
/ . '-' \ _ ____ _
| () . O . | | | _ _ _ __ __ _| _ \ ___ _ _| |_ ___
| | | | | | | | '_ \ / _` | |_) / _ \| | | | __/ _ \
| o () | | |__| |_| | | | | (_| | _ < (_) | |_| | || __/
| .--. O | |_____\__,_|_| |_|\__,_|_| \_\___/ \__,_|\__\___|
| . | | |
\ `.__.' o . /
\ /
`\ o () /
`--___ ___--'
---
Your AI Coding Assistant's Best Friend
A blazing-fast local proxy for AI coding assistants that gives you complete visibility into every LLM interaction. Zero configuration, sub-millisecond overhead, and powerful debugging capabilities.
eval $(lunaroute-server env)
That's it! This single command:
ANTHROPIC_BASE_URL)OPENAI_BASE_URL)Start coding with your AI assistant immediately - both APIs are ready to use!
If you prefer to run the server manually:
# Terminal 1: Start the server
lunaroute-server
# Terminal 2: Point your AI tools to it
export ANTHROPIC_BASE_URL=http://localhost:8081 # For Claude Code
export OPENAI_BASE_URL=http://localhost:8081/v1 # For Codex CLI
That's it. No API keys to configure, no YAML files to write, nothing. LunaRoute automatically:
gpt-* β OpenAI, claude-* β Anthropic)Stop flying blind. LunaRoute records every interaction with zero configuration:
# Literally just one command
eval $(lunaroute-server env)
What you get instantly:
/v1/chat/completions + Anthropic /v1/messageshttp://localhost:8082How it works:
$ lunaroute-server env
export ANTHROPIC_BASE_URL=http://127.0.0.1:8081
export OPENAI_BASE_URL=http://127.0.0.1:8081/v1
# LunaRoute server started on http://127.0.0.1:8081
# Web UI available at http://127.0.0.1:8082
$ eval $(lunaroute-server env) # Sets env vars and starts server
$ # Now use your AI tools normally - they're automatically configured!
Download the latest release for your platform from GitHub Releases:
# Linux/macOS: Extract and run
tar -xzf lunaroute-server-*.tar.gz
chmod +x lunaroute-server
# Optional: Add to PATH for global access
sudo mv lunaroute-server /usr/local/bin/
# Start using it immediately!
eval $(lunaroute-server env)
git clone https://github.com/erans/lunaroute.git
cd lunaroute
cargo build --release --package lunaroute-server
# Binary location: target/release/lunaroute-server
# Start using it!
eval $(./target/release/lunaroute-server env)
The fastest way to get started - automatically starts server and configures your shell:
# One command does everything!
eval $(lunaroute-server env)
# Now use your AI tools - they're automatically configured
# Both Claude Code and Codex CLI work immediately
What happens:
ANTHROPIC_BASE_URL set to http://127.0.0.1:8081OPENAI_BASE_URL set to http://127.0.0.1:8081/v1http://127.0.0.1:8082Custom port:
eval $(lunaroute-server env --port 8090)
Stop the server:
pkill -f "lunaroute-server serve"
If you prefer to manage the server yourself:
# Terminal 1: Start LunaRoute
lunaroute-server
# Terminal 2: Configure your shell
export ANTHROPIC_BASE_URL=http://localhost:8081
export OPENAI_BASE_URL=http://localhost:8081/v1
# Now use Claude Code or Codex CLI
# View sessions at http://localhost:8082
What you get out of the box:
β OpenAI provider enabled (no API key - will use client auth)
β Anthropic provider enabled (no API key - will use client auth)
π‘ API dialect: Both (OpenAI + Anthropic)
β‘ Dual passthrough mode: OpenAIβOpenAI + AnthropicβAnthropic (no normalization)
- gpt-* models β OpenAI provider (passthrough)
- claude-* models β Anthropic provider (passthrough)
π Bypass enabled for unknown API paths
π Session recording enabled (SQLite + JSONL)
π¨ Web UI available at http://localhost:8082
Need more control? Use a config file:
# Save as config.yaml
host: "127.0.0.1"
port: 8081
api_dialect: "both" # Already the default!
providers:
openai:
enabled: true
base_url: "https://api.openai.com/v1" # Or use ChatGPT backend
# api_key: "sk-..." # Optional: defaults to OPENAI_API_KEY env var
anthropic:
enabled: true
# api_key: "sk-ant-..." # Optional: defaults to ANTHROPIC_API_KEY env var
session_recording:
enabled: true
sqlite:
enabled: true
path: "~/.lunaroute/sessions.db"
jsonl:
enabled: true
directory: "~/.lunaroute/sessions"
retention:
max_age_days: 30
max_size_mb: 1024
ui:
enabled: true
host: "127.0.0.1"
port: 8082
lunaroute-server --config config.yaml
LunaRoute accepts both OpenAI and Anthropic formats simultaneously with zero normalization:
/v1/chat/completions β routes to OpenAI/v1/messages β routes to AnthropicTrack everything that matters with dual storage:
SQLite Database - Fast queries and analytics:
SELECT model_used, COUNT(*), SUM(input_tokens), SUM(output_tokens)
FROM sessions
WHERE started_at > datetime('now', '-7 days')
GROUP BY model_used;
JSONL Logs - Human-readable, full request/response data:
# Watch live sessions
tail -f ~/.lunaroute/sessions/$(date +%Y-%m-%d)/session_*.jsonl | jq
# Search for specific content
grep -r "TypeError" ~/.lunaroute/sessions/
Get detailed breakdowns on shutdown or via API:
π Session Statistics Summary
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Session: 550e8400-e29b-41d4-a716-446655440000
Requests: 5
Input tokens: 2,450
Output tokens: 5,830
Thinking tokens: 1,200
Total tokens: 9,480
Tool usage:
Read: 12 calls (avg 45ms)
Write: 8 calls (avg 120ms)
Bash: 3 calls (avg 850ms)
Performance:
Avg response time: 2.3s
Proxy overhead: 12ms total (0.5%)
Provider latency: 2.288s (99.5%)
π° Estimated cost: $0.14 USD
Protect sensitive data automatically before it hits disk:
session_recording:
pii:
enabled: true
detect_email: true
detect_phone: true
detect_ssn: true
detect_credit_card: true
redaction_mode: "tokenize" # mask, remove, tokenize, or partial
Before: My email is john.doe@example.com and SSN is 123-45-6789
After: My email is [EMAIL:a3f8e9d2] and SSN is [SSN:7b2c4f1a]
24 metric types at /metrics:
Perfect for Grafana dashboards.
Built-in web interface for browsing sessions:
# Automatically available at http://localhost:8082
lunaroute-server
Features:
env CommandThe env command starts the server in the background and outputs shell commands to configure your environment:
# Basic usage - starts server on default port 8081
eval $(lunaroute-server env)
# Custom port
eval $(lunaroute-server env --port 8090)
# Custom host and port
eval $(lunaroute-server env --host 0.0.0.0 --port 8090)
# Check what it does without executing
lunaroute-server env
# Output:
# export ANTHROPIC_BASE_URL=http://127.0.0.1:8081
# export OPENAI_BASE_URL=http://127.0.0.1:8081/v1
# # LunaRoute server started on http://127.0.0.1:8081
# # Web UI available at http://127.0.0.1:8082
What happens:
Stop the server:
pkill -f "lunaroute-server serve"
Control behavior without config files:
# API dialect (default: both)
export LUNAROUTE_DIALECT=both # openai, anthropic, or both
# Provider API keys (optional - can use client headers)
export OPENAI_API_KEY="sk-..."
export ANTHROPIC_API_KEY="sk-ant-..."
# Session recording
export LUNAROUTE_ENABLE_SESSION_RECORDING=true
export LUNAROUTE_ENABLE_SQLITE_WRITER=true
export LUNAROUTE_SESSIONS_DB_PATH="~/.lunaroute/sessions.db"
export LUNAROUTE_ENABLE_JSONL_WRITER=true
export LUNAROUTE_SESSIONS_DIR="~/.lunaroute/sessions"
# Logging
export LUNAROUTE_LOG_LEVEL=info # trace, debug, info, warn, error
export LUNAROUTE_LOG_REQUESTS=false
# Server settings
export LUNAROUTE_HOST=127.0.0.1
export LUNAROUTE_PORT=8081
# UI
export LUNAROUTE_UI_ENABLED=true
export LUNAROUTE_UI_PORT=8082
Tune HTTP client performance:
providers:
openai:
http_client:
timeout_secs: 600 # Request timeout (default: 600)
connect_timeout_secs: 10 # Connection timeout (default: 10)
pool_max_idle_per_host: 32 # Pool size (default: 32)
pool_idle_timeout_secs: 600 # Idle timeout (default: 600)
tcp_keepalive_secs: 60 # Keepalive (default: 60)
max_retries: 3 # Retries (default: 3)
Or use environment variables:
export LUNAROUTE_OPENAI_TIMEOUT_SECS=300
export LUNAROUTE_OPENAI_POOL_MAX_IDLE=64
See Connection Pool Configuration for details.
LunaRoute can automatically notify users when requests are routed to alternative providers due to rate limits, errors, or circuit breaker events.
Features:
Configuration:
routing:
provider_switch_notification:
enabled: true
default_message: |
IMPORTANT: Please inform the user that due to temporary service constraints,
their request is being handled by an alternative AI service provider.
Continue with their original request.
providers:
anthropic-backup:
type: "anthropic"
# Custom message when THIS provider is used as alternative
switch_notification_message: |
Using Claude due to ${reason}. Quality remains the same.
Template Variables:
${original_provider} - Provider that failed${new_provider} - Provider being used${reason} - Generic reason (high demand, service issue, maintenance)${model} - Model nameSee examples/configs/provider-switch-notification.yaml for complete example.
Problem: Your AI session cost $5 but you don't know why.
Solution: Check session stats to see the AI's output was extremely verbose.
Problem: Your AI assistant feels slow.
Solution: Session statistics reveal Bash commands take 850ms on average - optimize those!
Problem: Team shares one proxy but everyone has different API keys.
Solution: LunaRoute uses client-provided auth - no shared secrets needed.
Problem: Need to log sessions but can't store PII.
Solution: Enable automatic PII redaction - all sensitive data removed before hitting disk.
supports_websockets = true in ~/.codex/config.toml to use the WS path (lunaroute terminates the WS and drives the HTTP pipeline; session recording, markers, and metrics all work the same).LunaRoute is built as a modular Rust workspace:
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Claude Code / OpenAI Codex CLI / OpenCode β
βββββββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββββββββ
β HTTP/SSE
β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β LunaRoute Proxy β
β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β Ingress (Anthropic/OpenAI endpoints) β β
β βββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββ β
β β β
β βββββββββββββββββββββββΌβββββββββββββββββββββββββββββββββ β
β β Dual Passthrough Mode (Zero-copy, 100% fidelity) β β
β βββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββ β
β β β
β βββββββββββββββββββββββΌβββββββββββββββββββββββββββββββββ β
β β Session Recording (JSONL + SQLite, PII redaction) β β
β βββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββ β
β β β
β βββββββββββββββββββββββΌβββββββββββββββββββββββββββββββββ β
β β Metrics & Statistics (Prometheus, session stats) β β
β βββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββ β
β β β
β βββββββββββββββββββββββΌβββββββββββββββββββββββββββββββββ β
β β Egress (Provider connectors) β β
β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
βββββββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββββββββ
β HTTP/SSE
β
βββββββββββββββββββββββββ βββββββββββββββββββ
β OpenAI API β β Anthropic API β
β (api.openai.com) β β (api.anth...) β
βββββββββββββββββββββββββ βββββββββββββββββββ
Key Crates:
lunaroute-core - Types and traitslunaroute-ingress - HTTP endpoints (OpenAI, Anthropic)lunaroute-egress - Provider connectors with connection poolinglunaroute-session - Recording and searchlunaroute-pii - PII detection/redactionlunaroute-observability - Metrics and healthlunaroute-server - Production binaryWe welcome contributions! Whether it's:
Please see CONTRIBUTING.md for guidelines.
Licensed under the Apache License, Version 2.0 (LICENSE).
Like the moon π guides travelers at night, LunaRoute illuminates your AI interactions. Every request, every token, every decision - visible and trackable.
Built with β€οΈ for developers who want visibility, control, and performance.
.claude/
agents/
rust-web-security-reviewer.md
.editorconfig
.github/
dependabot.yml
workflows/
ci.yml
release.yml
.gitignore
Cargo.toml
clippy.toml
config.example.yaml
config.yaml
CONTRIBUTING.md
crates/
lunaroute-cli/
Cargo.toml
src/
main.rs
lunaroute-config-file/
Cargo.toml
src/
file_store.rs
lib.rs
lunaroute-config-postgres/
Cargo.toml
src/
lib.rs
postgres_config_store.rs
lunaroute-core/
Cargo.toml
src/
config_store.rs
error.rs
events.rs
lib.rs
normalized/
normalized.rs
tests.rs
provider/
provider.rs
tests.rs
session_store.rs
template.rs
tenant.rs
types.rs
lunaroute-egress/
Cargo.toml
src/
anthropic.rs
client.rs
codex_auth.rs
codex_headers.rs
lib.rs
openai.rs
retry_after.rs
tests/
connection_pool_test.rs
integration_anthropic_wiremock.rs
integration_openai_wiremock.rs
lunaroute-ingress/
Cargo.toml
src/
anthropic.rs
async_stream_parser.rs
bypass.rs
lib.rs
marker.rs
middleware.rs
multi_dialect.rs
openai.rs
provider_registry.rs
responses_ws.rs
streaming_metrics.rs
types.rs
tests/
integration_anthropic.rs
integration_openai.rs
routed_recording.rs
lunaroute-integration-tests/
Cargo.toml
README.md
src/
lib.rs
tests/
anthropic_to_openai_translation.rs
bypass_integration.rs
common.rs
custom_headers_body_mods.rs
e2e_with_observability.rs
error_handling_with_recording.rs
limits_alternative_strategy.rs
openai_to_anthropic_translation.rs
passthrough_streaming_recording.rs
real_api_tests.rs
responses_websocket.rs
router_observability_integration.rs
streaming_e2e.rs
switch_notification_integration.rs
lunaroute-observability/
Cargo.toml
src/
health.rs
lib.rs
metrics.rs
tracing.rs
tests/
observability_integration.rs
lunaroute-pii/
Cargo.toml
README.md
src/
detector/
detector.rs
regex_detector.rs
tests.rs
lib.rs
redactor/
redactor.rs
standard_redactor.rs
tests.rs
lunaroute-routing/
Cargo.toml
README.md
src/
circuit_breaker.rs
health.rs
lib.rs
notification.rs
path_classifier.rs
provider_config.rs
provider_router.rs
router.rs
strategy.rs
tests/
router_integration.rs
router_streaming_integration.rs
lunaroute-server/
build.rs
Cargo.toml
README.md
src/
app.rs
bootstrap.rs
config.rs
main.rs
session_factory.rs
session_stats.rs
lunaroute-session/
lunaroute-session-postgres/
Cargo.toml
src/
config.rs
lib.rs
metrics.rs
migrations.rs
postgres_session_store.rs
tests/
integration_tests.rs
lunaroute-session-sqlite/
Cargo.toml
src/
lib.rs
sqlite_session_store.rs
Cargo.toml
README.md
src/
cleanup.rs
config.rs
events.rs
import.rs
jsonl_writer.rs
lib.rs
pii_redaction_tests.rs
pii_redaction.rs
recorder.rs
recording_provider.rs
search.rs
session_store_recording_provider.rs
session.rs
sqlite_writer.rs
tenant_scoped_store.rs
tool_mapper.rs
writer.rs
lunaroute-storage/
Cargo.toml
src/
atomic_writer.rs
buffer_pool.rs
compression.rs
config.rs
encryption.rs
file_lock.rs
lib.rs
rolling_writer.rs
session_index.rs
session.rs
state.rs
traits/
traits.rs
tests.rs
lunaroute-ui/
askama.toml
Cargo.toml
src/
handlers/
analytics.rs
api.rs
dashboard.rs
mod.rs
sessions.rs
settings.rs
static_files.rs
lib.rs
models.rs
pricing.rs
queries.rs
server.rs
static/
css/
style.css
js/
app.js
charts.js
stats.rs
templates/
analytics.html
base.html
dashboard.html
session_detail.html
sessions_list.html
settings.html
docs/
API_SPEC_COMPARISON.md
async-session-recording-usage.md
CLAUDE_CODE_GUIDE.md
CONNECTION_POOL_CONFIGURATION.md
CONNECTION_POOL_ENV_VARS.md
CONNECTION_POOL_TESTING.md
INGRESS_SECURITY.md
limits-alternative-routing-strategy.md
multi-tenancy-architecture.md
PHASE_11B_CODE_REVIEW.md
plans/
2025-11-14-provider-switch-notification-design.md
2025-11-14-provider-switch-notification.md
2026-04-16-codex-ws-smoke.md
prd.md
session-recording-architecture.md
session-recording-implementation.md
session-recording-jsonl-format.md
session-recording-queries.md
session-recording-summary.md
STORAGE_SECURITY.md
streaming-metrics.md
superpowers/
plans/
2026-04-03-cross-dialect-marker-routing.md
2026-04-03-lunaroute-marker-routing.md
2026-04-16-codex-websocket-responses.md
2026-07-01-http-body-hardening.md
2026-07-01-session-recording-correctness.md
2026-07-02-retry-rate-limit-consistency.md
2026-07-03-secrets-logging-hygiene.md
specs/
2026-04-03-cross-dialect-marker-routing-design.md
2026-04-03-lunaroute-marker-routing-design.md
2026-04-16-codex-websocket-responses-design.md
2026-07-01-http-body-hardening-design.md
2026-07-01-session-recording-correctness-design.md
2026-07-02-retry-rate-limit-consistency-design.md
2026-07-03-secrets-logging-hygiene-design.md
tech-prd.md
TEST_COVERAGE_ANALYSIS.md
TEST_SESSION_RECORDING.md
TOOL_FAILURE_DETECTION.md
examples/
Cargo.toml
configs/
anthropic-proxy.yaml
bypass-disabled.yaml
bypass-enabled-default.yaml
bypass-explicit-provider.yaml
claude-code-proxy-with-recording.yaml
claude-code-proxy.yaml
connection-pool-example.yaml
development.yaml
dual-dialect-passthrough.yaml
openai-proxy-with-recording.yaml
openai-proxy.yaml
private/
eran.yaml
production.yaml
provider-switch-notification.yaml
README.md
routing-strategies.yaml
cuda_check.rs
cuda_test.rs
CUDA_WORKING.md
LIBTORCH_VERIFICATION.md
test_torch
test_torch.cpp
verify_libtorch_cuda.sh
LICENSE
Makefile
README.md
release.sh
rustfmt.toml
scripts/
pre-commit
test_proxy.sh
TODO.md
tools/
backfill-sqlite/
Cargo.toml
main.rsFAQ
lunaroute is a Claude Code plugin with hand-picked skills for development work, indexed on Flowy. Install it with the command on its page. Its skills do not fire on their own yet. Request auto-invocation to have Flowy route them as you prompt. Free and open source.