Skip to main content

Why another SDK?

Python is the defacto language for AI. However, to actually get started with AI, you’ll need to 1. use a bloated external framework and install a bunch of dependencies, or 2. use an incredibly confusing API client (to simply call an LLM, you need client.chat.completions.create(**kwargs).result.choices[0].message.content).

Features

  • Zero-configuration functions that work consistently across providers.
  • First-class streaming & tool-calling support.
  • Strong Pydantic types throughout - you know exactly what you’re getting.
  • Strict structured-output generation and streaming via Pydantic models.
  • Provider-agnostic embeddings with built-in batching & retry logic.
  • Tiny dependency footprint - no bloated external frameworks.

Installation

pip install ai-sdk-python
# or
uv add ai-sdk-python
That’s it - no extra build steps or config files.

Quick-start

Get started in just a few lines of code.
generate_text.py
from ai_sdk import openai, generate_text

res = generate_text(
  model=openai("gpt-4.1"),
  prompt="Tell me a haiku about Python",
)

print(res.text)

What’s next?

Text generation

Generate or stream text with a single line of code.

Tool calling

Build agentic flows with real Python functions.

Agent

Create AI agents with persistent state and tool-calling capabilities.

Embeddings

Create vector embeddings and compute cosine similarity.

Structured output

Return fully-validated Pydantic objects - no messy JSON parsing.