Metadata-Version: 2.4
Name: sayd-ai
Version: 0.2.0
Summary: Official Python SDK for the Sayd Speech API — Voice Interface for AI Agents
Project-URL: Homepage, https://sayd.dev
Project-URL: Documentation, https://sayd.dev/docs
Project-URL: Repository, https://github.com/sayd-dev/sayd-python
Author-email: Sayd <hello@sayd.dev>
License-Expression: MIT
License-File: LICENSE
Keywords: agents,ai,sayd,speech-to-text,stt,transcription,voice
Classifier: Development Status :: 3 - Alpha
Classifier: Framework :: AsyncIO
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Multimedia :: Sound/Audio :: Speech
Requires-Python: >=3.8
Requires-Dist: httpx>=0.24.0
Requires-Dist: websockets>=11.0
Provides-Extra: audio
Requires-Dist: pyaudio>=0.2.13; extra == 'audio'
Provides-Extra: dev
Requires-Dist: pytest; extra == 'dev'
Requires-Dist: pytest-asyncio; extra == 'dev'
Requires-Dist: ruff; extra == 'dev'
Description-Content-Type: text/markdown

# sayd-ai

> Voice Interface for AI Agents. You said it. Agents did it.

Official Python SDK for the [Sayd](https://sayd.dev) Speech API.

## Installation

```bash
pip install sayd-ai
```

## Quick Start

```python
from sayd_ai import Sayd

client = Sayd(api_key="sk-your-key")

# Create a talk session and transcribe audio
session = client.talk.create(language="zh", cleaning_level="standard")

# Stream audio from file
for event in session.stream_file("recording.wav"):
    if event.type == "sentence":
        print(f"[live] {event.text}")
    elif event.type == "cleaned":
        print(f"[clean] {event.cleaned_text}")

print(f"Duration: {session.duration_minutes:.1f} min")
print(f"Cost: ${session.cost_usd:.4f}")
```

## Real-time Microphone Streaming

```python
from sayd_ai import Sayd

client = Sayd(api_key="sk-your-key")
session = client.talk.create(language="en")

# Stream from microphone (requires pyaudio)
for event in session.stream_microphone():
    if event.type == "partial":
        print(f"\r  {event.text}", end="", flush=True)
    elif event.type == "sentence":
        print(f"\n[final] {event.text}")
    elif event.type == "cleaned":
        print(f"\n\n--- Cleaned Transcript ---")
        print(event.cleaned_text)
```

## Async Support

```python
import asyncio
from sayd_ai import AsyncSayd

async def main():
    client = AsyncSayd(api_key="sk-your-key")
    session = await client.talk.create(language="multi")

    async for event in session.stream_file("audio.wav"):
        if event.type == "cleaned":
            print(event.cleaned_text)

asyncio.run(main())
```

## cURL Examples

Want to test the API directly without the SDK? Check out our [cURL examples](examples/curl-examples.md) for all endpoints.

## Configuration

```python
client = Sayd(
    api_key="sk-your-key",
    base_url="https://api.sayd.dev",  # default
    timeout=30,                    # request timeout in seconds
)
```

## Talk Session Options

| Parameter | Type | Default | Description |
|-----------|------|---------|-------------|
| `language` | str | `"multi"` | Language: `en`, `zh`, `multi` |
| `sample_rate` | int | `16000` | Audio sample rate: 8000 or 16000 |
| `codec` | str | `"pcm16"` | Codec: `pcm16`, `opus` |
| `cleaning_level` | str | `"standard"` | `light`, `standard`, `aggressive` |
| `output_format` | str | `"paragraph"` | `paragraph`, `bullets`, `raw` |

## License

MIT
