Skip to main content

pi-ai

Python port of @earendil-works/pi-ai — Unified LLM API.

Install

pip install pi-py-ai

Import name has no prefix: from pi_ai import ...

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

Metadata

Release files for pi-py-ai 0.85.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 pi-py-ai 0.85.1
File Size Uploaded Provenance Actions
pi_py_ai-0.85.1.tar.gz 56.9 kB Without provenance Details for pi_py_ai-0.85.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pi-py-ai 0.85.1
File Interpreter ABI Platform Actions
pi_py_ai-0.85.1-py3-none-any.whl Python 3 none any Details for pi_py_ai-0.85.1-py3-none-any.whl

Total release size: 101.8 kB

Release files / pi_py_ai-0.85.1.tar.gz

Download URL pi_py_ai-0.85.1.tar.gz
Size 56.9 kB
Tags Source
SHA-256 checksum
How to use checksums
d7d5fd42ead762dcd29ea21b4935963432628b0751c2df237df7c0f1dc4fca25
BLAKE2b-256 checksum
How to use checksums
11e002f833b8bc959c8de2be35b09fda212ae037112f225d26c6639d09ef597a
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.85.1-py3-none-any.whl

Download URL pi_py_ai-0.85.1-py3-none-any.whl
Size 44.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4d61f0be4fef472c658b6c6b44b4f0e87da212ba42993886ff02ab12fbf27c74
BLAKE2b-256 checksum
How to use checksums
1886669a5487f9bfc87a2eaef55df70968d29f645a997c7cfb661ef6dcd3494b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Security for pi-py-ai 0.85.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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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