httpstan
HTTP-based interface to Stan, a package for Bayesian inference.
What it is and what it does
httpstan is a shim that exposes the Stan C++ library's Bayesian inference capabilities through an HTTP 1.1 REST API. It runs as a local server (by default on port 8080) and accepts HTTP requests to compile Stan probabilistic models and draw samples from them. The package is designed primarily for developers building frontends or tools that need to call Stan functionality over the network without direct C++ integration.
The package provides model caching, sample caching, and parallel sampling capabilities beyond what a basic command-line interface offers. It depends on aiohttp, marshmallow, webargs, numpy, appdirs, and setuptools. Installation requires a C++ compiler and is supported on Linux and macOS with x86-64 CPUs; Python 3.12 or later is required.
Use it for:
- Building web-based Bayesian analysis tools that need to offload Stan computations to a backend server
- Creating language-agnostic frontends to Stan by wrapping HTTP calls instead of requiring C++ bindings
- Running Stan models in containerized or distributed environments where HTTP communication is preferred
- Caching compiled models and samples to avoid recompilation and resampling in iterative analysis workflows
- Enabling parallel sampling across multiple cores through the HTTP interface without manual threading code
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
httpstan provides an HTTP REST interface to the Stan C++ library for Bayesian inference, allowing clients to compile Stan models and draw samples via HTTP requests rather than direct C++ calls.
Yes, if you need to expose Stan's Bayesian inference capabilities over HTTP or are building a tool that requires remote Stan access. The package is actively maintained, has no known vulnerabilities, and uses a permissive license. Install friction is moderate due to C++ compiler requirements and platform-specific wheels, but prebuilt binaries exist for common configurations. Not suitable if you need Windows support or non-x86-64 architectures without building from source.
Install
httpstan on PyPI
pip
pip install httpstanuv
uv add httpstanpoetry
poetry add httpstanInstalling httpstan
Before you install
Medium install friction due to compiled wheels for specific Python versions (3.12, 3.13, 3.14) and platform combinations (macOS ARM64, Linux x86-64). Requires a C++ compiler (gcc ≥9.0 or clang ≥10.0) on the system. Package is actively maintained with recent releases.
License in practice
ISC License is permissive, allowing commercial and private use with minimal restrictions. No notable licensing constraints for typical use.
Quickstart
$ python3 -m pip install httpstan
$ python3 -m httpstan
# In another terminal:
$ curl -H "Content-Type: application/json" \
--data '{"program_code":"parameters {real y;} model {y ~ normal(0,1);"}' \
http://localhost:8080/v1/models
Requires Linux or macOS, x86-64 CPU, and C++ compiler (gcc ≥9.0 or clang ≥10.0). Python 3.12 or later.
Verify before relying
- Whether prebuilt wheels cover all common deployment targets or if source builds are frequently needed
- Performance characteristics and typical latency for model compilation and sampling operations
- Concurrent request handling limits and scalability under load
Package facts
| License | ISC (permissive) |
| Python support | supports the current Python release (<4.0,>=3.12) |
| Install friction | medium — platform-specific wheel |
| Runtime dependencies | 6 — aiohttp, appdirs, marshmallow, numpy, setuptools, webargs |
| Maintenance | actively maintained — 16 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 1,308,109/month — #4,078 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: httpstan-4.17.0-cp312-cp312-macosx_14_0_arm64.whl; httpstan-4.17.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl; httpstan-4.17.0-cp313-cp313-macosx_14_0_arm64.whl; httpstan-4.17.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl; httpstan-4.17.0-cp314-cp314-macosx_14_0_arm64.whl; httpstan-4.17.0-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Tags
More Scientific/Engineering packages
NumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
pandaspandas provides fast, flexible data structures…
permissive · top 100 on PyPI
scipyscipy provides numerical algorithms for…
permissive · top 100 on PyPI
scikit-learnscikit-learn provides a comprehensive Python…
permissive · top 1,000 on PyPI
dilldill extends Python's pickle module to…
permissive · top 1,000 on PyPI
multiprocessMultiprocess is an enhanced fork of Python's…
permissive · top 1,000 on PyPI
pystanPyStan provides a Python interface to Stan for…
permissive · top 5,000 on PyPI
cmdstanpyCmdStanPy provides a pure-Python interface to…
permissive · top 5,000 on PyPI
nutpienutpie provides a fast NUTS sampler for…
permissive · top 15,000 on PyPI
pymc3PyMC3 is a Python package for Bayesian…
permissive · top 15,000 on PyPI
emceeemcee implements affine-invariant ensemble…
permissive · top 5,000 on PyPI
tensorflow-probabilityTensorFlow Probability provides probabilistic…
permissive · top 5,000 on PyPI
pymcPyMC is a Python package for Bayesian…
permissive · top 5,000 on PyPI
numpyroNumPyro is a probabilistic programming library…
permissive · top 15,000 on PyPI
pymc-extrasExtends PyMC with specialized distributions,…
permissive · top 15,000 on PyPI
stanioStanIO converts Python dictionaries to…
permissive · top 5,000 on PyPI