Skip to main content

OuteAI Python SDK

Official Python SDK for the OuteAI text-to-speech API at https://outeai.com.

Installation

From PyPI:

pip install outeai

From this repository:

cd outeai
pip install .

Build distributable artifacts:

cd outeai
python -m pip install build
python -m build

Install async support:

pip install "outeai[async]"

Authentication

Create an API key in your OuteAI account, then pass it to the client with Authorization: Bearer <key>.

The SDK uses https://outeai.com by default, so you do not need to set a base URL unless you want to override it.

Quick Start

from outeai import OuteAI

client = OuteAI(api_key="YOUR_OUTEAI_API_KEY")

voices = client.list_voices()
voice_id = voices[0]["voice_id"]

audio = client.generate_speech(
    text="Hello from OuteAI.",
    voice_id=voice_id,
)

audio.save("hello.wav")
client.close()

Streaming Audio

from outeai import OuteAI

client = OuteAI(api_key="YOUR_OUTEAI_API_KEY")

with client.stream_speech(
    text="This is a streaming response from OuteAI.",
    voice_id="vc_your_voice_id",
) as stream:
    stream.save("streamed.wav")

You can also iterate the WAV bytes yourself:

with client.stream_speech(
    text="Chunked audio output.",
    voice_id="vc_your_voice_id",
) as stream:
    for chunk in stream:
        print(f"received {len(chunk)} bytes")

Voice IDs

Voice clone management is intentionally not part of this SDK surface. Pass an existing voice_id into the TTS methods.

Async Usage

import asyncio

from outeai import AsyncOuteAI


async def main() -> None:
    client = AsyncOuteAI(api_key="YOUR_OUTEAI_API_KEY")

    voices = await client.list_voices()
    voice_id = voices[0]["voice_id"]

    audio = await client.generate_speech(
        text="Hello from the async OuteAI client.",
        voice_id=voice_id,
    )
    audio.save("hello-async.wav")

    await client.stream_speech_to_file(
        "stream-async.wav",
        text="This file was written from the async streaming client.",
        voice_id=voice_id,
    )

    await client.close()


asyncio.run(main())

Available Methods

  • client.health()
  • client.list_voices()
  • client.generate_speech(...)
  • client.generate_speech_to_file(...)
  • client.stream_speech(...)
  • client.stream_speech_to_file(...)
  • AsyncOuteAI.health()
  • AsyncOuteAI.list_voices()
  • AsyncOuteAI.generate_speech(...)
  • AsyncOuteAI.generate_speech_to_file(...)
  • AsyncOuteAI.stream_speech(...)
  • AsyncOuteAI.stream_speech_to_file(...)

Error Handling

API errors raise OuteAIAPIError.

from outeai import OuteAI, OuteAIAPIError

client = OuteAI(api_key="YOUR_OUTEAI_API_KEY")

try:
    client.list_voices()
except OuteAIAPIError as exc:
    print(exc.status_code)
    print(exc.code)
    print(exc.message)

Notes

  • TTS responses are returned as WAV audio.
  • The default TTS model is outetts_1_pro.
  • voice_id is required for generation and must belong to the authenticated user.

Metadata

Release files for outeai 2.0.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 outeai 2.0.0
File Size Uploaded
outeai-2.0.0.tar.gz 5.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for outeai 2.0.0
File Interpreter ABI Platform
outeai-2.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 12.5 kB

Release files / outeai-2.0.0.tar.gz

Download URL outeai-2.0.0.tar.gz
Size 5.0 kB
Tags Source
SHA-256 checksum
How to use checksums
d64d736e997f6c437ada963064e40b3ca78d1aae058284522b4ac8dad1349278
BLAKE2b-256 checksum
How to use checksums
58446c6388f9c9f514bd95ecfb0cda51024d95b215f778ea503fd59dd42b27c9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.14

Release files / outeai-2.0.0-py3-none-any.whl

Download URL outeai-2.0.0-py3-none-any.whl
Size 7.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
991f2644c721ec785476ea8261cb3b853a17850efbb440fff15801d50188595f
BLAKE2b-256 checksum
How to use checksums
67be47045a9a29cc3b218bb70d15978c26a029d1a11ec3b4bc7399c88cb5827d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.14

Release history Release notifications | RSS feed

This release

2.0.0 This release

2 release files

1.0.0

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.0

2 release files

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