> ## Documentation Index
> Fetch the complete documentation index at: https://docs.pyai.com/llms.txt
> Use this file to discover all available pages before exploring further.

# SDKs

> Install the official Python and TypeScript SDKs, know when to use them versus curl or a raw WebSocket, and find the LiveKit and Pipecat adapters.

Official SDKs wrap the same public contract as `https://api.pyai.com/openapi.json`.
They handle bearer auth, retries on `429` and `5xx`, multipart uploads, and
idempotency helpers. Raw `curl` and WebSocket examples in these docs stay valid;
use the SDK when you want that plumbing done for you.

```bash theme={null}
pip install pyai-sdk==0.4.0
```

```bash theme={null}
npm install @pyai/sdk@0.4.0
```

```python theme={null}
import os
from pyai import PyAI

pyai = PyAI(api_key=os.environ["PYAI_API_KEY"])
```

```ts theme={null}
import PyAI from "@pyai/sdk";

const pyai = new PyAI({ apiKey: process.env.PYAI_API_KEY! });
```

Set `PYAI_API_KEY` from [the quickstart](/quickstart). Treat the key as an
opaque string. Do not parse or decode it.

## What each client covers

| Job           | Python (`pyai-sdk`)                              | TypeScript (`@pyai/sdk`)                                                       |
| ------------- | ------------------------------------------------ | ------------------------------------------------------------------------------ |
| One-file Hear | `pyai.audio.transcriptions.create(...)`          | `pyai.audio.transcriptions.create({ file })`                                   |
| Speak         | `pyai.audio.speech(...)` returns bytes           | `pyai.audio.speech(...)` returns bytes; `speechStream` for first-byte playback |
| Hear stream   | URL helper + your WebSocket                      | `pyai.audio.transcriptions.stream()`                                           |
| Clone         | `pyai.clones.create` / `get` / `list` / `delete` | `pyai.clones.create` / `get` / `list` / `delete`                               |
| Identity      | `GET /v1/me` via HTTP                            | `pyai.me()`                                                                    |
| Omni          | URL helper; send frames yourself                 | `omni.connect()` hides the `type` vs `event` frame-key split                   |

`clones.get` filters `GET /v1/voice/clones`. The API has no GET-by-id for
clones.

## When to stay on curl or a raw socket

* You are proving a key in 30 seconds: `POST /v1/sandbox/keys` then `GET /v1/me`.
* You are integrating a language the official SDKs do not cover.
* You need the exact Omni binary frames (`0x01` audio, `0x02` transcript,
  `0x03` control). The [Omni protocol](/realtime/omni-protocol) is the contract.

## Framework adapters

Keep LiveKit or Pipecat if those products already own the loop. PyAI is the
speech layer only. Those packages do not create or select an Omni agent.

| Adapter                 | Install                                   | Guide                             |
| ----------------------- | ----------------------------------------- | --------------------------------- |
| LiveKit Agents (Python) | `pip install livekit-plugins-pyai==0.1.2` | [LiveKit](/guides/livekit-agents) |
| Pipecat (Python)        | `pip install pipecat-pyai==0.1.2`         | [Pipecat](/guides/pipecat)        |

## AI coding agents

The PyAI MCP server can mint a sandbox key and call Hear, Speak, and the voice
catalog as tools. See [Use PyAI in Cursor](/guides/use-pyai-in-cursor).

<CardGroup cols={2}>
  <Card title="Quickstart" href="/quickstart">Mint a key and copy a first call in curl, Python, or Node.</Card>
  <Card title="Errors and limits" href="/errors-and-limits">Stable codes, first-call failures, and when not to retry.</Card>
</CardGroup>

## Complete runnable starters

Download source, dependencies and environment templates from the
[SDK hub](https://pyai.com/sdks). Choose
[Python](https://pyai.com/sdks/python),
[TypeScript](https://pyai.com/sdks/typescript),
[Twilio](https://pyai.com/sdks/twilio),
[LiveKit](https://pyai.com/sdks/livekit), or
[Pipecat](https://pyai.com/sdks/pipecat).

[Getting started](/getting-started) includes copyable Cursor, Codex and Claude
Code setup. [Webhooks](/webhooks) includes a complete receiver.
For coding agents, fetch [skill.md](https://pyai.com/skill.md),
[getting-started.md](https://pyai.com/getting-started.md), and
[webhooks.md](https://pyai.com/webhooks.md).
