antron-model-router 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. antron_model_router-0.1.0/.gitignore +9 -0
  2. antron_model_router-0.1.0/LICENSE +21 -0
  3. antron_model_router-0.1.0/PKG-INFO +111 -0
  4. antron_model_router-0.1.0/README.md +74 -0
  5. antron_model_router-0.1.0/pyproject.toml +49 -0
  6. antron_model_router-0.1.0/src/model_router/__init__.py +3 -0
  7. antron_model_router-0.1.0/src/model_router/demo.py +1165 -0
  8. antron_model_router-0.1.0/src/model_router/interfaces/README.md +7 -0
  9. antron_model_router-0.1.0/src/model_router/interfaces/__init__.py +70 -0
  10. antron_model_router-0.1.0/src/model_router/interfaces/anthropic_interface.py +356 -0
  11. antron_model_router-0.1.0/src/model_router/interfaces/dummy_interface.py +95 -0
  12. antron_model_router-0.1.0/src/model_router/interfaces/elevenlabs_sfx_interface.py +159 -0
  13. antron_model_router-0.1.0/src/model_router/interfaces/elevenlabs_tts_interface.py +320 -0
  14. antron_model_router-0.1.0/src/model_router/interfaces/gemini_interface.py +724 -0
  15. antron_model_router-0.1.0/src/model_router/interfaces/openai_interface.py +386 -0
  16. antron_model_router-0.1.0/src/model_router/interfaces/qwen_vl_interface.py +47 -0
  17. antron_model_router-0.1.0/src/model_router/interfaces/replicate_interface.py +17 -0
  18. antron_model_router-0.1.0/src/model_router/interfaces/runware_interface.py +903 -0
  19. antron_model_router-0.1.0/src/model_router/interfaces/sam_interface.py +87 -0
  20. antron_model_router-0.1.0/src/model_router/interfaces/together_interface.py +299 -0
  21. antron_model_router-0.1.0/src/model_router/interfaces/tripo_interface.py +345 -0
  22. antron_model_router-0.1.0/src/model_router/interfaces/tripo_interface_test.py +151 -0
  23. antron_model_router-0.1.0/src/model_router/lib/__init__.py +1 -0
  24. antron_model_router-0.1.0/src/model_router/lib/api_keys.py +15 -0
  25. antron_model_router-0.1.0/src/model_router/lib/constants.py +29 -0
  26. antron_model_router-0.1.0/src/model_router/lib/cost_tracker.py +67 -0
  27. antron_model_router-0.1.0/src/model_router/lib/image_ops_test.py +87 -0
  28. antron_model_router-0.1.0/src/model_router/lib/media.py +327 -0
  29. antron_model_router-0.1.0/src/model_router/lib/output_formatting.py +165 -0
  30. antron_model_router-0.1.0/src/model_router/lib/pricing.py +80 -0
  31. antron_model_router-0.1.0/src/model_router/lib/prompt_formatter.py +179 -0
  32. antron_model_router-0.1.0/src/model_router/lib/prompt_formatter_test.py +529 -0
  33. antron_model_router-0.1.0/src/model_router/lib/retry.py +108 -0
  34. antron_model_router-0.1.0/src/model_router/model_interface.py +93 -0
  35. antron_model_router-0.1.0/src/model_router/models/__init__.py +0 -0
  36. antron_model_router-0.1.0/src/model_router/models/qwen_vl.py +128 -0
  37. antron_model_router-0.1.0/src/model_router/models/sam.py +146 -0
  38. antron_model_router-0.1.0/src/model_router/query.py +321 -0
  39. antron_model_router-0.1.0/src/model_router/resources/test_image_encoding.jpg +0 -0
  40. antron_model_router-0.1.0/src/model_router/resources/test_inpaint_image.png +0 -0
  41. antron_model_router-0.1.0/src/model_router/resources/test_style_reference.png +0 -0
  42. antron_model_router-0.1.0/src/model_router/resources/test_style_transfer_base.png +0 -0
  43. antron_model_router-0.1.0/src/model_router/router.py +166 -0
  44. antron_model_router-0.1.0/src/model_router/scaffold/__init__.py +10 -0
  45. antron_model_router-0.1.0/src/model_router/scaffold/image_generation_interface.py +90 -0
  46. antron_model_router-0.1.0/src/model_router/scaffold/local_interface.py +72 -0
  47. antron_model_router-0.1.0/src/model_router/scaffold/model_base.py +53 -0
  48. antron_model_router-0.1.0/uv.lock +2421 -0
