Skip to main content

model-router

A single interface for sending text, vision, image, audio, and video queries to many model providers (Anthropic, OpenAI, Gemini, Together, Runware, ElevenLabs, Tripo), plus local models (Qwen2.5-VL, SAM 3).

Install

uv add antron-model-router
# with local models
uv add "antron-model-router[local]"   # or [qwen] / [sam]

The import name is model_router.

Usage

from model_router.router import ModelRouter
from model_router.model_interface import Capability
from model_router.query import Query

router = ModelRouter()
response = router.get_response(
    query=Query(query_text="Hello!"),
    capability=Capability.TEXT,
    interface_type="anthropic_sonnet45",  # or None to let the router choose
)

See src/model_router/demo.py (python -m model_router.demo) for an interactive tour of every interface.

API keys

Keys are read from environment variables when an interface is first used:

Provider Variable
Anthropic ANTHROPIC_API_KEY
OpenAI OPENAI_API_KEY
Gemini GEMINI_API_KEY
Together TOGETHER_API_KEY
Runware RUNWARE_API_KEY
ElevenLabs ELEVENLABS_API_KEY
Tripo TRIPO_API_KEY

Mesh generation

Capability.MESH_GEN routes to Tripo H3.1 (tripo_h31) by default. Pass a MeshGenQuery with text only (text-to-mesh), one image (image-to-mesh), or front/left/back/right views (multiview):

from model_router.model_interface import Capability, MeshGenQuery

response = router.get_response(
    query=MeshGenQuery(images={"front": "front.png", "right": "right.png"}, texture=True, pbr=True),
    capability=Capability.MESH_GEN,
    interface_type=None,
)
glb_url = response["output"]["model_url"]

Local models

SAM 3 looks for sam3.pt in $MODEL_ROUTER_PRETRAINED_DIR/sam3 (default ./pretrained_models/sam3), otherwise it downloads from HuggingFace (facebook/sam3, gated — run hf auth login).

Development

uv sync
uv run pytest

License

MIT

Release files for antron-model-router 0.1.0

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

Source distribution (sdist)

Source distribution for antron-model-router 0.1.0
File Size Uploaded
antron_model_router-0.1.0.tar.gz 3.3 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for antron-model-router 0.1.0
File Interpreter ABI Platform
antron_model_router-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 6.6 MB

Release files / antron_model_router-0.1.0.tar.gz

Download URL antron_model_router-0.1.0.tar.gz
Size 3.3 MB
Tags Source
SHA-256 checksum
How to use checksums
ecd1dbf495c746fa59c1d660fae52e2e91767a0469a5e730da95c93ab4825c83
BLAKE2b-256 checksum
How to use checksums
c04ddcab163177d294c20cc36558941e78fcb7e9406f7414453daa550cd3c51a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.3 {"installer":{"name":"uv","version":"0.11.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / antron_model_router-0.1.0-py3-none-any.whl

Download URL antron_model_router-0.1.0-py3-none-any.whl
Size 3.2 MB
Tags Python 3
SHA-256 checksum
How to use checksums
33ff9b39d2d804ddcc6c355848b1677c8059087624c7aedaa0f4ca4041f30ade
BLAKE2b-256 checksum
How to use checksums
92dddb6074bc71379a381e47d819d00c4d5bdffcec9d271e041c8f1051e9dc83
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.3 {"installer":{"name":"uv","version":"0.11.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

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