SZL Inference Gateway
Production x402-metered LLM inference on SaladCloud GPUs. This repository is the complete source of the gateway behind inference.a-11-oy.com: the container boot recipe, supervision and diagnostic fallback, the Cloudflare tunnel wiring, and a fail-closed Python probe used to verify the gateway from the outside.
Measured live
Observed from the public internet (the same probe this package ships):
GET /health→ HTTP 200{"status":"ok"}GET /v1/models→ HTTP 200, modelternary-bonsai-2-27b-pq2_0(26.9B parameters, GGUFPQ2_0quantization)GET /→ HTTP 200 llama.cpp web UI- Unpaid
POST /v1/chat/completions→ HTTP 402 x402 v2 payment challenge (USDC on Base, $0.02 per request)
Scope: reachability and gateway posture only. No quality, latency, SLA, or paid-receipt claim is made here.
Architecture
Public client
| HTTPS
v
Cloudflare zone (a-11-oy.com)
|- x402 monetization worker (zone-wide; payment challenge on POST routes)
|- Cloudflare Tunnel (cloudflared; tunnel token at runtime, never committed)
v
SaladCloud GPU container (RTX 4090-class)
|- llama-server (PrismML-Eng llama.cpp fork, CUDA 12.8 build)
| model: Ternary-Bonsai-2-27B-PQ2_0 (7,206,168,928 bytes, from the Hugging Face Hub)
|- supervision loop (30 s; restarts llama-server / cloudflared)
|- diagnostic fallback server (port 11434 while llama-server is down)
Why a llama.cpp fork
Mainline llama.cpp (b12359 at the time of the cutover) cannot load the PQ2_0 quantization family. The PrismML-Eng fork exists for exactly this quant class. The recipe pins release prism-b12128-d7b2896 (bin-linux-cuda-12.8-x64).
Deploy
- Create a SaladCloud container: GPU class >= RTX 4090, instance storage >= 12 GB. Instance storage persists across config-roll restarts, so the 7.2 GB model downloads once.
- Set the environment:
CLOUDFLARED_TOKEN= your cloudflared tunnel run token. Never commit tokens; the deployed instance receives it at runtime. - Container command:
bash -lc recipe/entrypoint.sh.
The recipe's boot order is the load-bearing part: model first, server second. Nothing serves until the full model file is on disk (resume + retry + size gate), the server binary comes from the pinned fork release, all CUDA shared objects are copied onto the loader path next to the binary, and a 30 s supervision loop restarts whatever dies. If the inference server cannot come up, a diagnostic JSON server parks on the port so health probes get an honest diagnosis instead of a dead port.
Cloudflare + x402 monetization
The monetization worker is zone-wide: it follows any origin behind the zone automatically, so cutover to this origin was a single DNS record change (CNAME to the tunnel) and rollback is the same single DNS PATCH back. Pricing lives in the worker (USDC on Base, $0.02 per request). See the Cloudflare monetization gateway docs and the x402 specification.
Python package
pip install szl-inference-gateway
python -m szl_inference_gateway --base https://inference.a-11-oy.com
Prints a fail-closed JSON receipt of the gateway posture (health, served model IDs, x402 challenge details: network, asset, pay-to, amount). Exit code is 1 unless the gateway is healthy. No third-party dependencies; standard library only.
Repository layout
recipe/entrypoint.sh— the v7 container boot recipe (as deployed)recipe/diag.py— diagnostic fallback serversrc/szl_inference_gateway/— posture probe packagetests/— offline tests (pure parsing; no network).github/workflows/publish-pypi.yml— canonical SZL PyPI release path (Trusted Publishing via OIDC; no API tokens anywhere)
Scope & limits
This repository documents and reproduces the gateway. It does not claim model quality, SLA, uptime, or paid-transaction correctness beyond the receipts linked above. Fail-closed: the probe reports what it measured, or an error - never a fake ready state.
License
Apache-2.0 (see LICENSE). Third-party components used by deployments of this recipe: llama.cpp (MIT, PrismML-Eng fork build), cloudflared (Cloudflare), and the Ternary-Bonsai-2-27B model weights, which carry their own license on the Hugging Face Hub.
Metadata
Release files for szl-inference-gateway 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 |
|---|---|---|---|---|
| szl_inference_gateway-0.1.0.tar.gz | 11.4 kB | With provenance | Details for szl_inference_gateway-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| szl_inference_gateway-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for szl_inference_gateway-0.1.0-py3-none-any.whl |
Total release size: 23.1 kB
Release files / szl_inference_gateway-0.1.0.tar.gz
| Download URL | szl_inference_gateway-0.1.0.tar.gz |
|---|---|
| Size | 11.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
23ded6fb282326682f2b7edb522aa32887732402f7372c4c07ff60ea15746689
|
|
BLAKE2b-256 checksum How to use checksums |
5484666be28f8f0d19391c41e5b2bd6a9d5ea76579f162bcd8cabe43306f7583
|
| 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 Nov 19, 2026.
Transparency logRelease files / szl_inference_gateway-0.1.0-py3-none-any.whl
| Download URL | szl_inference_gateway-0.1.0-py3-none-any.whl |
|---|---|
| Size | 11.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4d26f772067f66bf8e273025b65ddeac05ece11fbe7a53a40faebae48e6ea81c
|
|
BLAKE2b-256 checksum How to use checksums |
15441d083feae5da29e0ee14a9faa67c601ae268495f5a99675b1dca760ecbbc
|
| 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 Nov 19, 2026.
Transparency logSecurity for szl-inference-gateway 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 szl_inference_gateway-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 Nov 19, 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.