pi-ai
Python port of @earendil-works/pi-ai — Unified LLM API.
Install
pip install pi-ai
Quick Start
from pi_ai import stream, Context, UserMessage, Model, StreamOptions
model = Model(
id="deepseek-chat", api="openai-completions", provider="deepseek",
base_url="https://api.deepseek.com/v1", input=["text"],
context_window=64000, max_tokens=8192,
)
ctx = Context(messages=[UserMessage(content="Hello")])
es = stream(model, ctx, StreamOptions(api_key="sk-..."))
async for event in es:
if event.type == "text_delta": print(event.delta, end="")
Providers
- OpenAI — Chat Completions (also works with DeepSeek, OpenRouter, etc.)
- Anthropic — Messages API with thinking (extended reasoning) support
- Faux — Test mock
Links
- GitHub | Issues
- PORTING.md — deviations from upstream
Release files for pi-py-ai 0.84.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pi_py_ai-0.84.1.tar.gz | 44.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pi_py_ai-0.84.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 82.3 kB
Release files / pi_py_ai-0.84.1.tar.gz
| Download URL | pi_py_ai-0.84.1.tar.gz |
|---|---|
| Size | 44.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
87ed531f2d52bce340bc25f256998f90c3c6657760e5e70410ba58d19f7016a6
|
|
BLAKE2b-256 checksum How to use checksums |
1034d37ceaf254af51d6224e3c43c989fb5d43956a793128ce845f8c58d6b3d6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / pi_py_ai-0.84.1-py3-none-any.whl
| Download URL | pi_py_ai-0.84.1-py3-none-any.whl |
|---|---|
| Size | 37.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6317272e5e5a065a6a3adf75d477a10953f544b178203d0d1a9c125768e013c4
|
|
BLAKE2b-256 checksum How to use checksums |
6c4d88a97e69d989e9bbda534cf55baf7eb3a29ab6e00da0cf2bba535a164e47
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|