jbr-inference
A local inference service that exposes one OpenAI-compatible API and routes each model to its own backend: a GPU backend (llama.cpp server, CUDA) or an NPU backend (OpenVINO), plus an in-memory fake backend for development and tests.
Why
Running several local models on different accelerators usually means one server and one client convention per
backend. jbr-inference puts a single HTTP contract in front of them: a registry maps each model id to a backend,
a router dispatches the request, and a backend that is not running answers 503 instead of crashing the service.
Mixed GPU and NPU use is not a coded feature: it follows from the registry, each backend staying in its own process
and its own virtual environment.
Install
python -m venv .venv && . .venv/bin/activate
pip install jbr-inference
The base package only needs FastAPI, Uvicorn, HTTPX and Pydantic. The real backends are optional extras
(jbr-inference[gpu], jbr-inference[npu]) and are meant to live in separate virtual environments.
Quick start
Runs as-is after the install above, without cloning this repository:
# Start the service with the built-in fake backend (no GPU, no NPU, no model weights)
python -m uvicorn jbr_inference.serving.app:app --host 127.0.0.1 --port 8000 &
sleep 3
# List the registered models
curl -s http://127.0.0.1:8000/v1/models
# Chat through the fake backend (deterministic answer, no network access)
curl -s http://127.0.0.1:8000/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{"model": "fake-chat-7b", "messages": [{"role": "user", "content": "hello"}]}'
kill $!
The registry also lists GPU and NPU models: they are routable, but answer 503 backend_unavailable until the
matching backend server is running.
Architecture
jbr_inference/serving/: the common contract (API, router, error envelope) and the fake backend.jbr_inference/models/: the model-to-backend registry (registry.toml) and quantization policies.jbr_inference/backends/gpu/: adapter and lifecycle manager for a local llama.cpp server.jbr_inference/backends/npu/: OpenVINO service for a static-shape encoder, and its conversion script.jbr_inference/bench/: a benchmark harness that calls the common API, never a backend directly.
The service listens on loopback only. The management API (/admin/*) is only active when
JBR_INFERENCE_ENABLE_ADMIN=1: otherwise its router is not mounted, and a request to /admin/* without a loopback
Origin header is refused with 403 (with one, it gets a plain 404). When enabled, every /admin/* request
still has to carry a loopback Origin header.
Measurements
One small run drives the common API against a real GPU model and a real NPU model, with invented prompts and texts (3 requests each, 0 errors); the two figures measure different tasks and are not comparable with each other (details).
Limitations
- The GPU and NPU backends were exercised on a single machine (an NVIDIA GPU under WSL2, an Intel NPU through a native Windows OpenVINO service). Other hardware and operating systems are untested.
- The NPU backend needs static input shapes (a fixed sequence length chosen at export time).
- The
usagetoken counters returned by the real backends are zero: they are not wired yet. - The GPU throughput in the benchmark is an estimate (about 4 characters per token), not a tokenizer count.
- Model weights are never shipped: they are fetched by the user, as described in the backend READMEs of the source tree.
Language and contributions
Internal docs and code comments are in French. The README, package metadata and changelog are in English.
This is a mirror repository: contributions are reviewed and ported by hand. Issues are welcome; pull requests are read but not merged as such, and a change that is accepted lands in a later release. Security reports: see SECURITY.md.
License
Metadata
Release files for jbr-inference 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| jbr_inference-0.1.0.tar.gz | 275.5 kB | With provenance | Details for jbr_inference-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| jbr_inference-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for jbr_inference-0.1.0-py3-none-any.whl |
Total release size: 344.5 kB
Release files / jbr_inference-0.1.0.tar.gz
| Download URL | jbr_inference-0.1.0.tar.gz |
|---|---|
| Size | 275.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d803d136a2c7cfbe24b5c79edd9a7d2a55799cfe333c0f3ae8ddc7270e442ade
|
|
BLAKE2b-256 checksum How to use checksums |
9a64d5ab2889644667bc997805337feb49ef4801c60efbd55c2c06cde14f7c4d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 4, 2026.
Transparency logRelease files / jbr_inference-0.1.0-py3-none-any.whl
| Download URL | jbr_inference-0.1.0-py3-none-any.whl |
|---|---|
| Size | 69.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9da99706e5bdc35a8c2352ecfb84e9ff8be082ae878c60d4bb8f28d7bf8021ab
|
|
BLAKE2b-256 checksum How to use checksums |
5da1620a88c2fe468c480519ab401daf0dcfb588e1cb952002f50160695cc996
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 4, 2026.
Transparency logSecurity for jbr-inference 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for jbr_inference-0.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 4, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.