Skip to content

Latest commit

 

History

6 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OmniRouter Gateway

Gateway-проект для OmniRoute: два OpenAI-совместимых прокси с dynamic tool passthrough.


Структура

omnirouter-gw/
  config/docker-compose.yml      # compose для развёртывания
  scripts/claude-gateway/        # claude-gateway + codex-gateway (исходники)
  deploy.sh                      # скрипт деплоя
  deploy.env.example             # шаблон конфига деплоя (скопировать в deploy.env)
  deploy.env                     # локальный конфиг деплоя (в .gitignore)

Gateways

Gateway Port Описание
codex-gateway 20132 Codex App Server bridge (codex app-server --stdio → codex.sale) с dynamicTools passthrough
claude-gateway 20130 Claude CLI bridge (stream-json с tool_use passthrough)

Оба gateway запускаются как sidecar внутри контейнера OmniRoute (см. config/docker-compose.yml).


Docker Compose

Файл: config/docker-compose.yml

Auto-start sidecars (entrypoint):

  • npm install -g @anthropic-ai/claude-code
  • npm install -g @openai/codex
  • claude-gateway на 20130 (Claude Code CLI subprocess)
  • codex-gateway на 20132 (прокси к codex.sale)

Restart:

ssh $HOST 'cd /path/to/omniroute && docker compose restart omniroute'

Deploy (one-time setup):

cp deploy.env.example deploy.env
# Edit deploy.env — set GW_HOST and GW_SSH_KEY

Deploy (every time):

bash deploy.sh

Script does: tests → scp → docker compose restart → smoke test.

Tests:

cd scripts/claude-gateway && npm test

Codex Sale Gateway (cdslgw)

Prefix: cdslgw

Cursor → OmniRoute → codex-gateway → codex app-server --stdio → codex.sale
                                    ↑ dynamicTools passthrough
                                    (tools execute in Cursor, NOT on server)

Codex CLI config:

  • Provider: https://codex.sale/backend-api/codex (wire_api = responses)
  • Ключ: CODEX_LB_API_KEY из Docker secret
  • Файлы: $CODEX_HOME/.codex/auth.json + config.toml (авто-генерация при старте)

Modes (CODEX_GATEWAY_MODE):

  • app-server — App Server bridge с dynamicTools (default)
  • http — прямой HTTP proxy с hollow-response retry

Требования: @openai/codex CLI (устанавливается в entrypoint).


Claude Code Gateway (claude)

Prefix: claude

Cursor → OmniRoute → claude-gateway → claude -p --output-format stream-json → vibecode
                                    ↑ tool_use passthrough
                                    (tools execute in Cursor, NOT on server)

Tool mapping (Claude → Cursor):

Claude Cursor
Write Write
Bash Shell
Read Read
Edit StrReplace
Glob Glob
Grep Grep

Modes (CLAUDE_GATEWAY_MODE):

  • bridge — stream-json с tool_use passthrough (default)
  • legacy — plain claude -p text-only

Требования: @anthropic-ai/claude-code CLI (устанавливается в entrypoint).


Verified (2026-06-15)

  • codex app-server --stdio работает с codex.sale backend
  • Tool call (Write) через dynamicTools: Write {"path":"/tmp/hello.txt","contents":"world\n"}
  • Claude stream-json tool_use: Write, Bash, Read, Edit, Glob
  • 88/88 unit tests passing
  • HTTP fallback mode (hollow retry + sanitization)

About

Gateway proxy for Codex CLI and Claude Code CLI working with OmniRouter

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages