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 Distribution

pi_py_ai-0.83.0.tar.gz (40.6 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.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.tar.gz.

File metadata

  • Download URL: pi_py_ai-0.83.0.tar.gz
  • Upload date:
  • Size: 40.6 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.83.0.tar.gz
Algorithm Hash digest
SHA256 232f19a6cf337f8396447b2a186de4d194a75450340e8b3f96c5b9cc8e901b22
MD5 0b270d3ba72698a4b103e5313a78f3f4
BLAKE2b-256 50ed25293b608f6738aa1c7d5656baf64ecd24302200dd01d2ae80eee03fac72

See more details on using hashes here.

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