Skip to main content

Router-Maestro

CI Release PyPI

Use the full GitHub Copilot model catalog from Claude Code, OpenAI Codex, Gemini CLI, and any OpenAI-, Anthropic-, or Gemini-compatible client.

Router-Maestro is a local or self-hosted model gateway. It separates the client protocol from the upstream model transport, so a client is no longer limited to models that natively speak its API. Claude Code can use Responses-only GPT models; Codex can use Claude, Gemini, Grok, and MAI models; Gemini CLI can use the same catalog through its native API surface.

https://github.com/user-attachments/assets/35f7c0f5-967a-4f93-aec8-c34b460a0032

Why Router-Maestro

  • One Copilot subscription, every compatible client. Authenticate once with GitHub Copilot and expose its live catalog—including GPT, Claude, Gemini, Grok, and MAI—to Claude Code, Codex, Gemini CLI, DeepSeek Harness, and API clients.
  • Protocol-independent routing. Anthropic Messages, OpenAI Chat Completions, OpenAI Responses, and Gemini generation enter one dispatcher; providers choose the best Messages, Chat, or Responses upstream transport.
  • Native fast paths, translation only when needed. Matching protocols use a copy-on-write identity path. Cross-protocol attempts lazily materialize a typed semantic representation and stream events without buffering the full response.
  • Tools, streaming, reasoning, and long context. Router-Maestro preserves tool calls/results, structured output, usage, terminal outcomes, and reasoning continuation across supported protocol boundaries. Live catalog metadata advertises context choices such as 272K / 1M to clients.
  • A real Auto model. The virtual router-maestro model can classify work into Fast, General, Coding, or Deep Reasoning tasks, or follow a strict priority chain. Capability and context-window filtering happen before the model is selected.
  • Configuration for humans and agents. Use searchable CLI wizards or the loopback-only visual portal to manage contexts, models, context windows, client configuration, trusted projects, and Auto routing.
  • Self-hosted control. Run locally, in Docker, or behind HTTPS. Prometheus metrics, request IDs, stream guards, and opt-in audit traces support production diagnosis without sending routing control to a hosted portal.

Supported Surface

Clients and ingress protocols

Client or API consumer Router-Maestro surface Full Copilot catalog
Claude Code / Anthropic SDK Anthropic Messages Yes, including Responses-only GPT models
OpenAI Codex / OpenAI SDK OpenAI Responses Yes, including Claude, Gemini, Grok, and MAI
DeepSeek Harness (DSH) OpenAI Responses Yes, with generated context and reasoning metadata
OpenAI-compatible clients Chat Completions Yes, subject to feature representability
Gemini CLI / Gemini SDK Gemini generateContent Yes, across available upstream transports

Providers

Provider Authentication Upstream transports
GitHub Copilot OAuth device flow Messages, Chat, Responses as advertised by each model
OpenAI API key Chat Completions and native Responses
Anthropic API key Anthropic Messages
DeepSeek API key Native Messages, Chat, Responses, and Files; Gemini converts to Chat
Custom OpenAI-compatible API key, environment key, or explicit anonymous mode Chat Completions; optional native Responses

Unsupported cross-protocol fields fail explicitly before provider I/O rather than being silently dropped.

How It Works

flowchart LR
    C[Claude Code / Codex / Gemini / SDK] --> P[Protocol runtime]
    P --> R[Model and Auto routing]
    R --> H[Provider handler]
    H --> T{Best upstream transport}
    T -->|same protocol| I[Identity fast path]
    T -->|cross protocol| S[Lazy semantic translation]
    I --> U[Provider model]
    S --> U

Providers own their catalog, authentication, endpoint bindings, and provider contracts. A shared transport policy defines default protocol preferences; compatibility paths and failure recovery are explicit opt-ins. Routing selects a model; the handler selects how to call it. Model fallback is independent of transport fallback and runs only after an eligible upstream failure. The Provider Plugins registry also mounts provider resource endpoints such as Files without hardcoding them in the application.

Five-Minute Local Start

Prerequisites:

  • uv or another Python 3.14 package installer
  • an active GitHub Copilot subscription for Copilot-backed models

Install the CLI and server:

uv tool install --python 3.14 router-maestro

Start Router-Maestro in one terminal:

router-maestro server start

The first start creates a local context and a sk-rm-... server API key. In a second terminal, authenticate and open the visual configurator:

router-maestro auth login github-copilot
router-maestro web

Or configure a client from the terminal:

router-maestro config claude-code
router-maestro config codex
router-maestro config gemini
router-maestro config dsh

The wizard reads the active server's live model catalog, lets you choose the model and context window, and previews or backs up the target configuration. For Codex it can also refresh router-maestro-models.json, so custom model metadata is available when the next Codex session starts. DSH configuration updates its Router-Maestro provider catalog in ~/.dsh/settings.yaml while preserving unrelated Harness settings.

Verify the server and catalog:

curl http://localhost:8080/health
router-maestro model list

