Skip to content

Repository files navigation

yu-gateway

English | 日本語

headroom(litellmベースのproxy)の個人用代替。長時間稼働してもメモリが際限なく増えない、薄いOpenAI/Anthropic互換LLM proxy。

できること(概要)

  • OpenAI Chat Completions / Responses、Anthropic Messages API、Codex Realtime WebSocket の proxy
  • streaming の透過中継、使用量・費用・rate limit・進行状況の dashboard / fleet 可視化
  • opt-in の圧縮・画像最適化・workflow tag 注入・memory 連携・privacy / security controls
  • 同時実行数、body サイズ、idle timeout、費用の上限と SQLite メタデータ記録(prompt/response本文は既定で保存しない)

機能の全一覧、目的別の選び方、AI に設定を依頼するための案内は docs/capabilities.md を参照してください。

使い方

どの構成を選ぶか

構成 向く人 テンプレート
minimal まず proxy と基本記録だけを使う single-port-minimal.example.toml
recommended 通常の単一 client / upstream 運用 single-port-recommended.example.toml
fleet-debug Claude / Codex / Grok を別 port・別 DB で観測したい docs/config-templates/ の role 別 template

通常は recommended から始めてください。compression、画像処理、prompt injection、body capture、ONNX は入っていないため、基本の転送経路を確認してから必要なものだけ追加できます。minimal を含む全 profile は upstream の prompt cache を透過するので、cache 利用のために重い feature を有効化する必要はありません。

単ポート(普通の1プロセス)

cp docs/config-templates/single-port-recommended.example.toml ~/.config/yu-gateway/config.toml
# upstream URL / credential env を設定
cargo run -p yu-gateway-server -- serve --config ~/.config/yu-gateway/config.toml

マルチポート fleet(Claude/Codex/Grok + 綜合 dashboard)

ポート ↔ 設定 ↔ unit の SSOT: docs/ports-and-configs.md

./scripts/install-user-systemd.sh   # バイナリ + units + ~/.config/yu-gateway/* を用意
./scripts/fleet-up.sh
./scripts/fleet-status.sh
./scripts/doctor.sh                 # 設定・unit・ポート健康診断(または yu-gateway doctor)
ポート 役割 設定(ホーム)
9999 Claude ~/.config/yu-gateway/claude-9999.toml
9997 Codex ~/.config/yu-gateway/codex-9997.toml
9998 Grok ~/.config/yu-gateway/grok-9998.toml
10000 Fleet UI ~/.config/yu-gateway/fleet.toml

Fleet: http://127.0.0.1:10000/ (User Session/Historical · Debug)
Instance: http://127.0.0.1:9999/dashboard (単体も同品質の Session/Historical)
JSON: fleet /json · /json/debug · /metrics / instance /dashboard/data

永続運用(systemd 登録・boot 起動・redeploy)

単一プロセスを systemd user service として常駐させる手順、boot 起動(linger)、コード更新後の redeploy、そして AI に丸ごとやらせるためのコピペ用プロンプトdocs/deployment.md にまとめてあります。単一ポートが推奨で、4 ポート fleet は上級者向けです。

ドキュメント

  • docs/deployment.mdデプロイ手順(単一ポート推奨 / 4ポートfleet / systemd登録 / redeploy / AI用プロンプト)

  • docs/capabilities.md人間向け機能カタログ(何ができるか・用途別の選び方・AIへの設定依頼)

  • docs/config-templates/用途別の設定テンプレート(minimal / recommended / fleet-debug)

  • docs/ai-reference.yamlAI向け機能・設定カタログ(正確な既定値・opt-in条件・信頼境界)

  • docs/ports-and-configs.mdマルチポート設定の正本(AI向け)

  • docs/debug-tab.mdDebug タブの詳細な使い方(hard_guard / unmatched / Grok 調査など)

開発

scripts/verify.sh   # fmt --check && clippy && test

License

Licensed under either of

at your option.

About

Thin, memory-bounded OpenAI/Anthropic-compatible LLM reverse proxy in Rust — transparent streaming passthrough with bounded usage/cost/rate-limit observability, opt-out optimizations, and a multi-instance dashboard.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages