mirrorneuron-prism 0.3.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.
- mirrorneuron_prism-0.3.0/.dockerignore +9 -0
- mirrorneuron_prism-0.3.0/.gitignore +35 -0
- mirrorneuron_prism-0.3.0/CHANGELOG.md +13 -0
- mirrorneuron_prism-0.3.0/CONTRIBUTING.md +38 -0
- mirrorneuron_prism-0.3.0/Dockerfile +24 -0
- mirrorneuron_prism-0.3.0/LICENSE +21 -0
- mirrorneuron_prism-0.3.0/PKG-INFO +245 -0
- mirrorneuron_prism-0.3.0/README.md +204 -0
- mirrorneuron_prism-0.3.0/SECURITY.md +13 -0
- mirrorneuron_prism-0.3.0/compose.yaml +13 -0
- mirrorneuron_prism-0.3.0/docs/assets/prism.jpeg +0 -0
- mirrorneuron_prism-0.3.0/docs/benchmarking.md +132 -0
- mirrorneuron_prism-0.3.0/docs/evaluations/2026-10-04-openrouter/benchmark-results.md +60 -0
- mirrorneuron_prism-0.3.0/docs/evaluations/2026-10-04-openrouter/cases.jsonl +6 -0
- mirrorneuron_prism-0.3.0/docs/evaluations/2026-10-04-openrouter/docker-smoke.json +120 -0
- mirrorneuron_prism-0.3.0/docs/evaluations/2026-10-04-openrouter/manifest.json +641 -0
- mirrorneuron_prism-0.3.0/docs/evaluations/2026-10-04-openrouter/marketing-narrative.md +17 -0
- mirrorneuron_prism-0.3.0/docs/evaluations/2026-10-04-openrouter/physical-capacity.json +139 -0
- mirrorneuron_prism-0.3.0/docs/evaluations/2026-10-04-openrouter/requests.jsonl +24 -0
- mirrorneuron_prism-0.3.0/docs/evaluations/2026-10-04-openrouter/smoke-rerun.json +410 -0
- mirrorneuron_prism-0.3.0/docs/evaluations/2026-10-04-openrouter/smoke.json +561 -0
- mirrorneuron_prism-0.3.0/docs/execution-policies.md +141 -0
- mirrorneuron_prism-0.3.0/docs/flagship-curl-cases.md +379 -0
- mirrorneuron_prism-0.3.0/docs/live-benchmark-20261002.md +74 -0
- mirrorneuron_prism-0.3.0/docs/live-benchmark-review-20261003.md +120 -0
- mirrorneuron_prism-0.3.0/docs/model-config-capacity.md +92 -0
- mirrorneuron_prism-0.3.0/docs/model-optimization.md +117 -0
- mirrorneuron_prism-0.3.0/docs/native-context-validation-20261003.md +62 -0
- mirrorneuron_prism-0.3.0/docs/openrouter-nemotron-mix.md +62 -0
- mirrorneuron_prism-0.3.0/docs/release-validation-0.3.0.md +36 -0
- mirrorneuron_prism-0.3.0/docs/releasing.md +56 -0
- mirrorneuron_prism-0.3.0/docs/standalone-contract.md +43 -0
- mirrorneuron_prism-0.3.0/docs/standalone-validation.md +37 -0
- mirrorneuron_prism-0.3.0/docs/structured-reduction.md +73 -0
- mirrorneuron_prism-0.3.0/docs/usage.md +265 -0
- mirrorneuron_prism-0.3.0/examples/standalone/cases.jsonl +2 -0
- mirrorneuron_prism-0.3.0/examples/standalone/client.py +15 -0
- mirrorneuron_prism-0.3.0/examples/standalone/docker-spark/README.md +147 -0
- mirrorneuron_prism-0.3.0/examples/standalone/docker-spark/benchmark.py +900 -0
- mirrorneuron_prism-0.3.0/examples/standalone/docker-spark/models.json +49 -0
- mirrorneuron_prism-0.3.0/examples/standalone/docker-spark/native_context.py +555 -0
- mirrorneuron_prism-0.3.0/examples/standalone/docker-spark/prism.json +265 -0
- mirrorneuron_prism-0.3.0/examples/standalone/litellm/models/local.json +17 -0
- mirrorneuron_prism-0.3.0/examples/standalone/litellm/models/spark.json +17 -0
- mirrorneuron_prism-0.3.0/examples/standalone/litellm/prism.json +5 -0
- mirrorneuron_prism-0.3.0/examples/standalone/long_context.py +28 -0
- mirrorneuron_prism-0.3.0/examples/standalone/openrouter_evaluation.py +524 -0
- mirrorneuron_prism-0.3.0/examples/standalone/openrouter_smoke.py +160 -0
- mirrorneuron_prism-0.3.0/examples/standalone/optimization/models.json +26 -0
- mirrorneuron_prism-0.3.0/examples/standalone/optimization/prism.json +19 -0
- mirrorneuron_prism-0.3.0/examples/standalone/optimized_client.py +22 -0
- mirrorneuron_prism-0.3.0/examples/standalone/providers/README.md +48 -0
- mirrorneuron_prism-0.3.0/examples/standalone/providers/models.json +146 -0
- mirrorneuron_prism-0.3.0/examples/standalone/providers/prism-claude.json +112 -0
- mirrorneuron_prism-0.3.0/examples/standalone/providers/prism-gemini.json +128 -0
- mirrorneuron_prism-0.3.0/examples/standalone/providers/prism-openai.json +112 -0
- mirrorneuron_prism-0.3.0/examples/standalone/providers/prism.json +320 -0
- mirrorneuron_prism-0.3.0/models/muse-gemma-mix.json +1 -0
- mirrorneuron_prism-0.3.0/models/openrouter-nemotron-mix.json +71 -0
- mirrorneuron_prism-0.3.0/prism-openrouter.json +199 -0
- mirrorneuron_prism-0.3.0/prism.json +63 -0
- mirrorneuron_prism-0.3.0/prism_standalone_proxy_design.md +520 -0
- mirrorneuron_prism-0.3.0/pyproject.toml +83 -0
- mirrorneuron_prism-0.3.0/src/prism/__init__.py +13 -0
- mirrorneuron_prism-0.3.0/src/prism/__main__.py +3 -0
- mirrorneuron_prism-0.3.0/src/prism/api.py +353 -0
- mirrorneuron_prism-0.3.0/src/prism/artifacts.py +91 -0
- mirrorneuron_prism-0.3.0/src/prism/backends.py +535 -0
- mirrorneuron_prism-0.3.0/src/prism/benchmark.py +729 -0
- mirrorneuron_prism-0.3.0/src/prism/benchmark_stages.py +196 -0
- mirrorneuron_prism-0.3.0/src/prism/capacity.py +394 -0
- mirrorneuron_prism-0.3.0/src/prism/cli.py +527 -0
- mirrorneuron_prism-0.3.0/src/prism/cli_ui.py +164 -0
- mirrorneuron_prism-0.3.0/src/prism/compaction.py +285 -0
- mirrorneuron_prism-0.3.0/src/prism/config.py +366 -0
- mirrorneuron_prism-0.3.0/src/prism/context.py +173 -0
- mirrorneuron_prism-0.3.0/src/prism/contracts.py +530 -0
- mirrorneuron_prism-0.3.0/src/prism/decision.py +209 -0
- mirrorneuron_prism-0.3.0/src/prism/decision_worker.py +37 -0
- mirrorneuron_prism-0.3.0/src/prism/engine.py +1349 -0
- mirrorneuron_prism-0.3.0/src/prism/errors.py +24 -0
- mirrorneuron_prism-0.3.0/src/prism/evaluation.py +96 -0
- mirrorneuron_prism-0.3.0/src/prism/long_context_cases.py +144 -0
- mirrorneuron_prism-0.3.0/src/prism/native_tokens.py +125 -0
- mirrorneuron_prism-0.3.0/src/prism/optimization.py +308 -0
- mirrorneuron_prism-0.3.0/src/prism/passages.py +36 -0
- mirrorneuron_prism-0.3.0/src/prism/planning.py +851 -0
- mirrorneuron_prism-0.3.0/src/prism/policies.py +55 -0
- mirrorneuron_prism-0.3.0/src/prism/py.typed +0 -0
- mirrorneuron_prism-0.3.0/src/prism/reduction.py +819 -0
- mirrorneuron_prism-0.3.0/src/prism/registry.py +185 -0
- mirrorneuron_prism-0.3.0/src/prism/resources/benchmark-cases.jsonl +6 -0
- mirrorneuron_prism-0.3.0/src/prism/resources/models.json +15 -0
- mirrorneuron_prism-0.3.0/src/prism/resources/openrouter/models.json +71 -0
- mirrorneuron_prism-0.3.0/src/prism/resources/openrouter/prism.json +199 -0
- mirrorneuron_prism-0.3.0/src/prism/resources/prism.json +65 -0
- mirrorneuron_prism-0.3.0/src/prism/resources/providers/models.json +146 -0
- mirrorneuron_prism-0.3.0/src/prism/resources/providers/prism.json +320 -0
- mirrorneuron_prism-0.3.0/src/prism/runtime.py +235 -0
- mirrorneuron_prism-0.3.0/src/prism/telemetry.py +32 -0
- mirrorneuron_prism-0.3.0/src/prism/wire.py +191 -0
- mirrorneuron_prism-0.3.0/tests/standalone/__init__.py +0 -0
- mirrorneuron_prism-0.3.0/tests/standalone/decision_stub.py +14 -0
- mirrorneuron_prism-0.3.0/tests/standalone/flagship_cases.py +105 -0
- mirrorneuron_prism-0.3.0/tests/standalone/test_benchmark.py +443 -0
- mirrorneuron_prism-0.3.0/tests/standalone/test_benchmark_stages.py +84 -0
- mirrorneuron_prism-0.3.0/tests/standalone/test_cli_ui.py +463 -0
- mirrorneuron_prism-0.3.0/tests/standalone/test_core.py +204 -0
- mirrorneuron_prism-0.3.0/tests/standalone/test_docker_spark_benchmark.py +331 -0
- mirrorneuron_prism-0.3.0/tests/standalone/test_evaluation.py +131 -0
- mirrorneuron_prism-0.3.0/tests/standalone/test_flagship_curl.py +411 -0
- mirrorneuron_prism-0.3.0/tests/standalone/test_http.py +118 -0
- mirrorneuron_prism-0.3.0/tests/standalone/test_litellm_capacity.py +719 -0
- mirrorneuron_prism-0.3.0/tests/standalone/test_native_context.py +261 -0
- mirrorneuron_prism-0.3.0/tests/standalone/test_openrouter_combinations.py +306 -0
- mirrorneuron_prism-0.3.0/tests/standalone/test_optimization.py +957 -0
- mirrorneuron_prism-0.3.0/tests/standalone/test_policies.py +481 -0
- mirrorneuron_prism-0.3.0/tests/standalone/test_proxy.py +829 -0
- mirrorneuron_prism-0.3.0/tests/standalone/test_reduction.py +589 -0
- mirrorneuron_prism-0.3.0/tests/standalone/test_reliability.py +492 -0
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# Distribution / packaging
|
|
7
|
+
dist/
|
|
8
|
+
build/
|
|
9
|
+
*.egg-info/
|
|
10
|
+
*.egg
|
|
11
|
+
|
|
12
|
+
# Virtual environments
|
|
13
|
+
.venv/
|
|
14
|
+
venv/
|
|
15
|
+
env/
|
|
16
|
+
|
|
17
|
+
# IDE
|
|
18
|
+
.vscode/
|
|
19
|
+
.idea/
|
|
20
|
+
*.swp
|
|
21
|
+
*.swo
|
|
22
|
+
|
|
23
|
+
# Testing
|
|
24
|
+
.pytest_cache/
|
|
25
|
+
.coverage
|
|
26
|
+
htmlcov/
|
|
27
|
+
|
|
28
|
+
# Environment variables
|
|
29
|
+
.env
|
|
30
|
+
*.key
|
|
31
|
+
.prism/
|
|
32
|
+
benchmark-results/
|
|
33
|
+
|
|
34
|
+
# macOS
|
|
35
|
+
.DS_Store
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.3.0 — prepared for manual release
|
|
4
|
+
|
|
5
|
+
- Add bounded `vision_synthesis` and `text_synthesis` workflows with explicit observation coverage, upfront reservations, and validated final output.
|
|
6
|
+
- Add free OpenRouter Nano Omni / Super / Ultra combinations, JSON-capable final-model selection, and native OpenAI / Claude / Gemini example profiles using environment credentials.
|
|
7
|
+
- Evaluate actual physical-model and end-to-end profile JSON, JSON Schema, image, and reasoning behavior. Preserve unknown upstream outcomes separately from failed checks.
|
|
8
|
+
- Add explicit `prism serve --no-auth` client-auth opt-out; upstream authentication remains independent.
|
|
9
|
+
- Improve CLI help and terminal output using Rich, with JSON for scripts, model/profile inventories, and installed presets.
|
|
10
|
+
- Fix compressed-response handling and provider errors inside HTTP 200 envelopes in the guarded LiteLLM transport.
|
|
11
|
+
- Add Docker/Compose deployment, package resources, coverage checks, usage guides, and a reproducible live evaluation with qualified marketing narrative.
|
|
12
|
+
|
|
13
|
+
Existing local registries and profiles remain supported. Observation preparation is lossy; it does not replace source-provenance validation. Paid provider samples were checked locally and require live qualification with the user's own keys. Release artifacts are prepared; no package publication is performed by this work.
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# Contributing to Prism
|
|
2
|
+
|
|
3
|
+
Thank you for helping improve Prism. Useful contributions include reproducible bug reports, clearer documentation, provider protocol fixtures, routing fixes, and bounded workflow improvements. Keep discussions respectful and focused on the work.
|
|
4
|
+
|
|
5
|
+
## Development setup
|
|
6
|
+
|
|
7
|
+
Fork and clone the repository, then create a Python 3.11+ environment:
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
python -m venv .venv
|
|
11
|
+
source .venv/bin/activate
|
|
12
|
+
python -m pip install -e '.[dev]'
|
|
13
|
+
prism --help
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
On Windows, activate with `.venv\Scripts\Activate.ps1`. The deterministic tests use HTTP and decision fixtures; they do not need provider keys or model-weight downloads. Real server startup prepares the required Laya checkpoint separately.
|
|
17
|
+
|
|
18
|
+
## Before submitting a change
|
|
19
|
+
|
|
20
|
+
Keep a pull request focused on one problem. Explain the resulting behavior, update relevant documentation, and add meaningful regression coverage for changed behavior. Configuration examples should use environment variables for credentials.
|
|
21
|
+
|
|
22
|
+
```sh
|
|
23
|
+
ruff check src tests examples
|
|
24
|
+
python -m pytest -q --cov=prism --cov-report=term --cov-fail-under=80
|
|
25
|
+
python -m pytest tests/standalone -q -m integration -o addopts=''
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
The integration suite starts temporary localhost servers and exercises real HTTP, SDK, and curl requests. Install `curl` to run those checks. CI runs Python 3.11–3.13 and enforces the coverage floor. For packaging changes, also run `python -m build` and `python -m twine check dist/mirrorneuron_prism-0.3.0*`; use the current project version for later releases.
|
|
29
|
+
|
|
30
|
+
For provider or model changes, distinguish local protocol fixtures from live qualification. Report which checks actually ran, retain failed/inconclusive outcomes, and explain any pricing assumptions. Catalog metadata alone is not proof of JSON, image, or reasoning behavior. Live calls can consume upstream quota or incur charges.
|
|
31
|
+
|
|
32
|
+
## Issues and pull requests
|
|
33
|
+
|
|
34
|
+
Use the issue templates for bug reports and feature requests. Include the Prism/Python versions, a minimal configuration or request, steps to reproduce, and expected versus observed behavior. Remove credentials and private content from shared examples.
|
|
35
|
+
|
|
36
|
+
In a pull request, describe the problem, the change, and the validation results. Mention tests that were not run and why. Avoid unrelated formatting or dependency changes. Maintainers may request a smaller scope or additional evidence before merging; release publication remains a separate manual step.
|
|
37
|
+
|
|
38
|
+
For suspected vulnerabilities, follow [SECURITY.md](SECURITY.md) instead of posting exploit details publicly. Contributions are made under this project's [MIT License](LICENSE).
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
FROM python:3.12-slim AS builder
|
|
2
|
+
WORKDIR /build
|
|
3
|
+
COPY pyproject.toml README.md LICENSE ./
|
|
4
|
+
COPY src ./src
|
|
5
|
+
RUN python -m pip wheel --no-cache-dir --no-deps --wheel-dir /wheels .
|
|
6
|
+
|
|
7
|
+
FROM python:3.12-slim
|
|
8
|
+
ENV PYTHONDONTWRITEBYTECODE=1 PYTHONUNBUFFERED=1 \
|
|
9
|
+
HF_HOME=/home/prism/.cache/huggingface
|
|
10
|
+
# Install CPU-only torch first to avoid unnecessary CUDA dependencies on amd64.
|
|
11
|
+
RUN python -m pip install --no-cache-dir torch --index-url https://download.pytorch.org/whl/cpu
|
|
12
|
+
COPY --from=builder /wheels /wheels
|
|
13
|
+
RUN python -m pip install --no-cache-dir /wheels/*.whl && rm -rf /wheels \
|
|
14
|
+
&& useradd --create-home --uid 10001 prism \
|
|
15
|
+
&& mkdir -p /app /home/prism/.cache/huggingface \
|
|
16
|
+
&& chown -R prism:prism /app /home/prism/.cache
|
|
17
|
+
USER prism
|
|
18
|
+
WORKDIR /app
|
|
19
|
+
RUN prism init --preset openrouter
|
|
20
|
+
EXPOSE 8080
|
|
21
|
+
HEALTHCHECK --start-period=300s --interval=30s --timeout=5s \
|
|
22
|
+
CMD python -c "import urllib.request; urllib.request.urlopen('http://127.0.0.1:8080/health', timeout=3)"
|
|
23
|
+
ENTRYPOINT ["prism"]
|
|
24
|
+
CMD ["serve", "--config", "/app/prism.json", "--host", "0.0.0.0", "--port", "8080"]
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 mirrorneuron-prism
|
|
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 LICENSE 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,245 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: mirrorneuron-prism
|
|
3
|
+
Version: 0.3.0
|
|
4
|
+
Summary: OpenAI-compatible proxy for bounded text, vision, and reasoning model workflows
|
|
5
|
+
Project-URL: Homepage, https://github.com/homerquan/mirrorneuron-prism
|
|
6
|
+
Project-URL: Repository, https://github.com/homerquan/mirrorneuron-prism
|
|
7
|
+
Project-URL: Issues, https://github.com/homerquan/mirrorneuron-prism/issues
|
|
8
|
+
Author: Prism contributors
|
|
9
|
+
License-Expression: MIT
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Keywords: inference,laya,llm,long-context,openai,openrouter,proxy,vision
|
|
12
|
+
Classifier: Development Status :: 3 - Alpha
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
18
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
19
|
+
Requires-Python: >=3.11
|
|
20
|
+
Requires-Dist: anyio<5,>=4.4
|
|
21
|
+
Requires-Dist: fastapi<1,>=0.115
|
|
22
|
+
Requires-Dist: httpx<1,>=0.27
|
|
23
|
+
Requires-Dist: jsonschema<5,>=4
|
|
24
|
+
Requires-Dist: laya<0.4,>=0.3.23
|
|
25
|
+
Requires-Dist: litellm<2,>=1.101.0
|
|
26
|
+
Requires-Dist: pydantic<3,>=2
|
|
27
|
+
Requires-Dist: rich-argparse<2,>=1.7
|
|
28
|
+
Requires-Dist: rich<16,>=13.9
|
|
29
|
+
Requires-Dist: uvicorn<1,>=0.30
|
|
30
|
+
Provides-Extra: dev
|
|
31
|
+
Requires-Dist: build; extra == 'dev'
|
|
32
|
+
Requires-Dist: httpx; extra == 'dev'
|
|
33
|
+
Requires-Dist: mypy; extra == 'dev'
|
|
34
|
+
Requires-Dist: openai; extra == 'dev'
|
|
35
|
+
Requires-Dist: pytest; extra == 'dev'
|
|
36
|
+
Requires-Dist: pytest-asyncio; extra == 'dev'
|
|
37
|
+
Requires-Dist: pytest-cov<8,>=6; extra == 'dev'
|
|
38
|
+
Requires-Dist: ruff; extra == 'dev'
|
|
39
|
+
Requires-Dist: twine; extra == 'dev'
|
|
40
|
+
Description-Content-Type: text/markdown
|
|
41
|
+
|
|
42
|
+
# Prism
|
|
43
|
+
|
|
44
|
+
[](LICENSE)
|
|
45
|
+
[](pyproject.toml)
|
|
46
|
+
[](https://github.com/homerquan/mirrorneuron-prism/actions/workflows/ci.yml)
|
|
47
|
+
[](docs/standalone-contract.md)
|
|
48
|
+
|
|
49
|
+
**Turn local models and cloud LLMs into one AI API.**
|
|
50
|
+
|
|
51
|
+

|
|
52
|
+
|
|
53
|
+
[Why Prism](#why-prism) · [How it works](#how-it-works) · [Quick start](#start-with-free-openrouter-models) · [Documentation](#documentation-and-development) · [Contributing](CONTRIBUTING.md)
|
|
54
|
+
|
|
55
|
+
Prism lets several models work together behind one OpenAI-compatible endpoint. Connect your application once, then choose a profile that combines the models you need: a small model to prepare context, a vision model to read an image, or a larger model to review and finish the answer. Your application receives one assistant response.
|
|
56
|
+
|
|
57
|
+
Prism is a component of [MirrorNeuron](https://www.mirrorneuron.io), built to make AI workflows useful on infrastructure you control. It helps solve local AI by composing available models into a service your applications can use. You can also run Prism independently: combine local servers with OpenRouter, OpenAI, Claude, Gemini, and other APIs supported by LiteLLM, using local models, cloud models, or a mix of both.
|
|
58
|
+
|
|
59
|
+
Distribution: **`mirrorneuron-prism`** · import: **`prism`** · command: **`prism`** · Python **3.11+** · MIT
|
|
60
|
+
|
|
61
|
+
## Why Prism
|
|
62
|
+
|
|
63
|
+
AI applications need different capabilities for different jobs. A coding assistant may benefit from drafting and review; a support tool needs structured answers; an image workflow needs vision before reasoning. Prism gives you a place to compose those capabilities while your application keeps the same API.
|
|
64
|
+
|
|
65
|
+
- **Keep your application simple.** Use your existing OpenAI client and switch workflows by model alias. Define physical models once and reuse them across profiles.
|
|
66
|
+
- **Put each model to useful work.** Let a small or free model prepare context, a vision model interpret pixels, and a selected final model write the answer. Measure cost, latency, and task quality to find a combination that fits your workload.
|
|
67
|
+
- **Bring your own compute and providers.** Start with local inference, cloud APIs, or both. Run Prism as a Python package or Docker service; MirrorNeuron is optional for standalone use.
|
|
68
|
+
- **Make model choices visible.** Test actual JSON, image, and reasoning behavior, route structured output to a capable final model, and inspect stage usage in traces. Set limits on calls, context, output, concurrency, and deadlines.
|
|
69
|
+
|
|
70
|
+
## What Prism does
|
|
71
|
+
|
|
72
|
+
Prism is a model-composition proxy that serves the OpenAI Chat Completions API. A profile defines the physical models and workflow behind a public alias. You can choose a direct call, vision → text/reasoning, draft → review → synthesis, plain-text preparation → final answer, or source-backed evidence extraction → synthesis.
|
|
73
|
+
|
|
74
|
+
For example, `prism-balanced` uses free Nano for ordinary text and Super when JSON is required. `prism-vision-reasoning` uses Nano to inspect an image, then Super to answer from its observations. Your client selects the alias; Prism executes the configured stages and returns the result through the same endpoint.
|
|
75
|
+
|
|
76
|
+
Prism is alpha software. Observation-based preparation can lose information; source-backed evidence policies validate quote provenance, which does not prove correctness or recall. Qualify models on your own workload.
|
|
77
|
+
|
|
78
|
+
## How it works
|
|
79
|
+
|
|
80
|
+
**One call from your application. One or more model calls inside Prism. One response back.** Prism acts as a transparent proxy at the Chat Completions interface: your client selects a public model alias while Prism handles the configured stages. Models can run locally, behind cloud APIs, or across both.
|
|
81
|
+
|
|
82
|
+
```mermaid
|
|
83
|
+
flowchart TB
|
|
84
|
+
A["Your application<br/>One Chat Completions request"]
|
|
85
|
+
subgraph P["Prism · transparent model proxy"]
|
|
86
|
+
G["Check capabilities, context, and budgets"]
|
|
87
|
+
L{"Select a feasible policy<br/>Laya classification or a fixed profile"}
|
|
88
|
+
D["Direct model<br/>1 model call"]
|
|
89
|
+
W["Small or vision model<br/>Prepare observations"]
|
|
90
|
+
F["Final model<br/>Synthesize the answer"]
|
|
91
|
+
B["Draft model"]
|
|
92
|
+
R["Review model"]
|
|
93
|
+
S["Final model"]
|
|
94
|
+
V["Validate final output<br/>Record a metadata trace"]
|
|
95
|
+
G --> L
|
|
96
|
+
L -->|Direct| D
|
|
97
|
+
L -->|Prepare + synthesize: 2 calls| W
|
|
98
|
+
L -->|Draft + review + synthesize: 3 calls| B
|
|
99
|
+
W --> F
|
|
100
|
+
B --> R --> S
|
|
101
|
+
D --> V
|
|
102
|
+
F --> V
|
|
103
|
+
S --> V
|
|
104
|
+
end
|
|
105
|
+
A --> G
|
|
106
|
+
V --> O["One assistant response<br/>Same public API and model alias"]
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
The diagram shows three representative paths. Source-backed evidence policies can fan out across multiple workers, then synthesize their results. Every path stays within the profile's declared limits, and traces expose which physical models ran. The proxy keeps the client interface consistent; the answer, latency, and cost depend on the selected workflow.
|
|
110
|
+
|
|
111
|
+
### Request classification with Laya
|
|
112
|
+
|
|
113
|
+
Prism uses [Laya](https://github.com/NandhaKishorM/laya), a local typed-decision engine, to classify requests for routing and choose among eligible execution policies. The default checkpoint is `convaiinnovations/laya-typed-decisions`, prepared on CPU at server startup. Laya receives a bounded instruction sample and plan metadata; source documents remain outside its decision input.
|
|
114
|
+
|
|
115
|
+
Prism checks feasible plans before asking Laya to choose. A confident, valid choice selects an existing policy; abstention, low confidence, or decision-inference failure uses the feasible rules fallback. Fixed profiles and requests with a single eligible policy skip decision inference. Laya's confidence is a routing signal, not an answer-quality guarantee. See [execution policies](docs/execution-policies.md) for the full decision flow.
|
|
116
|
+
|
|
117
|
+
### Choose your cost–quality tradeoff
|
|
118
|
+
|
|
119
|
+
| Workflow | Cost and latency | Quality consideration |
|
|
120
|
+
|---|---|---|
|
|
121
|
+
| Direct | One model call, without preparation/review overhead | The chosen model handles the original request itself |
|
|
122
|
+
| Small/free preparation → final model | Can reduce premium input when source context is condensed; adds a worker call | Notes can omit facts or qualifications; validate task results |
|
|
123
|
+
| Vision preparation → final model | Adds image interpretation before text/reasoning synthesis | Enables a text-only final model to use images through potentially lossy observations |
|
|
124
|
+
| Draft → review → synthesis | Adds drafting and review calls | Review can catch problems, but improvements need workload evidence |
|
|
125
|
+
|
|
126
|
+
Use profiles to decide where to spend model work, then benchmark the result against a direct baseline. Cheaper input, stronger final models, and extra review each change the tradeoff; none establishes equivalent quality by itself. Optional [cost/power selection](docs/model-optimization.md) ranks feasible assignments using configured prices and operator ratings. The [live pilot](docs/evaluations/2026-10-04-openrouter/benchmark-results.md) shows measured savings alongside quality and latency regressions.
|
|
127
|
+
|
|
128
|
+
## Start with free OpenRouter models
|
|
129
|
+
|
|
130
|
+
Try the included free-model profiles with an OpenRouter key. Install from this checkout now; use `python -m pip install mirrorneuron-prism` after publication.
|
|
131
|
+
|
|
132
|
+
```sh
|
|
133
|
+
python -m pip install .
|
|
134
|
+
mkdir prism-demo && cd prism-demo
|
|
135
|
+
prism init --preset openrouter
|
|
136
|
+
export OPENROUTER_API_KEY='your-openrouter-key'
|
|
137
|
+
export PRISM_API_KEY='your-prism-client-secret'
|
|
138
|
+
prism validate
|
|
139
|
+
prism profiles
|
|
140
|
+
prism serve
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
First startup may download the required Laya checkpoint and prepares it on CPU. The server defaults to `http://127.0.0.1:8080`. The OpenRouter preset exclusively uses free Nano Omni, Super, and Ultra models; upstream credentials and free-tier quotas still apply.
|
|
144
|
+
|
|
145
|
+
```sh
|
|
146
|
+
curl --fail-with-body http://127.0.0.1:8080/v1/chat/completions \
|
|
147
|
+
-H "Authorization: Bearer $PRISM_API_KEY" -H 'Content-Type: application/json' \
|
|
148
|
+
-d '{"model":"prism-balanced","messages":[{"role":"user","content":"Explain decorators in Python briefly."}],"max_completion_tokens":4096}'
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
For explicit anonymous serving, use `prism serve --no-auth`. Upstream credentials remain required. Clients share anonymous trace access in this mode; use it on a trusted network.
|
|
152
|
+
|
|
153
|
+
## Pick a workflow
|
|
154
|
+
|
|
155
|
+
| Free-preset alias | Behavior |
|
|
156
|
+
|---|---|
|
|
157
|
+
| `prism-balanced` | Nano text; Super when JSON is required |
|
|
158
|
+
| `prism-vision-llm` / `prism-omni-llm` | Nano interprets images, Ultra writes the answer |
|
|
159
|
+
| `prism-vision-reasoning` | Nano interprets images, Super writes the answer |
|
|
160
|
+
| `prism-reasoning-image` / `prism-reasoning-omni` | Super drafts/reviews, Nano finishes; Super finishes JSON |
|
|
161
|
+
| `prism-llm-omni` | Ultra drafts, Super reviews, Nano finishes; Super finishes JSON |
|
|
162
|
+
| `prism-nano-synthesis` | Nano prepares text context, Super finishes |
|
|
163
|
+
| `prism` / `prism-evidence` | Automatic or fixed source-backed evidence routing |
|
|
164
|
+
|
|
165
|
+
Vision means image understanding with text output. Additional omni modalities and image generation are not implemented. Nano's direct alias deliberately rejects JSON requirements; profiles use an explicit `structured_output_model` instead.
|
|
166
|
+
|
|
167
|
+
For an image plus JSON output, choose a vision-synthesis alias such as `prism-vision-reasoning` so pixels reach Nano and structured final output comes from Super.
|
|
168
|
+
|
|
169
|
+
[Free-model setup and live results](docs/openrouter-nemotron-mix.md) · [Native OpenAI / Claude / Gemini examples](examples/standalone/providers/README.md)
|
|
170
|
+
|
|
171
|
+
## Keep your OpenAI client
|
|
172
|
+
|
|
173
|
+
```python
|
|
174
|
+
import os
|
|
175
|
+
from openai import OpenAI
|
|
176
|
+
|
|
177
|
+
client = OpenAI(base_url="http://127.0.0.1:8080/v1", api_key=os.environ["PRISM_API_KEY"])
|
|
178
|
+
answer = client.chat.completions.create(
|
|
179
|
+
model="prism-balanced",
|
|
180
|
+
messages=[{"role": "user", "content": "Return JSON with ok=true."}],
|
|
181
|
+
response_format={"type": "json_object"},
|
|
182
|
+
max_completion_tokens=4096,
|
|
183
|
+
)
|
|
184
|
+
print(answer.choices[0].message.content)
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
Chat Completions supports ordinary text, image inputs, tools on direct routes, and SSE. Multi-stage and JSON-constrained streams are delivered after validation. Responses API is not implemented. For a guaranteed requested shape, use JSON Schema and retain task-level checks.
|
|
188
|
+
|
|
189
|
+
## Inspect and qualify
|
|
190
|
+
|
|
191
|
+
```sh
|
|
192
|
+
prism --help
|
|
193
|
+
prism models
|
|
194
|
+
prism profiles --json > profiles.json
|
|
195
|
+
prism doctor --probe-backends
|
|
196
|
+
prism capacity --model prism-vision-reasoning
|
|
197
|
+
prism trace show prism-REQUEST_ID
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
Terminal output uses tables; redirected results are JSON. Use `--json`, `--output table`, or `NO_COLOR=1` explicitly. Inventory capabilities are declarations; capacity results come from live challenges and distinguish failures from inconclusive upstream errors.
|
|
201
|
+
|
|
202
|
+
The [live six-task pilot](docs/evaluations/2026-10-04-openrouter/benchmark-results.md) measured coding, copywriting, support, and summaries. Nine matched completed pairs showed **56.3% lower hypothetical premium token cost**, using free Nemotron tokens priced like GPT-6 Astra / Claude Opus. Across all attempts, acceptance fell **9/12 → 6/12** and mean latency rose **4.83s → 19.96s**. These are workload tradeoffs, not a production savings or frontier-model quality claim. [Qualified marketing narrative](docs/evaluations/2026-10-04-openrouter/marketing-narrative.md).
|
|
203
|
+
|
|
204
|
+
## Run with Docker
|
|
205
|
+
|
|
206
|
+
```sh
|
|
207
|
+
docker build -t mirrorneuron-prism:0.3.0 .
|
|
208
|
+
docker run --rm -p 127.0.0.1:8080:8080 \
|
|
209
|
+
-e OPENROUTER_API_KEY -e PRISM_API_KEY \
|
|
210
|
+
-v prism-huggingface:/home/prism/.cache/huggingface \
|
|
211
|
+
mirrorneuron-prism:0.3.0
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
Or run `docker compose up --build`. [Custom config, checkpoint caching, and anonymous Docker serving](docs/usage.md#docker).
|
|
215
|
+
|
|
216
|
+
## Documentation and development
|
|
217
|
+
|
|
218
|
+
| Guide | Covers |
|
|
219
|
+
|---|---|
|
|
220
|
+
| [Usage](docs/usage.md) | Installation, auth, CLI, JSON, Docker, local models, streaming, and traces |
|
|
221
|
+
| [Model configuration and capacity](docs/model-config-capacity.md) | LiteLLM transports, shared registries, and live probes |
|
|
222
|
+
| [Execution policies](docs/execution-policies.md) | Stage graphs, limits, and Laya routing |
|
|
223
|
+
| [Copyable curl examples](docs/flagship-curl-cases.md) | Requests exercised by integration tests |
|
|
224
|
+
| [Benchmarking](docs/benchmarking.md) | Reproducible runs and metric limitations |
|
|
225
|
+
| [Release instructions](docs/releasing.md) | Build, validate, install, and manually publish |
|
|
226
|
+
| [Implemented contract](docs/standalone-contract.md) | Guarantees and boundaries |
|
|
227
|
+
|
|
228
|
+
```sh
|
|
229
|
+
python -m pip install '.[dev]'
|
|
230
|
+
ruff check src tests examples
|
|
231
|
+
python -m pytest --cov=prism --cov-report=term-missing -q
|
|
232
|
+
python -m pytest tests/standalone -q -m integration -o addopts=''
|
|
233
|
+
python -m build
|
|
234
|
+
python -m twine check dist/mirrorneuron_prism-0.3.0*
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
CI exercises Python 3.11–3.13. Live provider qualification is separate from deterministic tests. The release workflow is manual; the prepared distribution ships bundled presets, benchmark fixtures, typing metadata, and the MIT license.
|
|
238
|
+
|
|
239
|
+
## Contributing and support
|
|
240
|
+
|
|
241
|
+
Bug reports, documentation improvements, provider fixtures, and focused pull requests are welcome. Read the [contribution guide](CONTRIBUTING.md) for setup, validation, and review expectations. For bugs or feature requests, [open an issue](https://github.com/homerquan/mirrorneuron-prism/issues) with a minimal reproducible example. See the [security policy](SECURITY.md) for reporting vulnerabilities privately.
|
|
242
|
+
|
|
243
|
+
## License
|
|
244
|
+
|
|
245
|
+
Prism is open source under the [MIT License](LICENSE). Copyright © 2026 mirrorneuron-prism.
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
# Prism
|
|
2
|
+
|
|
3
|
+
[](LICENSE)
|
|
4
|
+
[](pyproject.toml)
|
|
5
|
+
[](https://github.com/homerquan/mirrorneuron-prism/actions/workflows/ci.yml)
|
|
6
|
+
[](docs/standalone-contract.md)
|
|
7
|
+
|
|
8
|
+
**Turn local models and cloud LLMs into one AI API.**
|
|
9
|
+
|
|
10
|
+

|
|
11
|
+
|
|
12
|
+
[Why Prism](#why-prism) · [How it works](#how-it-works) · [Quick start](#start-with-free-openrouter-models) · [Documentation](#documentation-and-development) · [Contributing](CONTRIBUTING.md)
|
|
13
|
+
|
|
14
|
+
Prism lets several models work together behind one OpenAI-compatible endpoint. Connect your application once, then choose a profile that combines the models you need: a small model to prepare context, a vision model to read an image, or a larger model to review and finish the answer. Your application receives one assistant response.
|
|
15
|
+
|
|
16
|
+
Prism is a component of [MirrorNeuron](https://www.mirrorneuron.io), built to make AI workflows useful on infrastructure you control. It helps solve local AI by composing available models into a service your applications can use. You can also run Prism independently: combine local servers with OpenRouter, OpenAI, Claude, Gemini, and other APIs supported by LiteLLM, using local models, cloud models, or a mix of both.
|
|
17
|
+
|
|
18
|
+
Distribution: **`mirrorneuron-prism`** · import: **`prism`** · command: **`prism`** · Python **3.11+** · MIT
|
|
19
|
+
|
|
20
|
+
## Why Prism
|
|
21
|
+
|
|
22
|
+
AI applications need different capabilities for different jobs. A coding assistant may benefit from drafting and review; a support tool needs structured answers; an image workflow needs vision before reasoning. Prism gives you a place to compose those capabilities while your application keeps the same API.
|
|
23
|
+
|
|
24
|
+
- **Keep your application simple.** Use your existing OpenAI client and switch workflows by model alias. Define physical models once and reuse them across profiles.
|
|
25
|
+
- **Put each model to useful work.** Let a small or free model prepare context, a vision model interpret pixels, and a selected final model write the answer. Measure cost, latency, and task quality to find a combination that fits your workload.
|
|
26
|
+
- **Bring your own compute and providers.** Start with local inference, cloud APIs, or both. Run Prism as a Python package or Docker service; MirrorNeuron is optional for standalone use.
|
|
27
|
+
- **Make model choices visible.** Test actual JSON, image, and reasoning behavior, route structured output to a capable final model, and inspect stage usage in traces. Set limits on calls, context, output, concurrency, and deadlines.
|
|
28
|
+
|
|
29
|
+
## What Prism does
|
|
30
|
+
|
|
31
|
+
Prism is a model-composition proxy that serves the OpenAI Chat Completions API. A profile defines the physical models and workflow behind a public alias. You can choose a direct call, vision → text/reasoning, draft → review → synthesis, plain-text preparation → final answer, or source-backed evidence extraction → synthesis.
|
|
32
|
+
|
|
33
|
+
For example, `prism-balanced` uses free Nano for ordinary text and Super when JSON is required. `prism-vision-reasoning` uses Nano to inspect an image, then Super to answer from its observations. Your client selects the alias; Prism executes the configured stages and returns the result through the same endpoint.
|
|
34
|
+
|
|
35
|
+
Prism is alpha software. Observation-based preparation can lose information; source-backed evidence policies validate quote provenance, which does not prove correctness or recall. Qualify models on your own workload.
|
|
36
|
+
|
|
37
|
+
## How it works
|
|
38
|
+
|
|
39
|
+
**One call from your application. One or more model calls inside Prism. One response back.** Prism acts as a transparent proxy at the Chat Completions interface: your client selects a public model alias while Prism handles the configured stages. Models can run locally, behind cloud APIs, or across both.
|
|
40
|
+
|
|
41
|
+
```mermaid
|
|
42
|
+
flowchart TB
|
|
43
|
+
A["Your application<br/>One Chat Completions request"]
|
|
44
|
+
subgraph P["Prism · transparent model proxy"]
|
|
45
|
+
G["Check capabilities, context, and budgets"]
|
|
46
|
+
L{"Select a feasible policy<br/>Laya classification or a fixed profile"}
|
|
47
|
+
D["Direct model<br/>1 model call"]
|
|
48
|
+
W["Small or vision model<br/>Prepare observations"]
|
|
49
|
+
F["Final model<br/>Synthesize the answer"]
|
|
50
|
+
B["Draft model"]
|
|
51
|
+
R["Review model"]
|
|
52
|
+
S["Final model"]
|
|
53
|
+
V["Validate final output<br/>Record a metadata trace"]
|
|
54
|
+
G --> L
|
|
55
|
+
L -->|Direct| D
|
|
56
|
+
L -->|Prepare + synthesize: 2 calls| W
|
|
57
|
+
L -->|Draft + review + synthesize: 3 calls| B
|
|
58
|
+
W --> F
|
|
59
|
+
B --> R --> S
|
|
60
|
+
D --> V
|
|
61
|
+
F --> V
|
|
62
|
+
S --> V
|
|
63
|
+
end
|
|
64
|
+
A --> G
|
|
65
|
+
V --> O["One assistant response<br/>Same public API and model alias"]
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
The diagram shows three representative paths. Source-backed evidence policies can fan out across multiple workers, then synthesize their results. Every path stays within the profile's declared limits, and traces expose which physical models ran. The proxy keeps the client interface consistent; the answer, latency, and cost depend on the selected workflow.
|
|
69
|
+
|
|
70
|
+
### Request classification with Laya
|
|
71
|
+
|
|
72
|
+
Prism uses [Laya](https://github.com/NandhaKishorM/laya), a local typed-decision engine, to classify requests for routing and choose among eligible execution policies. The default checkpoint is `convaiinnovations/laya-typed-decisions`, prepared on CPU at server startup. Laya receives a bounded instruction sample and plan metadata; source documents remain outside its decision input.
|
|
73
|
+
|
|
74
|
+
Prism checks feasible plans before asking Laya to choose. A confident, valid choice selects an existing policy; abstention, low confidence, or decision-inference failure uses the feasible rules fallback. Fixed profiles and requests with a single eligible policy skip decision inference. Laya's confidence is a routing signal, not an answer-quality guarantee. See [execution policies](docs/execution-policies.md) for the full decision flow.
|
|
75
|
+
|
|
76
|
+
### Choose your cost–quality tradeoff
|
|
77
|
+
|
|
78
|
+
| Workflow | Cost and latency | Quality consideration |
|
|
79
|
+
|---|---|---|
|
|
80
|
+
| Direct | One model call, without preparation/review overhead | The chosen model handles the original request itself |
|
|
81
|
+
| Small/free preparation → final model | Can reduce premium input when source context is condensed; adds a worker call | Notes can omit facts or qualifications; validate task results |
|
|
82
|
+
| Vision preparation → final model | Adds image interpretation before text/reasoning synthesis | Enables a text-only final model to use images through potentially lossy observations |
|
|
83
|
+
| Draft → review → synthesis | Adds drafting and review calls | Review can catch problems, but improvements need workload evidence |
|
|
84
|
+
|
|
85
|
+
Use profiles to decide where to spend model work, then benchmark the result against a direct baseline. Cheaper input, stronger final models, and extra review each change the tradeoff; none establishes equivalent quality by itself. Optional [cost/power selection](docs/model-optimization.md) ranks feasible assignments using configured prices and operator ratings. The [live pilot](docs/evaluations/2026-10-04-openrouter/benchmark-results.md) shows measured savings alongside quality and latency regressions.
|
|
86
|
+
|
|
87
|
+
## Start with free OpenRouter models
|
|
88
|
+
|
|
89
|
+
Try the included free-model profiles with an OpenRouter key. Install from this checkout now; use `python -m pip install mirrorneuron-prism` after publication.
|
|
90
|
+
|
|
91
|
+
```sh
|
|
92
|
+
python -m pip install .
|
|
93
|
+
mkdir prism-demo && cd prism-demo
|
|
94
|
+
prism init --preset openrouter
|
|
95
|
+
export OPENROUTER_API_KEY='your-openrouter-key'
|
|
96
|
+
export PRISM_API_KEY='your-prism-client-secret'
|
|
97
|
+
prism validate
|
|
98
|
+
prism profiles
|
|
99
|
+
prism serve
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
First startup may download the required Laya checkpoint and prepares it on CPU. The server defaults to `http://127.0.0.1:8080`. The OpenRouter preset exclusively uses free Nano Omni, Super, and Ultra models; upstream credentials and free-tier quotas still apply.
|
|
103
|
+
|
|
104
|
+
```sh
|
|
105
|
+
curl --fail-with-body http://127.0.0.1:8080/v1/chat/completions \
|
|
106
|
+
-H "Authorization: Bearer $PRISM_API_KEY" -H 'Content-Type: application/json' \
|
|
107
|
+
-d '{"model":"prism-balanced","messages":[{"role":"user","content":"Explain decorators in Python briefly."}],"max_completion_tokens":4096}'
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
For explicit anonymous serving, use `prism serve --no-auth`. Upstream credentials remain required. Clients share anonymous trace access in this mode; use it on a trusted network.
|
|
111
|
+
|
|
112
|
+
## Pick a workflow
|
|
113
|
+
|
|
114
|
+
| Free-preset alias | Behavior |
|
|
115
|
+
|---|---|
|
|
116
|
+
| `prism-balanced` | Nano text; Super when JSON is required |
|
|
117
|
+
| `prism-vision-llm` / `prism-omni-llm` | Nano interprets images, Ultra writes the answer |
|
|
118
|
+
| `prism-vision-reasoning` | Nano interprets images, Super writes the answer |
|
|
119
|
+
| `prism-reasoning-image` / `prism-reasoning-omni` | Super drafts/reviews, Nano finishes; Super finishes JSON |
|
|
120
|
+
| `prism-llm-omni` | Ultra drafts, Super reviews, Nano finishes; Super finishes JSON |
|
|
121
|
+
| `prism-nano-synthesis` | Nano prepares text context, Super finishes |
|
|
122
|
+
| `prism` / `prism-evidence` | Automatic or fixed source-backed evidence routing |
|
|
123
|
+
|
|
124
|
+
Vision means image understanding with text output. Additional omni modalities and image generation are not implemented. Nano's direct alias deliberately rejects JSON requirements; profiles use an explicit `structured_output_model` instead.
|
|
125
|
+
|
|
126
|
+
For an image plus JSON output, choose a vision-synthesis alias such as `prism-vision-reasoning` so pixels reach Nano and structured final output comes from Super.
|
|
127
|
+
|
|
128
|
+
[Free-model setup and live results](docs/openrouter-nemotron-mix.md) · [Native OpenAI / Claude / Gemini examples](examples/standalone/providers/README.md)
|
|
129
|
+
|
|
130
|
+
## Keep your OpenAI client
|
|
131
|
+
|
|
132
|
+
```python
|
|
133
|
+
import os
|
|
134
|
+
from openai import OpenAI
|
|
135
|
+
|
|
136
|
+
client = OpenAI(base_url="http://127.0.0.1:8080/v1", api_key=os.environ["PRISM_API_KEY"])
|
|
137
|
+
answer = client.chat.completions.create(
|
|
138
|
+
model="prism-balanced",
|
|
139
|
+
messages=[{"role": "user", "content": "Return JSON with ok=true."}],
|
|
140
|
+
response_format={"type": "json_object"},
|
|
141
|
+
max_completion_tokens=4096,
|
|
142
|
+
)
|
|
143
|
+
print(answer.choices[0].message.content)
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
Chat Completions supports ordinary text, image inputs, tools on direct routes, and SSE. Multi-stage and JSON-constrained streams are delivered after validation. Responses API is not implemented. For a guaranteed requested shape, use JSON Schema and retain task-level checks.
|
|
147
|
+
|
|
148
|
+
## Inspect and qualify
|
|
149
|
+
|
|
150
|
+
```sh
|
|
151
|
+
prism --help
|
|
152
|
+
prism models
|
|
153
|
+
prism profiles --json > profiles.json
|
|
154
|
+
prism doctor --probe-backends
|
|
155
|
+
prism capacity --model prism-vision-reasoning
|
|
156
|
+
prism trace show prism-REQUEST_ID
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
Terminal output uses tables; redirected results are JSON. Use `--json`, `--output table`, or `NO_COLOR=1` explicitly. Inventory capabilities are declarations; capacity results come from live challenges and distinguish failures from inconclusive upstream errors.
|
|
160
|
+
|
|
161
|
+
The [live six-task pilot](docs/evaluations/2026-10-04-openrouter/benchmark-results.md) measured coding, copywriting, support, and summaries. Nine matched completed pairs showed **56.3% lower hypothetical premium token cost**, using free Nemotron tokens priced like GPT-6 Astra / Claude Opus. Across all attempts, acceptance fell **9/12 → 6/12** and mean latency rose **4.83s → 19.96s**. These are workload tradeoffs, not a production savings or frontier-model quality claim. [Qualified marketing narrative](docs/evaluations/2026-10-04-openrouter/marketing-narrative.md).
|
|
162
|
+
|
|
163
|
+
## Run with Docker
|
|
164
|
+
|
|
165
|
+
```sh
|
|
166
|
+
docker build -t mirrorneuron-prism:0.3.0 .
|
|
167
|
+
docker run --rm -p 127.0.0.1:8080:8080 \
|
|
168
|
+
-e OPENROUTER_API_KEY -e PRISM_API_KEY \
|
|
169
|
+
-v prism-huggingface:/home/prism/.cache/huggingface \
|
|
170
|
+
mirrorneuron-prism:0.3.0
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
Or run `docker compose up --build`. [Custom config, checkpoint caching, and anonymous Docker serving](docs/usage.md#docker).
|
|
174
|
+
|
|
175
|
+
## Documentation and development
|
|
176
|
+
|
|
177
|
+
| Guide | Covers |
|
|
178
|
+
|---|---|
|
|
179
|
+
| [Usage](docs/usage.md) | Installation, auth, CLI, JSON, Docker, local models, streaming, and traces |
|
|
180
|
+
| [Model configuration and capacity](docs/model-config-capacity.md) | LiteLLM transports, shared registries, and live probes |
|
|
181
|
+
| [Execution policies](docs/execution-policies.md) | Stage graphs, limits, and Laya routing |
|
|
182
|
+
| [Copyable curl examples](docs/flagship-curl-cases.md) | Requests exercised by integration tests |
|
|
183
|
+
| [Benchmarking](docs/benchmarking.md) | Reproducible runs and metric limitations |
|
|
184
|
+
| [Release instructions](docs/releasing.md) | Build, validate, install, and manually publish |
|
|
185
|
+
| [Implemented contract](docs/standalone-contract.md) | Guarantees and boundaries |
|
|
186
|
+
|
|
187
|
+
```sh
|
|
188
|
+
python -m pip install '.[dev]'
|
|
189
|
+
ruff check src tests examples
|
|
190
|
+
python -m pytest --cov=prism --cov-report=term-missing -q
|
|
191
|
+
python -m pytest tests/standalone -q -m integration -o addopts=''
|
|
192
|
+
python -m build
|
|
193
|
+
python -m twine check dist/mirrorneuron_prism-0.3.0*
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
CI exercises Python 3.11–3.13. Live provider qualification is separate from deterministic tests. The release workflow is manual; the prepared distribution ships bundled presets, benchmark fixtures, typing metadata, and the MIT license.
|
|
197
|
+
|
|
198
|
+
## Contributing and support
|
|
199
|
+
|
|
200
|
+
Bug reports, documentation improvements, provider fixtures, and focused pull requests are welcome. Read the [contribution guide](CONTRIBUTING.md) for setup, validation, and review expectations. For bugs or feature requests, [open an issue](https://github.com/homerquan/mirrorneuron-prism/issues) with a minimal reproducible example. See the [security policy](SECURITY.md) for reporting vulnerabilities privately.
|
|
201
|
+
|
|
202
|
+
## License
|
|
203
|
+
|
|
204
|
+
Prism is open source under the [MIT License](LICENSE). Copyright © 2026 mirrorneuron-prism.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Security policy
|
|
2
|
+
|
|
3
|
+
## Reporting a vulnerability
|
|
4
|
+
|
|
5
|
+
If the repository has GitHub private vulnerability reporting enabled, use **Security → Report a vulnerability** on [the repository's Security page](https://github.com/homerquan/mirrorneuron-prism/security). Otherwise, contact a repository maintainer through their GitHub profile to arrange a private reporting channel. If no private contact method is available, open an issue requesting one without disclosing the vulnerability or exploit.
|
|
6
|
+
|
|
7
|
+
Include the affected version, a minimal reproduction, the expected security boundary, and the observed impact. Do not include real API keys or private prompts. Public bug reports are appropriate for ordinary functional problems; keep vulnerability details private until maintainers have assessed them and arranged disclosure.
|
|
8
|
+
|
|
9
|
+
## Project status and scope
|
|
10
|
+
|
|
11
|
+
Prism is alpha software. Security fixes are prioritized for the current development revision; no long-term support window or response-time guarantee is established. Relevant boundaries include client authentication, credential isolation, trace access, endpoint admission, request/resource limits, and handling of untrusted model artifacts.
|
|
12
|
+
|
|
13
|
+
Client authentication is enabled by default. Explicit `--no-auth` serving shares anonymous trace access and is intended for trusted environments. Upstream credentials remain independent. See the [usage guide](docs/usage.md) and [implemented contract](docs/standalone-contract.md) for deployment behavior and limitations.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
services:
|
|
2
|
+
prism:
|
|
3
|
+
build: .
|
|
4
|
+
ports:
|
|
5
|
+
- "127.0.0.1:8080:8080"
|
|
6
|
+
environment:
|
|
7
|
+
OPENROUTER_API_KEY: ${OPENROUTER_API_KEY:?set OPENROUTER_API_KEY}
|
|
8
|
+
PRISM_API_KEY: ${PRISM_API_KEY:?set PRISM_API_KEY, or use docker run with --no-auth}
|
|
9
|
+
volumes:
|
|
10
|
+
- prism-huggingface:/home/prism/.cache/huggingface
|
|
11
|
+
restart: unless-stopped
|
|
12
|
+
volumes:
|
|
13
|
+
prism-huggingface:
|
|
Binary file
|