Skip to main content

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 usage token 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

Apache License 2.0, see LICENSE and NOTICE.

Metadata

Release files for jbr-inference 0.1.1

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

Source distribution (sdist)

Source distribution for jbr-inference 0.1.1
File Size Uploaded Provenance Actions
jbr_inference-0.1.1.tar.gz 274.2 kB With provenance Details for jbr_inference-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for jbr-inference 0.1.1
File Interpreter ABI Platform Actions
jbr_inference-0.1.1-py3-none-any.whl Python 3 none any Details for jbr_inference-0.1.1-py3-none-any.whl

Total release size: 343.2 kB

Release files / jbr_inference-0.1.1.tar.gz

Download URL jbr_inference-0.1.1.tar.gz
Size 274.2 kB
Tags Source
SHA-256 checksum
How to use checksums
00c58ff5bdbb11092159dd65293651cece3864f9cdc2a702edbd2ef91c5c8408
BLAKE2b-256 checksum
How to use checksums
69fab340da148a36522c5bcf805d66a54f2b2a4639b54e6f991774bc9fc9841c
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 log

Release files / jbr_inference-0.1.1-py3-none-any.whl

Download URL jbr_inference-0.1.1-py3-none-any.whl
Size 69.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
caccfebaa33161208afd4b769df41150f52690fca05fdd815e5837ccb7f9fee3
BLAKE2b-256 checksum
How to use checksums
17fee51949cac4e2dfcfd2861a57c7f21bdea1ed8f2544128df0eded4b78ff5e
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 log

Security for jbr-inference 0.1.1

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.

Select from 2 files

Attestation for jbr_inference-0.1.1.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 log

A 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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page