Router-Maestro
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, 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 / 1Mto clients. - A real Auto model. The virtual
router-maestromodel 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 |
| 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 | OpenAI-compatible transport |
| Anthropic | API key | Anthropic Messages |
| Custom OpenAI-compatible | API key, environment key, or explicit anonymous mode | Chat Completions |
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
Provider handlers own their catalog, authentication, endpoint bindings, transport preference, and provider-specific contracts. Routing selects a model; the handler selects how to call it. Model fallback begins only after the selected model's viable transports are exhausted.
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
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.
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:
- A configured router model classifies the request as
fast,general,coding, ordeep_reasoning. - The corresponding configured task model becomes the first candidate.
- 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.
- If no model satisfies that safety margin, all configured models tied for the largest hard-compatible context window remain eligible.
- 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
- API Translation and Protocol Contracts — ingress, transport bindings, semantic conversion, streaming, and error policy
- Token Calculation — context budgeting, token counting, and thinking-budget normalization
- Python 3.14 and Slim Image Design
- Python 3.14 and Slim Image Implementation Plan
Historical design records:
- Provider-bound option policy and its round-two design
- Option guard audit
- Streaming keepalive gap design
- Copilot reasoning sanitization
- Copilot token-refresh resilience
- Reasoning path consistency
- Implementation plans: option policy round one, option policy round two, reasoning sanitization, token refresh, and reasoning consistency
Project
- Contributing Guide — development setup, architecture boundaries, tests, audit tracing, live validation, and pull requests
- Changelog
- License
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.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file router_maestro-0.9.0.tar.gz.
File metadata
- Download URL: router_maestro-0.9.0.tar.gz
- Upload date:
- Size: 943.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9301c8a28288ab86953593294e049f35484c11dfe43167302f830ae3e6b02a62
|
|
| MD5 |
8e92c2ca32f6763a57fe84fd474803a6
|
|
| BLAKE2b-256 |
699704638327ba489b32be53482ba6e02fa8955fa5b945fc75711fa4b2560411
|
Provenance
The following attestation bundles were made for router_maestro-0.9.0.tar.gz:
Publisher:
release.yml on MadSkittles/Router-Maestro
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
router_maestro-0.9.0.tar.gz -
Subject digest:
9301c8a28288ab86953593294e049f35484c11dfe43167302f830ae3e6b02a62 - Sigstore transparency entry: 2633935317
- Sigstore integration time:
-
Permalink:
MadSkittles/Router-Maestro@9b76880908cd7488e047a940b70bcecdf113e1f0 -
Branch / Tag:
refs/tags/v0.9.0 - Owner: https://github.com/MadSkittles
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@9b76880908cd7488e047a940b70bcecdf113e1f0 -
Trigger Event:
push
-
Statement type:
File details
Details for the file router_maestro-0.9.0-py3-none-any.whl.
File metadata
- Download URL: router_maestro-0.9.0-py3-none-any.whl
- Upload date:
- Size: 473.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2a8e8bb0cf4c95cb07436ebe42adef66e3d38a4d30694562ee0ecf44ec51efe6
|
|
| MD5 |
96017fe84bf0c8312f37d87af8f766d8
|
|
| BLAKE2b-256 |
54ae85e8e7208ccef44794dbe93359dd8a287404eea738d2ae81108a20d35e9b
|
Provenance
The following attestation bundles were made for router_maestro-0.9.0-py3-none-any.whl:
Publisher:
release.yml on MadSkittles/Router-Maestro
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
router_maestro-0.9.0-py3-none-any.whl -
Subject digest:
2a8e8bb0cf4c95cb07436ebe42adef66e3d38a4d30694562ee0ecf44ec51efe6 - Sigstore transparency entry: 2633935330
- Sigstore integration time:
-
Permalink:
MadSkittles/Router-Maestro@9b76880908cd7488e047a940b70bcecdf113e1f0 -
Branch / Tag:
refs/tags/v0.9.0 - Owner: https://github.com/MadSkittles
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@9b76880908cd7488e047a940b70bcecdf113e1f0 -
Trigger Event:
push
-
Statement type: