Skip to main content

Python port of @earendil-works/pi-ai — Unified LLM API with multi-provider streaming

Project description

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

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

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

pi_py_ai-0.83.0-py3-none-any.whl (36.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pi_py_ai-0.83.0-py3-none-any.whl
  • Upload date:
  • Size: 36.3 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.83.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4ce8afdc468daf6ecdba5c4b55973fa0c558912c25d3c01b41534b362f802c98
MD5 b3e152beb80dd7d22b071c948359f345
BLAKE2b-256 f218a6128895f2677463fa79209f3725764131a68e8f83aef4cd0ded377b5dfd

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 Pingdom Monitoring Sentry Error logging StatusPage Status page