InferKit - Deploy any AI function in 3 lines
Library for ML / Vision / LLM / Agent. No FastAPI boilerplate needed.
Install
pip install inferkit # core (no Pillow)
pip install inferkit[vision] # + Pillow for image in/out
pip install inferkit[torch,transformers] # heavy ML stacks
pip install -e .[dev] # local dev
Usage - 3 lines
# my_model.py
from inferkit import infer
@infer
async def run(payload, files=None):
# payload: {"text": "..."} files: list[bytes] for images/audio
return {"output": f"echo: {payload.get('text')}"}
@infer.stream # optional for LLM streaming
async def run_stream(payload):
for tok in payload.get("text","").split():
yield tok + " "
Run:
inferkit dev my_model.py --port 8000
# docs at http://localhost:8000/docs
Endpoints auto created:
POST /api/v1/infer(multipart file + json)POST /api/v1/infer/json(json only)POST /api/v1/infer/stream(SSE)WS /ws/inferandWS /api/v1/ws/infer(WebSocket + streaming)
Image output helpers:
from inferkit import image_to_base64, bytes_to_response
from PIL import Image
return image_to_base64(Image.new("RGB",(512,512),"red"))
return bytes_to_response(png_bytes, "image/png")
# also still supported: return {"image_base64": b64} or return png_bytes
Init new project
inferkit init
# creates .env.example, .env, Dockerfile, my_model.py
Deploy (one command, any OS, auto detects Docker)
inferkit deploy
# if docker available -> docker compose/build
# else -> venv + uvicorn on INFERKIT_HOST:INFERKIT_PORT
Config via .env
INFERKIT_HOST=0.0.0.0
INFERKIT_PORT=8000
INFERKIT_CORS_ORIGINS=["*"] # or * or http://a.com,http://b.com
INFERKIT_MAX_UPLOAD_MB=50
INFERKIT_RATE_LIMIT=60/minute
INFERKIT_API_KEY= # if set, require X-API-Key header (also ?api_key=)
INFERKIT_DEBUG=false
# plain HOST/PORT/CORS_ORIGINS also work for backwards compat
Tutorial (0 to 100)
Complete guide with training and checkpoint: tutorial/00-100-complete-guide.md
python tutorial/train_example.py # train and save checkpoints/model.pkl
inferkit dev tutorial/inference_example.py # serve
Programmatic
from inferkit import serve
serve("my_model.py", port=8000)
Documentation
docs/index.md- Usagedocs/api.md- API Referencedocs/vision.md- Vision exampledocs/tutorial.md- Tutorial index
Release files for inferkit 0.1.8
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| inferkit-0.1.8.tar.gz | 20.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| inferkit-0.1.8-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 34.0 kB
Release files / inferkit-0.1.8.tar.gz
| Download URL | inferkit-0.1.8.tar.gz |
|---|---|
| Size | 20.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
76b61e4ea9b9eca5003b0fd6feb04170150e6ec5421f1f3bebeaca5635e3bb92
|
|
BLAKE2b-256 checksum How to use checksums |
c8cc86850143cb9d2d5b169ab59ebfc3e0519d2af1b3a3ab99eaa0f7807c3b4a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / inferkit-0.1.8-py3-none-any.whl
| Download URL | inferkit-0.1.8-py3-none-any.whl |
|---|---|
| Size | 13.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
41e0761f5c25c7fa7cc976332f3c9b1f15d462a26c471d34ae13d91811e2fe13
|
|
BLAKE2b-256 checksum How to use checksums |
4ed45d41e98f82f28ae2e5a2640b0427d192735270141510de3a7319f1dd465b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|