omp packages

@bismawy/pi-agentrouter1.6.2

AgentRouter provider for Pi: access frontier models under one namespace with self-healing WAF recovery and automatic turn translation.

bismawy Published 19 days ago MIT ~1.3K downloads/mo

Untested on omp

This is a pi package. No one has reported whether it works on omp yet. If you try it, add your result below.

Did it work for you?

Result

One report per person. A new report replaces your old one.

Reports 0

No reports yet.

Readme

AgentRouter

Unified frontier models. Self-healing WAF recovery. Zero workflow interruption.

Custom badge badge license

AgentRouter: unified frontier models and self-healing WAF recovery for Pi

Overview

pi-agentrouter provides a unified provider for AgentRouter in Pi — routing GPT-6 Astra, GPT-5.6 Sol, Claude Opus 4.8 / 5, DeepSeek V4 Flash, and GLM 5.3 under a single agentrouter/ namespace with self-healing WAF recovery.

  • Protocol Routing: GPT-6 Astra routes via OpenAI Responses, Claude models via Anthropic Messages, and others via OpenAI Completions under one provider.
  • WAF Header & Language Guard: Forces Pi's canonical system header to byte 0 and applies language framing on user turns.
  • Self-Healing Recovery: Redacts older history turns in two stages on content-filter triggers, and automatically translates the latest turn to English when needed.
  • Payload Sanitization: Strips ANSI escape codes, null bytes, control characters, and orphan Unicode surrogates before dispatch.
  • Session Affinity: Injects sendSessionAffinityHeaders: true by default to maximize server-side cache hits.

Registered Models

Model Context Input Protocol Thinking
agentrouter/gpt-6-astra 272k text, image OpenAI Responses low – xhigh
agentrouter/gpt-5.6-sol 272k text, image OpenAI Completions low – xhigh
agentrouter/claude-opus-5 200k text, image Anthropic Messages low – xhigh
agentrouter/claude-opus-4-8 200k text, image Anthropic Messages low – xhigh
agentrouter/deepseek-v4-flash 131k text OpenAI Completions low – xhigh
agentrouter/glm-5.3 131k text OpenAI Completions low – xhigh

Install

pi install npm:@bismawy/pi-agentrouter

Supply your API key via /login agentrouter, export AGENTROUTER_API_KEY="your-key", or in ~/.pi/agent/models.json.

No account yet? Register on AgentRouter for a $50 bonus.

To test locally without installing:

pi -e ./index.ts

Commands

Command Action
/agentrouter Interactive menu with Status and Usage panels
/agentrouter status View active models, status, and balance in a styled TUI panel
/agentrouter usage Inspect session usage metrics and cost estimates

Architecture

WAF Auto-Recovery Lifecycle
  1. Forces Pi's system prompt header to the very start of the payload.
  2. On content-blocked or sensitive-words errors, marks the turn retryable for automatic recovery.
  3. Stage 1 redacts older user turns; Stage 2 escalates to assistant turns while preserving tool pairs.
  4. Stage 3 translates the newest turn to English if redaction is exhausted, avoiding user turn deletion.
  5. Redaction depth resets on new conversations or compaction.
Development
npm test # Runs check-framing.ts self-checks

License

Distributed under the MIT license.

Author

Bisma