Skip to main content

Universal AI Provider SDK (uai-sdk-python)

A universal, modular AI infrastructure layer for Python that abstracts multiple Chinese LLM providers behind a single, stable API with an opt-in middleware architecture.

Installation

🚧 Under Active Development — This SDK has NOT been released on PyPI yet. We're targeting our first release for Q3 2026.

Local Install (Development Mode)

# Clone the repository
git clone https://github.com/uai-sdk/uai-sdk-python.git
cd uai-sdk-python

# Install in development mode
pip install -e .

Once published to PyPI, the command will be:

pip install uai-sdk

Quick Start

from uai import UniversalAI

# One client per provider; the SDK reads DEEPSEEK_API_KEY from the
# environment if api_key is omitted.
client = UniversalAI(provider="deepseek", model="deepseek-chat")

# Chat
result = client.chat(
    messages=[{"role": "user", "content": "Translate to English: 你好"}],
)
print(result.content)

# Streaming
for chunk in client.chat(
    messages=[{"role": "user", "content": "Tell me a story..."}],
    stream=True,
):
    print(chunk.content, end="", flush=True)

# Structured output (validated by the provider adapter; see docs/structured_output.md)
from pydantic import BaseModel

class KeyPoints(BaseModel):
    points: list[str]

result = client.chat(
    messages=[{"role": "user", "content": "Extract the key points"}],
    output_schema=KeyPoints,
)
print(result.parsed)

Features

  • ✅ Unified API across multiple LLM providers
  • ✅ Chat, streaming, tool-calling, structured outputs
  • ✅ Embeddings (client.embed) and rerank (client.rerank) via provider adapters
  • ✅ Vision via chat content blocks (image_url) on vision-capable models
  • ✅ Provider adapters with strict capability enforcement
  • ✅ Opt-in middleware — retry, cache, circuit breaker, logging, tracing, metrics (client.use(...))
  • ✅ Benchmark CLI covering all chat models (uai benchmark)
  • ✅ KPI regression suite — <5 ms SDK overhead, ≥1,000 req/min, memory caps (see docs/performance.md)
  • ✅ Security-first design (no secret logging, input validation)
  • ✅ Extensible — easily add new providers via the PDK
  • ✅ Prometheus-style metrics — in-process MetricsRegistry with render()
  • ⏳ Audio / TTS / transcription — not yet implemented (deferred)

Supported Providers

Provider Chat Streaming Tools Vision Embeddings Rerank Audio
DeepSeek ✅ ✅ ✅ ❌ ✅ ❌ ❌
Qwen ✅ ✅ ✅ ✅ ✅ ✅ ❌
GLM ✅ ✅ ✅ ❌ ✅ ✅ ❌
Kimi ✅ ✅ ✅ ❌ ❌ ❌ ❌
StepFun ✅ ✅ ✅ ✅ ✅ ❌ ❌
Doubao ✅ ✅ ✅ ✅ ✅ ❌ ❌
MiniMax ✅ ✅ ✅ ✅ ✅ ❌ ❌
Hunyuan ✅ ✅ ✅ ✅ ✅ ❌ ❌

Documentation

  • Architecture — middleware pipeline, adapter contract, UnifiedRequest lifecycle
  • Chat — conversational completions, history management, system prompts
  • Streaming — SSE handling and TTFT
  • Tools — function calling with OpenAI-style tool definitions
  • Embeddings — text embedding operations via adapters
  • Vision — multimodal image interpretation via chat content blocks
  • Rerank — document ranking (Qwen, GLM)
  • Structured Output — schema validation & parsing
  • Middleware — creating and composing interceptors (retry, cache, circuit breaker, logging, tracing, metrics)
  • Benchmark — offline benchmarking CLI covering all models
  • Performance — KPI targets & systemic testing (Module 1.6), mock provider server
  • Telemetry — Prometheus-style metrics and GenAI tracing spans
  • Configuration — env vars, YAML config, API key management
  • PDK — Provider Development Kit guide

Contributing

Contributions are welcome! Please read our Contributing Guide first.

Issue Label Policy

All new issues are automatically evaluated and tagged:

Label Meaning
roadmap-aligned On our planned roadmap — we intend to build it.
needs-discussion Requires design discussion before we decide.
won't-implement Out of scope for this project's direction.
help-wanted We explicitly welcome PRs for this.

See .github/LABELS.md for the full label set and conventions.


License

This project is licensed under the Apache License 2.0 — see LICENSE for details.

Metadata

Release files for uai-sdk 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for uai-sdk 0.1.0
File Size Uploaded Provenance Actions
uai_sdk-0.1.0.tar.gz 65.7 kB With provenance Details for uai_sdk-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for uai-sdk 0.1.0
File Interpreter ABI Platform Actions
uai_sdk-0.1.0-py3-none-any.whl Python 3 none any Details for uai_sdk-0.1.0-py3-none-any.whl

Total release size: 165.4 kB

Release files / uai_sdk-0.1.0.tar.gz

Download URL uai_sdk-0.1.0.tar.gz
Size 65.7 kB
Tags Source
SHA-256 checksum
How to use checksums
c359c881a61e7e0b7e56675750d4bb13c102739b5212bf69fda712c1d4547414
BLAKE2b-256 checksum
How to use checksums
eeb6b014fc5f589c489ca014ccd8caa9f109b86d3c0a4fabe75ff86f11e6ddad
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 9, 2026.

Transparency log

Release files / uai_sdk-0.1.0-py3-none-any.whl

Download URL uai_sdk-0.1.0-py3-none-any.whl
Size 99.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
563f1929f388c5460b884458fb89399908364738d73d20ca6c02a219cd1e93c7
BLAKE2b-256 checksum
How to use checksums
405931e5bc5cf3e2fc23190d0772dc04b5cd180e20f22df130649f2fec4459c0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 9, 2026.

Transparency log

Security for uai-sdk 0.1.0

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for uai_sdk-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 9, 2026.

Transparency log

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