omniroute-pi-ext-integration

内容来源:README.md(说明文档) · 原始地址 · 查看安装指南

原始内容

omniroute-agent-extension

npm version npm downloads

OmniRoute extension for Pi Coding Agent (pi) and Oh My Pi (omp).

Connect to your local or remote OmniRoute server and route queries across 44+ LLM providers directly from your agent CLI.

Features

  • Wizard-based setup/omni setup inside pi or omp. No manual JSON editing.
  • Dual CLI support — one package, identical feature set for both pi and omp.
  • Model sync — push all OmniRoute models into the Ctrl+P / /model picker with full metadata: context windows, max tokens, reasoning, and vision capabilities.
  • Native tool calls — the host's built-in openai-completions handler runs every request, so you get real SSE streaming and native tool_calls for all models.
  • Smart sorting — models grouped by provider prefix, auto-routing models (auto, auto/coding, etc.) always first.
  • Health monitoring — periodic reachability checks with status bar indicators.
  • Env overridesOMNIROUTE_URL, OMNIROUTE_API_KEY, OMNIROUTE_PROVIDER_NAME skip the setup wizard entirely.

Installation

Oh My Pi:

omp install omniroute-agent-extension
omp install git:github.com/md-riaz/omniroute-agent-extension

Pi Coding Agent:

pi install omniroute-agent-extension
pi install git:github.com/md-riaz/omniroute-agent-extension

Getting Started

  1. Start your CLI (pi or omp)
  2. Run /omni setup — enter your OmniRoute server URL and API key
  3. Run /omni sync — populates the Ctrl+P / /model picker
  4. Select any model with /model and start chatting

Config is saved to:

CLI Config path
omp ~/.omp/agent/omniroute-agent-extension/config.json
pi ~/.pi/agent/omniroute-agent-extension/config.json

Synced models are written to ~/.omp/agent/models.json (or ~/.pi/agent/models.json) and reloaded on startup without a network call.

Commands

Command Description
/omni Server health and provider status
/omni setup Configure server URL and API key interactively
/omni sync Fetch /v1/models and register models in the picker
/omni models [search] Browse synced models with optional keyword filter
/omni test <model> Smoke-test /v1/chat/completions with a specific model
/omni dashboard Show the OmniRoute dashboard URL
/omni config Show config and models.json paths with current settings
/omni help Show command list

Agent Tools

Two tools the LLM can call directly:

  • omniroute_status — returns server reachability, config path, and provider name
  • omniroute_sync — fetches /v1/models and re-registers the provider (same as /omni sync)

How It Works

The extension registers OmniRoute as an openai-completions provider. After /omni sync, all models appear in the picker. Every request is handled natively by the host's built-in openai-completions handler — real SSE streaming, native tool_calls, no middleware.

agent
  -> /model codex/gpt-5.2
  -> OmniRoute /v1/chat/completions (SSE stream)
  -> token-by-token output, native tool_calls
  -> agent executes tools

Auto Models

These virtual model IDs are always prepended to the synced list. OmniRoute resolves them server-side to the best available model for each intent:

auto         auto/coding    auto/fast
auto/cheap   auto/offline   auto/smart   auto/lkgp

Environment Variables

Variable Description
OMNIROUTE_URL OmniRoute server base URL
OMNIROUTE_API_KEY API key
OMNIROUTE_PROVIDER_NAME Provider name shown in the picker (default: omni)

When any of these are set, /omni setup is not required.

Development

npm run typecheck   # tsc — zero errors expected
npm run smoke       # import check for omp.ts and pi.ts
File Purpose
shared.ts All business logic — no host package imports; works in both pi and omp
omp.ts Oh My Pi entry point — OMP_HOME / ~/.omp/agent
pi.ts Pi Coding Agent entry point — PI_HOME / ~/.pi/agent

Requirements

License

MIT