@@ -0,0 +1,9 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ .venv/
4
+ dist/
5
+ build/
6
+ *.egg-info/
7
+ .pytest_cache/
8
+ pretrained_models/
9
+ .env
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Antron, Inc.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,111 @@
1
+ Metadata-Version: 2.5
2
+ Name: antron-model-router
3
+ Version: 0.1.0
4
+ Summary: A single interface for routing text, vision, image, audio, and video queries across model providers (Anthropic, OpenAI, Gemini, Together, Runware, ElevenLabs, Tripo) and local models.
5
+ Project-URL: Repository, https://github.com/antronai/model-router
6
+ Author: Antron, Inc.
7
+ License-Expression: MIT
8
+ License-File: LICENSE
9
+ Classifier: Operating System :: OS Independent
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
12
+ Requires-Python: >=3.11
13
+ Requires-Dist: anthropic
14
+ Requires-Dist: elevenlabs
15
+ Requires-Dist: google-genai
16
+ Requires-Dist: json-repair
17
+ Requires-Dist: numpy
18
+ Requires-Dist: openai
19
+ Requires-Dist: pillow
20
+ Requires-Dist: requests
21
+ Requires-Dist: runware
22
+ Requires-Dist: tenacity
23
+ Requires-Dist: together
24
+ Provides-Extra: local
25
+ Requires-Dist: qwen-vl-utils; extra == 'local'
26
+ Requires-Dist: sam3; extra == 'local'
27
+ Requires-Dist: torch; extra == 'local'
28
+ Requires-Dist: transformers>=4.51.3; extra == 'local'
29
+ Provides-Extra: qwen
30
+ Requires-Dist: qwen-vl-utils; extra == 'qwen'
31
+ Requires-Dist: torch; extra == 'qwen'
32
+ Requires-Dist: transformers>=4.51.3; extra == 'qwen'
33
+ Provides-Extra: sam
34
+ Requires-Dist: sam3; extra == 'sam'
35
+ Requires-Dist: torch; extra == 'sam'
36
+ Description-Content-Type: text/markdown
37
+
38
+ # model-router
39
+
40
+ 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).
41
+
42
+ ## Install
43
+
44
+ ```bash
45
+ uv add antron-model-router
46
+ # with local models
47
+ uv add "antron-model-router[local]" # or [qwen] / [sam]
48
+ ```
49
+
50
+ The import name is `model_router`.
51
+
52
+ ## Usage
53
+
54
+ ```python
55
+ from model_router.router import ModelRouter
56
+ from model_router.model_interface import Capability
57
+ from model_router.query import Query
58
+
59
+ router = ModelRouter()
60
+ response = router.get_response(
61
+ query=Query(query_text="Hello!"),
62
+ capability=Capability.TEXT,
63
+ interface_type="anthropic_sonnet45", # or None to let the router choose
64
+ )
65
+ ```
66
+
67
+ See `src/model_router/demo.py` (`python -m model_router.demo`) for an interactive tour of every interface.
68
+
69
+ ## API keys
70
+
71
+ Keys are read from environment variables when an interface is first used:
72
+
73
+ | Provider | Variable |
74
+ |------------|----------------------|
75
+ | Anthropic | `ANTHROPIC_API_KEY` |
76
+ | OpenAI | `OPENAI_API_KEY` |
77
+ | Gemini | `GEMINI_API_KEY` |
78
+ | Together | `TOGETHER_API_KEY` |
79
+ | Runware | `RUNWARE_API_KEY` |
80
+ | ElevenLabs | `ELEVENLABS_API_KEY` |
81
+ | Tripo | `TRIPO_API_KEY` |
82
+
83
+ ## Mesh generation
84
+
85
+ `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):
86
+
87
+ ```python
88
+ from model_router.model_interface import Capability, MeshGenQuery
89
+
90
+ response = router.get_response(
91
+ query=MeshGenQuery(images={"front": "front.png", "right": "right.png"}, texture=True, pbr=True),
92
+ capability=Capability.MESH_GEN,
93
+ interface_type=None,
94
+ )
95
+ glb_url = response["output"]["model_url"]
96
+ ```
97
+
98
+ ## Local models
99
+
100
+ 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`).
101
+
102
+ ## Development
103
+
104
+ ```bash
105
+ uv sync
106
+ uv run pytest
107
+ ```
108
+
109
+ ## License
110
+
111
+ MIT
@@ -0,0 +1,74 @@
1
+ # model-router
2
+
3
+ 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).
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ uv add antron-model-router
9
+ # with local models
10
+ uv add "antron-model-router[local]" # or [qwen] / [sam]
11
+ ```
12
+
13
+ The import name is `model_router`.
14
+
15
+ ## Usage
16
+
17
+ ```python
18
+ from model_router.router import ModelRouter
19
+ from model_router.model_interface import Capability
20
+ from model_router.query import Query
21
+
22
+ router = ModelRouter()
23
+ response = router.get_response(
24
+ query=Query(query_text="Hello!"),
25
+ capability=Capability.TEXT,
26
+ interface_type="anthropic_sonnet45", # or None to let the router choose
27
+ )
28
+ ```
29
+
30
+ See `src/model_router/demo.py` (`python -m model_router.demo`) for an interactive tour of every interface.
31
+
32
+ ## API keys
33
+
34
+ Keys are read from environment variables when an interface is first used:
35
+
36
+ | Provider | Variable |
37
+ |------------|----------------------|
38
+ | Anthropic | `ANTHROPIC_API_KEY` |
39
+ | OpenAI | `OPENAI_API_KEY` |
40
+ | Gemini | `GEMINI_API_KEY` |
41
+ | Together | `TOGETHER_API_KEY` |
42
+ | Runware | `RUNWARE_API_KEY` |
43
+ | ElevenLabs | `ELEVENLABS_API_KEY` |
44
+ | Tripo | `TRIPO_API_KEY` |
45
+
46
+ ## Mesh generation
47
+
48
+ `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):
49
+
50
+ ```python
51
+ from model_router.model_interface import Capability, MeshGenQuery
52
+
53
+ response = router.get_response(
54
+ query=MeshGenQuery(images={"front": "front.png", "right": "right.png"}, texture=True, pbr=True),
55
+ capability=Capability.MESH_GEN,
56
+ interface_type=None,
57
+ )
58
+ glb_url = response["output"]["model_url"]
59
+ ```
60
+
61
+ ## Local models
62
+
63
+ 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`).
64
+
65
+ ## Development
66
+
67
+ ```bash
68
+ uv sync
69
+ uv run pytest
70
+ ```
71
+
72
+ ## License
73
+
74
+ MIT
@@ -0,0 +1,49 @@
1
+ [project]
2
+ name = "antron-model-router"
3
+ version = "0.1.0"
4
+ description = "A single interface for routing text, vision, image, audio, and video queries across model providers (Anthropic, OpenAI, Gemini, Together, Runware, ElevenLabs, Tripo) and local models."
5
+ readme = "README.md"
6
+ license = "MIT"
7
+ license-files = ["LICENSE"]
8
+ authors = [{ name = "Antron, Inc." }]
9
+ requires-python = ">=3.11"
10
+ classifiers = [
11
+ "Programming Language :: Python :: 3",
12
+ "Operating System :: OS Independent",
13
+ "Topic :: Scientific/Engineering :: Artificial Intelligence",
14
+ ]
15
+ dependencies = [
16
+ "anthropic",
17
+ "elevenlabs",
18
+ "google-genai",
19
+ "json-repair",
20
+ "numpy",
21
+ "openai",
22
+ "Pillow",
23
+ "requests",
24
+ "runware",
25
+ "tenacity",
26
+ "together",
27
+ ]
28
+
29
+ [project.optional-dependencies]
30
+ qwen = ["torch", "transformers>=4.51.3", "qwen-vl-utils"]
31
+ sam = ["torch", "sam3"]
32
+ local = ["antron-model-router[qwen,sam]"]
33
+
34
+ [project.urls]
35
+ Repository = "https://github.com/antronai/model-router"
36
+
37
+ [build-system]
38
+ requires = ["hatchling"]
39
+ build-backend = "hatchling.build"
40
+
41
+ [tool.hatch.build.targets.wheel]
42
+ packages = ["src/model_router"]
43
+
44
+ [dependency-groups]
45
+ dev = ["pytest"]
46
+
47
+ [tool.pytest.ini_options]
48
+ testpaths = ["src"]
49
+ python_files = ["*_test.py"]
@@ -0,0 +1,3 @@
1
+ # Copyright (c) 2026 Antron, Inc. Licensed under the MIT License.
2
+
3
+ """Model router package for AI model interfaces."""