modelsaar 0.2.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.
- modelsaar-0.2.0/LICENSE +202 -0
- modelsaar-0.2.0/NOTICE +18 -0
- modelsaar-0.2.0/PKG-INFO +285 -0
- modelsaar-0.2.0/README.md +248 -0
- modelsaar-0.2.0/pyproject.toml +73 -0
- modelsaar-0.2.0/setup.cfg +4 -0
- modelsaar-0.2.0/src/modelsaar/__init__.py +13 -0
- modelsaar-0.2.0/src/modelsaar/adapters/__init__.py +27 -0
- modelsaar-0.2.0/src/modelsaar/adapters/base.py +274 -0
- modelsaar-0.2.0/src/modelsaar/adapters/ollama.py +317 -0
- modelsaar-0.2.0/src/modelsaar/adapters/openai_compat.py +296 -0
- modelsaar-0.2.0/src/modelsaar/catalogue/__init__.py +72 -0
- modelsaar-0.2.0/src/modelsaar/catalogue/starter.yaml +435 -0
- modelsaar-0.2.0/src/modelsaar/cli.py +880 -0
- modelsaar-0.2.0/src/modelsaar/clientconfig/__init__.py +364 -0
- modelsaar-0.2.0/src/modelsaar/config.py +631 -0
- modelsaar-0.2.0/src/modelsaar/doctor.py +233 -0
- modelsaar-0.2.0/src/modelsaar/evaluation/__init__.py +1 -0
- modelsaar-0.2.0/src/modelsaar/evaluation/fixtures/tasks.jsonl +47 -0
- modelsaar-0.2.0/src/modelsaar/evaluation/harness.py +768 -0
- modelsaar-0.2.0/src/modelsaar/evaluation/judge.py +173 -0
- modelsaar-0.2.0/src/modelsaar/evaluation/sandbox.py +341 -0
- modelsaar-0.2.0/src/modelsaar/evaluation/scoring.py +233 -0
- modelsaar-0.2.0/src/modelsaar/learning.py +227 -0
- modelsaar-0.2.0/src/modelsaar/lifecycle.py +208 -0
- modelsaar-0.2.0/src/modelsaar/pipelines.py +439 -0
- modelsaar-0.2.0/src/modelsaar/probes.py +526 -0
- modelsaar-0.2.0/src/modelsaar/protocol/__init__.py +1 -0
- modelsaar-0.2.0/src/modelsaar/protocol/anthropic.py +401 -0
- modelsaar-0.2.0/src/modelsaar/protocol/decisions.py +229 -0
- modelsaar-0.2.0/src/modelsaar/protocol/openai.py +322 -0
- modelsaar-0.2.0/src/modelsaar/protocol/responses.py +560 -0
- modelsaar-0.2.0/src/modelsaar/protocol/sse.py +181 -0
- modelsaar-0.2.0/src/modelsaar/registry.py +229 -0
- modelsaar-0.2.0/src/modelsaar/responses_store.py +117 -0
- modelsaar-0.2.0/src/modelsaar/routing/__init__.py +1 -0
- modelsaar-0.2.0/src/modelsaar/routing/admission.py +359 -0
- modelsaar-0.2.0/src/modelsaar/routing/affinity.py +131 -0
- modelsaar-0.2.0/src/modelsaar/routing/cascade.py +53 -0
- modelsaar-0.2.0/src/modelsaar/routing/classifier.py +298 -0
- modelsaar-0.2.0/src/modelsaar/routing/decision.py +85 -0
- modelsaar-0.2.0/src/modelsaar/routing/eligibility.py +158 -0
- modelsaar-0.2.0/src/modelsaar/routing/requirements.py +290 -0
- modelsaar-0.2.0/src/modelsaar/routing/router.py +1026 -0
- modelsaar-0.2.0/src/modelsaar/routing/scoring.py +179 -0
- modelsaar-0.2.0/src/modelsaar/routing/tokens.py +114 -0
- modelsaar-0.2.0/src/modelsaar/runtime.py +82 -0
- modelsaar-0.2.0/src/modelsaar/security.py +63 -0
- modelsaar-0.2.0/src/modelsaar/server.py +1546 -0
- modelsaar-0.2.0/src/modelsaar/static/status.html +95 -0
- modelsaar-0.2.0/src/modelsaar/store.py +208 -0
- modelsaar-0.2.0/src/modelsaar/testing/__init__.py +1 -0
- modelsaar-0.2.0/src/modelsaar/testing/fakebackend.py +661 -0
- modelsaar-0.2.0/src/modelsaar.egg-info/PKG-INFO +285 -0
- modelsaar-0.2.0/src/modelsaar.egg-info/SOURCES.txt +80 -0
- modelsaar-0.2.0/src/modelsaar.egg-info/dependency_links.txt +1 -0
- modelsaar-0.2.0/src/modelsaar.egg-info/entry_points.txt +2 -0
- modelsaar-0.2.0/src/modelsaar.egg-info/requires.txt +15 -0
- modelsaar-0.2.0/src/modelsaar.egg-info/top_level.txt +1 -0
- modelsaar-0.2.0/tests/test_acceptance.py +572 -0
- modelsaar-0.2.0/tests/test_cascade.py +137 -0
- modelsaar-0.2.0/tests/test_classifier_schema.py +89 -0
- modelsaar-0.2.0/tests/test_client_compat_odysseus.py +214 -0
- modelsaar-0.2.0/tests/test_continuation_probe.py +159 -0
- modelsaar-0.2.0/tests/test_correction_2026_10_12.py +481 -0
- modelsaar-0.2.0/tests/test_decision_classifier.py +244 -0
- modelsaar-0.2.0/tests/test_decisions_endpoint.py +374 -0
- modelsaar-0.2.0/tests/test_ensembles.py +109 -0
- modelsaar-0.2.0/tests/test_evaluation.py +730 -0
- modelsaar-0.2.0/tests/test_hardening_2026_10_11.py +806 -0
- modelsaar-0.2.0/tests/test_judge.py +92 -0
- modelsaar-0.2.0/tests/test_learning.py +139 -0
- modelsaar-0.2.0/tests/test_lifecycle.py +228 -0
- modelsaar-0.2.0/tests/test_multimodal.py +219 -0
- modelsaar-0.2.0/tests/test_ocr_layout.py +234 -0
- modelsaar-0.2.0/tests/test_pipelines.py +170 -0
- modelsaar-0.2.0/tests/test_protocol_translations.py +366 -0
- modelsaar-0.2.0/tests/test_replica_scheduling.py +124 -0
- modelsaar-0.2.0/tests/test_responses_store.py +116 -0
- modelsaar-0.2.0/tests/test_review_regressions.py +244 -0
- modelsaar-0.2.0/tests/test_tokenization_context.py +194 -0
- modelsaar-0.2.0/tests/test_units.py +233 -0
modelsaar-0.2.0/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
modelsaar-0.2.0/NOTICE
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
ModelSaar - intelligent routing for local AI models
|
|
2
|
+
Copyright 2026 Gopala Subramanium
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
5
|
+
this project except in compliance with the License. You may obtain a copy of the
|
|
6
|
+
License at http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
|
|
8
|
+
This licence covers the ModelSaar gateway source code only. It does not license
|
|
9
|
+
any model weights. Model weights referenced in the catalogue are distributed by
|
|
10
|
+
their publishers under their own terms (recorded per entry in
|
|
11
|
+
src/modelsaar/catalogue/starter.yaml and docs/catalogue.md).
|
|
12
|
+
|
|
13
|
+
Third-party runtime dependencies (installed from PyPI, not vendored):
|
|
14
|
+
starlette (BSD-3-Clause), uvicorn (BSD-3-Clause), httpx (BSD-3-Clause),
|
|
15
|
+
pydantic (MIT), PyYAML (MIT).
|
|
16
|
+
Design influences acknowledged in docs/decisions/ADR-001-build-vs-adapt.md:
|
|
17
|
+
vLLM Semantic Router (Apache-2.0), RouteLLM (Apache-2.0), LiteLLM (MIT core),
|
|
18
|
+
llama-swap (MIT). No code from these projects is included.
|
modelsaar-0.2.0/PKG-INFO
ADDED
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: modelsaar
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: ModelSaar - intelligent routing for local AI models. One OpenAI-compatible endpoint that picks the most suitable local deployment per request.
|
|
5
|
+
Author-email: Gopala Subramanium <gopalasubramanium@gmail.com>
|
|
6
|
+
License: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://modelsaar.com
|
|
8
|
+
Project-URL: Repository, https://github.com/gopalasubramanium/modelsaar
|
|
9
|
+
Project-URL: Creator, https://me.sgopala.com
|
|
10
|
+
Keywords: llm,router,gateway,ollama,openai-compatible,local-first
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
18
|
+
Classifier: Topic :: Internet :: WWW/HTTP :: HTTP Servers
|
|
19
|
+
Requires-Python: >=3.10
|
|
20
|
+
Description-Content-Type: text/markdown
|
|
21
|
+
License-File: LICENSE
|
|
22
|
+
License-File: NOTICE
|
|
23
|
+
Requires-Dist: starlette<2,>=0.40
|
|
24
|
+
Requires-Dist: uvicorn<1,>=0.30
|
|
25
|
+
Requires-Dist: httpx<1,>=0.27
|
|
26
|
+
Requires-Dist: pydantic<3,>=2.6
|
|
27
|
+
Requires-Dist: pyyaml<7,>=6
|
|
28
|
+
Provides-Extra: ocr-layout
|
|
29
|
+
Requires-Dist: pillow>=10; extra == "ocr-layout"
|
|
30
|
+
Provides-Extra: dev
|
|
31
|
+
Requires-Dist: pillow>=10; extra == "dev"
|
|
32
|
+
Requires-Dist: pytest>=8; extra == "dev"
|
|
33
|
+
Requires-Dist: anyio>=4; extra == "dev"
|
|
34
|
+
Requires-Dist: ruff>=0.5; extra == "dev"
|
|
35
|
+
Requires-Dist: pip-audit>=2.7; extra == "dev"
|
|
36
|
+
Dynamic: license-file
|
|
37
|
+
|
|
38
|
+
# ModelSaar
|
|
39
|
+
|
|
40
|
+
**Status: public alpha** — pinned candidate commits; no stable release, no PyPI package or container image. The GitHub-only **release candidates** `v0.1.0-rc.1` and `v0.1.0-rc.2` (pre-releases for testing the opt-in decision-model features; rc.2 adds the `continuation` probe) are described below; see `docs/verification-report.md` for what has and has not been executed and `docs/roadmap.md` for scope.
|
|
41
|
+
|
|
42
|
+
[](https://github.com/gopalasubramanium/modelsaar/actions/workflows/ci.yml)
|
|
43
|
+
|
|
44
|
+
**Intelligent routing for local AI models.** One endpoint. Intelligent model selection.
|
|
45
|
+
|
|
46
|
+
ModelSaar is a small, local-first, OpenAI-compatible gateway. Your applications (Open WebUI,
|
|
47
|
+
OpenClaw, OpenCode, Hermes Agent, anything that speaks Chat Completions) connect once and ask for a
|
|
48
|
+
virtual model such as `auto`. ModelSaar inspects each request, keeps only the deployments that can
|
|
49
|
+
*actually* satisfy it (tools, images, strict JSON schemas, context size, locality, health, capacity),
|
|
50
|
+
ranks the rest on evidence, routes the request to the winner (the body passes through except documented
|
|
51
|
+
client-compatibility translations), and records a decision you can inspect.
|
|
52
|
+
|
|
53
|
+
```
|
|
54
|
+
client ──/v1/chat/completions (model: auto)──▶ ModelSaar ──▶ ollama/qwen3.8:27b
|
|
55
|
+
│ ollama/gemma4:e4b
|
|
56
|
+
│ vllm/...
|
|
57
|
+
└─ X-ModelSaar-Deployment, /admin/explain
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Status: **0.1.0 — first release candidate.** Core routing, streaming, embeddings, probes, CLI,
|
|
61
|
+
client config generation, evaluation harness and a fault-injection test suite are implemented and
|
|
62
|
+
tested against controlled backends, and exercised live against a real Ollama server with eight models
|
|
63
|
+
(discovery, probes, routing, streaming, tool calls, evaluation). Read the
|
|
64
|
+
[verification report](docs/verification-report.md) before relying on any specific compatibility.
|
|
65
|
+
|
|
66
|
+
## Why
|
|
67
|
+
|
|
68
|
+
* **Connect once.** Clients keep their own agent loops, tools, memory and UI; ModelSaar only selects
|
|
69
|
+
and forwards inference requests.
|
|
70
|
+
* **Never silently degrade.** No truncated history, dropped images, weakened schemas, stripped
|
|
71
|
+
tools, or hidden cloud fallback. If nothing qualifies you get a structured error with blockers and
|
|
72
|
+
remedies.
|
|
73
|
+
* **Evidence over marketing.** Capabilities are three-state (`supported | unsupported | unknown`)
|
|
74
|
+
with provenance (runtime metadata, probe, operator). Quality estimates are labelled *measured*,
|
|
75
|
+
*prior* or *uncalibrated*. Unknown required capabilities never qualify.
|
|
76
|
+
* **Local and private by default.** Loopback bind, generated keys, no prompt logging, cloud-forwarded
|
|
77
|
+
models excluded unless you opt in, backends only reachable at their configured hosts.
|
|
78
|
+
* **Small.** Five runtime dependencies (Starlette, uvicorn, httpx, pydantic, PyYAML). No Docker,
|
|
79
|
+
Envoy, Redis, Postgres, GPU toolkit or mandatory classifier model.
|
|
80
|
+
|
|
81
|
+
## Release 0.2.0
|
|
82
|
+
|
|
83
|
+
`v0.2.0` is the first stable version tag (the package remains alpha-classified; see the support matrix for
|
|
84
|
+
what is fixture-tested and what has run on real hardware). Ways to install it:
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
# 1. From the tag (always available)
|
|
88
|
+
git clone https://github.com/gopalasubramanium/modelsaar.git && cd modelsaar && git checkout v0.2.0
|
|
89
|
+
python3 -m venv .venv && . .venv/bin/activate && pip install .
|
|
90
|
+
|
|
91
|
+
# 2. From PyPI / as a container image — published by the release workflow for the tag; check that the
|
|
92
|
+
# version exists before relying on it (https://pypi.org/project/modelsaar/, ghcr.io/gopalasubramanium/modelsaar)
|
|
93
|
+
pip install modelsaar==0.2.0
|
|
94
|
+
docker run -v modelsaar-data:/data -v ./config.yaml:/data/config.yaml:ro -p 127.0.0.1:8484:8484 ghcr.io/gopalasubramanium/modelsaar:v0.2.0
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
The one-line installer on modelsaar.com installs the commit it pins (shown on the site), in its own
|
|
98
|
+
environment, and upgrades or rolls back an existing installation ([installation](docs/installation.md)).
|
|
99
|
+
|
|
100
|
+
New in 0.2: `POST /v1/responses`, `POST /v1/messages` and the opt-in response store
|
|
101
|
+
([protocols](docs/protocols.md)); `POST /v1/guardrails`, `POST /v1/ocr`, `POST /v1/vote`, audio/video input,
|
|
102
|
+
multimodal embedding items ([pipelines](docs/pipelines.md)); exact token counts and served-context detection
|
|
103
|
+
per runtime ([routing](docs/routing.md)); `modelsaar lifecycle` ([lifecycle](docs/lifecycle.md)); cascades,
|
|
104
|
+
replica scheduling and `modelsaar learn` ([cascades and learning](docs/cascades-and-learning.md));
|
|
105
|
+
`modelsaar judge` ([evaluation](docs/evaluation.md)). All of it is additive or opt-in: a 0.1 configuration
|
|
106
|
+
runs unchanged. One table gives the evidence level of every item: [docs/roadmap-matrix.md](docs/roadmap-matrix.md).
|
|
107
|
+
|
|
108
|
+
## Release candidate: decision models (`v0.1.0-rc.2`; opt-in, experimental — not a stable release)
|
|
109
|
+
|
|
110
|
+
`POST /v1/decisions` (typed questions answered by a decision model such as Ollama's `nimble`, `clef` or
|
|
111
|
+
`laya` through its native `/v1/systemone` API) and the routing classifier's `mode: decision` were merged on
|
|
112
|
+
`main` at commit `6075cdcf3b0952d4213a7899438f5fe546e95d19` and are available as the GitHub pre-releases
|
|
113
|
+
**`v0.1.0-rc.2`** (https://github.com/gopalasubramanium/modelsaar/releases/tag/v0.1.0-rc.2 — rc.1 plus the
|
|
114
|
+
`continuation` capability probe, `modelsaar probe <id> --which continuation`, and a corrected `422` remedy)
|
|
115
|
+
and `v0.1.0-rc.1` (unchanged). They are fixture-tested in CI and were exercised once live with three
|
|
116
|
+
requests (`docs/live-runs/2026-10-28-decision-preview-smoke/`); nothing about answer quality or routing
|
|
117
|
+
benefit is claimed. The continuation probe establishes protocol acceptance of `reasoning_content` in the
|
|
118
|
+
assistant history, not semantic continuity; it was run live once from `v0.1.0-rc.2` against `ollama/qwen3.8:latest`
|
|
119
|
+
(Ollama 0.40.5) and reported `supported` (`docs/live-runs/2026-10-29-rc2-continuation-probe/`; one deployment,
|
|
120
|
+
no override, nothing about other models or a real client's follow-up turn). A candidate is GitHub-only: no PyPI package, no container image, and the package
|
|
121
|
+
version stays `0.1.0` (`docs/release.md`, "GitHub-only pre-releases"). The one-line installer still pins
|
|
122
|
+
an earlier commit and is unchanged — do not point it at the candidate, that would replace a stable
|
|
123
|
+
installation. To try the candidate side by side with a stable install, use the ordinary source install
|
|
124
|
+
at the tag with its own home:
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
git clone https://github.com/gopalasubramanium/modelsaar.git modelsaar-preview && cd modelsaar-preview
|
|
128
|
+
git checkout v0.1.0-rc.2
|
|
129
|
+
python3 -m venv .venv && . .venv/bin/activate && pip install -e .
|
|
130
|
+
export MODELSAAR_HOME=~/.modelsaar-preview # separate config, keys and state
|
|
131
|
+
modelsaar init --port 8485 # or --endpoint http://host:11434 --type ollama
|
|
132
|
+
modelsaar discover # a decision model shows role "decision"
|
|
133
|
+
modelsaar serve
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
Contract and limits: `docs/routing.md` ("Decisions"); classifier configuration: `docs/extending.md`;
|
|
137
|
+
the web page with the tester instructions and the smoke-test record: https://modelsaar.com/preview/decision-models/.
|
|
138
|
+
|
|
139
|
+
## Quickest working setup
|
|
140
|
+
|
|
141
|
+
Prerequisites: Python 3.10+, and a running local inference server with at least one model
|
|
142
|
+
(Ollama is the first-class path; any OpenAI-compatible server works with declared models).
|
|
143
|
+
|
|
144
|
+
```bash
|
|
145
|
+
# 1. install from source (no PyPI package is published yet)
|
|
146
|
+
git clone https://github.com/gopalasubramanium/modelsaar.git && cd modelsaar
|
|
147
|
+
python3 -m venv .venv && . .venv/bin/activate # or: uv venv && . .venv/bin/activate
|
|
148
|
+
pip install -e . # or: uv pip install -e .
|
|
149
|
+
|
|
150
|
+
# 2. initialise: finds Ollama on 127.0.0.1:11434 (or pass --endpoint), writes config + keys, discovers models
|
|
151
|
+
modelsaar init
|
|
152
|
+
|
|
153
|
+
# 3. check and verify
|
|
154
|
+
modelsaar doctor # reachability, context assumptions, unknown capabilities, cloud aliases
|
|
155
|
+
modelsaar probe --all # live checks: streaming, tools, JSON schema, vision, continuation, latency (uses local compute)
|
|
156
|
+
|
|
157
|
+
# 4. run
|
|
158
|
+
modelsaar serve # http://127.0.0.1:8484/v1 ; keys in ~/.modelsaar/keys/
|
|
159
|
+
|
|
160
|
+
# 5. first request (in another shell)
|
|
161
|
+
modelsaar test # identifies the gateway (GET /healthz), GET /v1/models, one routed completion through `auto`
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
Example request:
|
|
165
|
+
|
|
166
|
+
```bash
|
|
167
|
+
curl -s http://127.0.0.1:8484/v1/chat/completions \
|
|
168
|
+
-H "Authorization: Bearer $(head -1 ~/.modelsaar/keys/api_keys)" \
|
|
169
|
+
-H "Content-Type: application/json" \
|
|
170
|
+
-d '{"model":"auto","messages":[{"role":"user","content":"Write a Python function that parses ISO dates"}]}' \
|
|
171
|
+
-D - | grep -i x-modelsaar # X-ModelSaar-Deployment tells you what was selected
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
Then connect a client. One command per client (pick yours; these are separate commands, not a
|
|
175
|
+
pipeline): `modelsaar client-config open-webui`, `modelsaar client-config openclaw`,
|
|
176
|
+
`modelsaar client-config opencode` (or `opencode-v2`), `modelsaar client-config hermes`. Each prints
|
|
177
|
+
verified configuration; `--apply` merges file-based configs with a backup. For a GUI field that asks
|
|
178
|
+
for an API key, print the key in a terminal with `head -1 ~/.modelsaar/keys/api_keys` and paste the
|
|
179
|
+
value it prints (a line starting with `msk_`) — the `$(...)` form above is shell syntax, not a key. See
|
|
180
|
+
[docs/clients/](docs/clients/).
|
|
181
|
+
|
|
182
|
+
No models yet? `modelsaar demo` starts a clearly labelled **simulated** backend so you can try the
|
|
183
|
+
CLI, the status page and route explanations without downloading anything.
|
|
184
|
+
|
|
185
|
+
## Virtual models (aliases)
|
|
186
|
+
|
|
187
|
+
| alias | profile | notes |
|
|
188
|
+
|---|---|---|
|
|
189
|
+
| `auto` | quality | default: best expected quality within limits; effectively tied candidates resolve to the lower-overhead one |
|
|
190
|
+
| `auto-quality` | quality | same as `auto` |
|
|
191
|
+
| `auto-balanced` | balanced | more weight on latency and residency |
|
|
192
|
+
| `auto-fast` | fast | prefer resident, low-latency deployments |
|
|
193
|
+
| `auto-code` | quality | only deployments tagged `code` |
|
|
194
|
+
| `auto-vision` | quality | only deployments with verified image input |
|
|
195
|
+
|
|
196
|
+
Aliases are advertised in `GET /v1/models` **only** when at least one usable deployment backs them,
|
|
197
|
+
with a truthful contract (`context_length_min`, tools/vision/json_schema = supported/partial/unsupported).
|
|
198
|
+
Any concrete deployment id (e.g. `ollama/qwen3.8:27b`) can be requested directly; it still passes
|
|
199
|
+
the same hard checks.
|
|
200
|
+
|
|
201
|
+
## How a route is chosen
|
|
202
|
+
|
|
203
|
+
1. **Requirements** – structural analysis of the whole request: roles, images/audio, tools and
|
|
204
|
+
`tool_choice`, `response_format`, outstanding tool-call ids, `reasoning_content`, conservative
|
|
205
|
+
token accounting (input + output allowance + reasoning budget for thinking models).
|
|
206
|
+
2. **Hard filters** – role, health, locality policy, capability tri-state, effective context,
|
|
207
|
+
backend field support, admission feasibility. A score can never override a failed filter.
|
|
208
|
+
3. **Classification** – deterministic multi-label task signals; an *optional* local classifier is
|
|
209
|
+
consulted only for ambiguous cases, under a strict contract with timeout and fallback — either a
|
|
210
|
+
small chat model answering JSON or, with `routing.classifier.mode: decision`, a decision model
|
|
211
|
+
(Ollama `/v1/systemone`: nimble, clef, laya) answering one choice question with probabilities.
|
|
212
|
+
4. **Ranking** – transparent score per profile: evidence-based quality (measured > prior >
|
|
213
|
+
uncalibrated, with uncertainty) minus latency, residency/load and overhead costs, plus a
|
|
214
|
+
switching penalty for session affinity.
|
|
215
|
+
5. **Decision record** – request id, config hash, inferred task, requirements, exclusions with
|
|
216
|
+
reasons, candidate breakdown, chosen deployment, evidence level, overhead. No prompt content.
|
|
217
|
+
|
|
218
|
+
Inspect: `modelsaar explain -m "..." [--tools --image --json-schema]`, `modelsaar decisions`,
|
|
219
|
+
`GET /admin/decisions/<id>`, or the status page at `/admin/ui`. Details: [docs/routing.md](docs/routing.md).
|
|
220
|
+
|
|
221
|
+
## Tested support matrix
|
|
222
|
+
|
|
223
|
+
Legend: **F** fixture-tested over real HTTP with a controlled fake backend (CI); **L** executed live
|
|
224
|
+
against real models (owner's GX10 via Tailscale, 2026-10-11); **D** documented from primary sources
|
|
225
|
+
(config keys verified 2026-10-11); **NOT RUN** needs your hardware/client.
|
|
226
|
+
|
|
227
|
+
| area | status |
|
|
228
|
+
|---|---|
|
|
229
|
+
| `GET /v1/models`, `POST /v1/chat/completions` (non-stream + SSE), `POST /v1/embeddings`, `/healthz`, `/readyz` | F |
|
|
230
|
+
| `POST /v1/decisions` — typed questions answered by a decision model (Ollama `/v1/systemone`); contract in `docs/routing.md` | F (fixture), **NOT RUN** against a live decision model |
|
|
231
|
+
| Ollama adapter: `/api/tags`, `/api/show`, `/api/ps`, `/api/version`, OpenAI-compat forwarding, cloud-alias detection | F + **L** (Ollama 0.32.13 on an ASUS GX10, 8 models, 2026-10-11) |
|
|
232
|
+
| Generic OpenAI-compatible adapter (`/models`, `/chat/completions`, `/embeddings`, vLLM `/tokenize`) | F (fixture), **NOT RUN** against vLLM/llama.cpp |
|
|
233
|
+
| Tool round trips, streaming tool deltas, strict schema routing, image routing | F |
|
|
234
|
+
| Failover before commitment / termination after commitment | F |
|
|
235
|
+
| Admission limits, queue rejection, uncertain occupancy on disconnect | F |
|
|
236
|
+
| Probes, fingerprint invalidation (endpoint + identity), embedding contracts (verified identity, output validation), local-only policy | F |
|
|
237
|
+
| Privacy before payload operations (no `/tokenize`/classifier traffic to policy-excluded deployments), continuity (no failover inside tool round trips / pinned sessions), timeout holds, pool memory budgets, probes under gateway admission | F (`tests/test_hardening_2026_10_11.py`) |
|
|
238
|
+
| Open WebUI / OpenClaw / OpenCode V1+V2 / Hermes configuration | D; live tool round trip **NOT RUN** |
|
|
239
|
+
| Several real deployments routed by `auto` (chat → qwen3.6, code/tools → qwen3-coder, vision → qwen3.6, agent → gemma4) | **L** — see [docs/verification-report.md](docs/verification-report.md) |
|
|
240
|
+
| Live evaluation vs fixed/rules/random/oracle baselines (3-deployment subset) | **L** (2026-10-11, pre-hardening evaluator: auto 0.875 vs fixed-strong 0.906, overlapping CIs, 0 capability violations — historical; a rerun with the repaired evaluator is recorded in docs/verification-report.md when complete) |
|
|
241
|
+
| `POST /v1/responses` (stateless subset) and `POST /v1/messages` (Anthropic Messages), fail-closed translations onto the chat path — `docs/protocols.md` | F; **S**: official `openai` and `anthropic` Python SDKs against the installed `modelsaar serve` with simulated models (`scripts/protocol_sdk_check.py`); real model / agent client **NOT RUN** |
|
|
242
|
+
| Stateful Responses via the opt-in local response store; `POST /v1/vote` and guardrail ensembles (closed choices); optional OCR layout stage; inline video input; replica scheduling across hosts — `docs/protocols.md`, `docs/pipelines.md`, `docs/cascades-and-learning.md` | F; nothing run on real models, a real layout service or two real hosts |
|
|
243
|
+
| `POST /v1/guardrails`, `POST /v1/ocr`, audio input (`audio_in` probe), multimodal embedding items — `docs/pipelines.md` | F (scripted fixture models); real Granite Guardian / GLM-OCR / audio / multimodal-embedding model **NOT RUN**; multimodal embeddings through Ollama are refused (its embed API is text-only) |
|
|
244
|
+
| Exact chat-template token counts and served context for vLLM / llama.cpp; Ollama served-context options — `docs/routing.md` | F (fixture servers emulating the documented endpoints); real vLLM / llama.cpp **NOT RUN** |
|
|
245
|
+
| Managed lifecycle (opt-in), llama-swap composition — `docs/lifecycle.md` | F; real Ollama / llama-swap **NOT RUN** |
|
|
246
|
+
| Cascades, adaptive learning (both opt-in) — `docs/cascades-and-learning.md`; LLM judge (separate report) — `docs/evaluation.md` | F; no benefit claim on real traffic |
|
|
247
|
+
|
|
248
|
+
## Limitations (0.1)
|
|
249
|
+
|
|
250
|
+
* Served context length for Ollama models is **assumed 4096** unless the Modelfile sets `num_ctx`,
|
|
251
|
+
the model is currently loaded (`/api/ps`), or you add an override; `doctor` warns about it.
|
|
252
|
+
* Token counts are conservative estimates (chars/3 for Latin text, one token per CJK/other wide character, plus overheads); when a backend exposes `/tokenize` (vLLM) the gateway asks it for text counts only in borderline cases (estimate within ±50 % of a deployment's context), only for deployments that already passed every policy filter, and still adds estimated template/image overhead.
|
|
253
|
+
* Pool `memory_gb` budgets use weights-only estimates plus a margin; they prevent clearly oversized dispatches, not every OOM.
|
|
254
|
+
* Ollama's OpenAI layer does not support `tool_choice=required/named`, remote image URLs,
|
|
255
|
+
`logit_bias`, `n`, `logprobs`; such requests are rejected with blockers rather than altered.
|
|
256
|
+
* The 0.2 candidate adds Responses/Messages translations, guardrail and OCR pipelines, audio input,
|
|
257
|
+
multimodal embedding items, video input on the vLLM-documented form, an optional OCR layout stage,
|
|
258
|
+
an opt-in response store for stateful Responses, managed lifecycle, cascades, closed-choice ensembles,
|
|
259
|
+
replica scheduling and opt-in learning — all **fixture-tested only** so far (see the matrix above and
|
|
260
|
+
[docs/roadmap-matrix.md](docs/roadmap-matrix.md)). Out of scope: hosted tools, the Conversations API,
|
|
261
|
+
running a layout model in the gateway, free-text ensembles, a cluster scheduler, automatic model eviction
|
|
262
|
+
or downloads; multimodal embeddings and video through Ollama are blocked by Ollama's own API.
|
|
263
|
+
* The evaluation harness executes model-written code only under bubblewrap / `sandbox-exec` / Docker; without one of those, code tasks are skipped (reported), never run on the host.
|
|
264
|
+
* Quality priors from the catalogue are hypotheses; run `modelsaar eval --mode live --save-measurements`
|
|
265
|
+
to replace them with measurements on your hardware.
|
|
266
|
+
|
|
267
|
+
## Documentation
|
|
268
|
+
|
|
269
|
+
* [Installation](docs/installation.md) · [Troubleshooting](docs/troubleshooting.md) · [Privacy & security](docs/privacy.md)
|
|
270
|
+
* [Architecture](docs/architecture.md) · [Routing](docs/routing.md) · [ADR-001 build vs adapt](docs/decisions/ADR-001-build-vs-adapt.md)
|
|
271
|
+
* [Model catalogue evidence](docs/catalogue.md) · [Adding a deployment or adapter](docs/extending.md)
|
|
272
|
+
* Client guides: [Open WebUI](docs/clients/open-webui.md) · [OpenClaw](docs/clients/openclaw.md) · [OpenCode](docs/clients/opencode.md) · [Hermes Agent](docs/clients/hermes.md) · [SDKs and Responses/Messages clients](docs/clients/sdk-protocols.md)
|
|
273
|
+
* [Protocols](docs/protocols.md) · [Pipelines](docs/pipelines.md) · [Lifecycle](docs/lifecycle.md) · [Cascades and learning](docs/cascades-and-learning.md) · [Acceptance and roadmap matrix](docs/roadmap-matrix.md)
|
|
274
|
+
* [Evaluation](docs/evaluation.md) · [Verification report](docs/verification-report.md) · [Release process](docs/release.md) · [Roadmap](docs/roadmap.md)
|
|
275
|
+
* [Progress & decision log](docs/progress.md)
|
|
276
|
+
|
|
277
|
+
## Creator
|
|
278
|
+
|
|
279
|
+
Created by [Gopala Subramanium](https://me.sgopala.com). An independent open-source project.
|
|
280
|
+
[Say thanks](https://modelsaar.com/thanks/) if ModelSaar has been useful to you.
|
|
281
|
+
|
|
282
|
+
## Licence
|
|
283
|
+
|
|
284
|
+
Apache-2.0 for the gateway code (see `LICENSE`, `NOTICE`). Model weights are licensed by their
|
|
285
|
+
publishers; ModelSaar neither bundles weights nor accepts any model terms on your behalf.
|