Skip to main content

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

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pi_py_ai-0.84.1.tar.gz (44.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pi_py_ai-0.84.1-py3-none-any.whl (37.8 kB view details)

Uploaded Python 3

File details

Details for the file pi_py_ai-0.84.1.tar.gz.

File metadata

  • Download URL: pi_py_ai-0.84.1.tar.gz
  • Upload date:
  • Size: 44.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for pi_py_ai-0.84.1.tar.gz
Algorithm Hash digest
SHA256 87ed531f2d52bce340bc25f256998f90c3c6657760e5e70410ba58d19f7016a6
MD5 df6ad809df60b7c392bc62c11e23c857
BLAKE2b-256 1034d37ceaf254af51d6224e3c43c989fb5d43956a793128ce845f8c58d6b3d6

See more details on using hashes here.

File details

Details for the file pi_py_ai-0.84.1-py3-none-any.whl.

File metadata

  • Download URL: pi_py_ai-0.84.1-py3-none-any.whl
  • Upload date:
  • Size: 37.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for pi_py_ai-0.84.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6317272e5e5a065a6a3adf75d477a10953f544b178203d0d1a9c125768e013c4
MD5 f17e88bcccd4836e30dbc796240b4582
BLAKE2b-256 6c4d88a97e69d989e9bbda534cf55baf7eb3a29ab6e00da0cf2bba535a164e47

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page