For Docker, a VPS, HTTPS, upgrades, and rollback, follow the Deployment Guide. For all client and provider choices, follow the Configuration Guide. Both guides include prompts that can be pasted directly into an AI coding agent.

To delegate the work, start at AI-assisted deployment or AI-assisted client configuration.

Router-Maestro Auto

Select the virtual model ID router-maestro to enable server-side automatic routing. New configurations default to Smart Auto:

  1. A configured router model classifies the request as fast, general, coding, or deep_reasoning.
  2. The corresponding configured task model becomes the first candidate.
  3. Capability requirements and the estimated input size filter unsafe models. Router-Maestro normally keeps candidates below 70% of their advertised prompt capacity to leave room for tokenizer and protocol differences.
  4. If no model satisfies that safety margin, all configured models tied for the largest hard-compatible context window remain eligible.
  5. A precise upstream context-overflow response may retry a larger configured model before the first response frame; committed streams are never replayed.

Priority Chain mode is available when deterministic ordering is preferred. Its configured fallback chain must not be empty.

Configure either mode with:

router-maestro model auto configure
# or
router-maestro web

See Auto routing and client configuration for policy details.

Stable API Endpoints

New integrations should use the stable paths:

API Endpoint
OpenAI Chat Completions /api/openai/v1/chat/completions
OpenAI Responses /api/openai/v1/responses
OpenAI model list /api/openai/v1/models
Anthropic Messages /api/anthropic/v1/messages
Anthropic token count /api/anthropic/v1/messages/count_tokens
Gemini generation /api/gemini/v1beta/models/{model}:generateContent
Gemini streaming /api/gemini/v1beta/models/{model}:streamGenerateContent

0.9 to 1.0 endpoint migration

0.9 is the final minor release before 1.0. The following Router-Maestro beta aliases remain available only for the 0.9 migration window and will be removed in 1.0.0:

Deprecated 0.9 compatibility alias Stable replacement
/api/openai/beta/v1/responses /api/openai/v1/responses
/api/anthropic/beta/v1/messages /api/anthropic/v1/messages
/api/anthropic/beta/v1/messages/count_tokens /api/anthropic/v1/messages/count_tokens

Move client configuration to the stable paths before upgrading to 1.0.0. /api/gemini/v1beta is the Gemini protocol version, not a Router-Maestro beta route, and is not part of this removal.

Authenticated inference and administration use the same Router-Maestro server API key. /health is public. /metrics is public unless a separate metrics token is configured. Treat the server key as both inference and configuration authority.

Documentation

Use and operations

  • Configuration Guide — contexts, providers, CLI and Web configuration, Claude Code, Codex, Gemini CLI, Auto, and AI-agent prompts
  • Deployment Guide — native, Docker, VPS, Traefik/HTTPS, upgrades, rollback, multi-instance keys, and AI-agent prompts
  • Metrics and Observability — Prometheus metrics, request IDs, terminal outcomes, audit artifacts, and troubleshooting
  • Copilot Context Limits — catalog context metadata and prompt/output budgeting
  • Tool Choice Behavior — tool-choice and finish semantics across providers

Protocol and engineering reference

Historical design records:

Project

Contributing

Contributions are welcome. Start with CONTRIBUTING.md, which includes the required offline gates, live-provider test boundaries, and a safe audit workflow for protocol investigations.

License

Router-Maestro is available under the MIT License.

Metadata

Release files for router-maestro 0.9.11

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for router-maestro 0.9.11
File Size Uploaded Provenance Actions
router_maestro-0.9.11.tar.gz 1.0 MB With provenance Details for router_maestro-0.9.11.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for router-maestro 0.9.11
File Interpreter ABI Platform Actions
router_maestro-0.9.11-py3-none-any.whl Python 3 none any Details for router_maestro-0.9.11-py3-none-any.whl

Total release size: 1.5 MB

Release files / router_maestro-0.9.11.tar.gz

Download URL router_maestro-0.9.11.tar.gz
Size 1.0 MB
Tags Source
SHA-256 checksum
How to use checksums
caee2bd8320a60b6a536509349636dc7b3ebc449cf55158e5f4b3d6d2e2862e0
BLAKE2b-256 checksum
How to use checksums
3d850ac12b063a4dea78698aff67ecc45ec3b94578a3ce0ea1f0782955881304
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 14, 2026.

Transparency log

Release files / router_maestro-0.9.11-py3-none-any.whl

Download URL router_maestro-0.9.11-py3-none-any.whl
Size 495.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
79b254e9649cf7ffee0951b2744c1ddb6e79211ebe41a6e70f82de01503aff66
BLAKE2b-256 checksum
How to use checksums
31cf1fb8ece1a74a261567a4fe4147eeab8cdacf0331e7c1282eb759f227a85a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 14, 2026.

Transparency log

Security for router-maestro 0.9.11

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for router_maestro-0.9.11.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 14, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.9.11 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page