Skip to main content

OuteAI

Project description

OuteAI Python SDK

The official Python SDK for the OuteAI API.

Installation

pip install outeai

Authentication

The SDK requires an API token for authentication. We recommend setting it as an environment variable for security and convenience.

export OUTEAI_API_TOKEN='your_access_token_here'

Alternatively, you can pass the token directly when initializing the client.

Quickstart: Synchronous Usage

Here's how to generate audio using the standard synchronous client.

from outeai import OuteAI, APIError

try:
    # It is recommended to set the token as an environment variable
    # Reads from OUTEAI_API_TOKEN automatically
    client = OuteAI()

    # Or initialize the client with the token directly
    # client = OuteAI(token="your_access_token_here")

    print("Generating audio...")
    output = client.generate.audio(
        model="OuteTTS-1-Pro",
        text="Hello, world! This is a test of the text to speech API.",
        speaker_id="EN-FEMALE-1-NEUTRAL",
        temperature=0.4
    )

    # The output object contains the audio data and can be saved directly
    output.save("generated_audio.mp3")

    print(f"Audio generation complete. Duration: {output.duration:.2f}s")

except APIError as e:
    print(f"An API error occurred: {e}")
except Exception as e:
    print(f"An unexpected error occurred: {e}")
finally:
    # It's good practice to close the client
    if 'client' in locals():
        client.close()

Asynchronous Usage

For applications using asyncio, the AsyncOuteAI client provides non-blocking I/O.

import asyncio
from outeai import AsyncOuteAI, APIError

async def main():
    # Using the client as an async context manager handles setup and teardown
    async with AsyncOuteAI() as client:
        try:
            print("Generating audio asynchronously...")
            output = await client.generate.audio(
                model="OuteTTS-1-Pro",
                text="This is an asynchronous test of the API.",
                speaker_id="EN-FEMALE-1-NEUTRAL",
                temperature=0.5
            )

            output.save("generated_audio_async.mp3")
            print(f"Async audio generation complete. Duration: {output.duration:.2f}s")

        except APIError as e:
            print(f"An API error occurred: {e}")
        except Exception as e:
            print(f"An unexpected error occurred: {e}")

if __name__ == "__main__":
    asyncio.run(main())

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

outeai-1.0.0.tar.gz (9.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

outeai-1.0.0-py3-none-any.whl (10.2 kB view details)

Uploaded Python 3

File details

Details for the file outeai-1.0.0.tar.gz.

File metadata

  • Download URL: outeai-1.0.0.tar.gz
  • Upload date:
  • Size: 9.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.11

File hashes

Hashes for outeai-1.0.0.tar.gz
Algorithm Hash digest
SHA256 44ebe3d4da9465d3de974d43bd4e1bd3974fd6ba76162072514818de9f1aa6b8
MD5 db92fb510245e0cfa1ce3f28b5309b8a
BLAKE2b-256 9d40168a3ca0d5759f8e19c10154a7779b43c043132d311d5811375598dba4af

See more details on using hashes here.

File details

Details for the file outeai-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: outeai-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 10.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.11

File hashes

Hashes for outeai-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 70cd58a44e103c957e5b5f212f8c4b4846d0d7c0093683bcac927b59ba6f4f5d
MD5 a2c4e8707e8f84bf596a4d2bec0eb783
BLAKE2b-256 c7f64a2443c60b1cc127bce8d640e1447e40e22c1974af8002c55edd0601ebe7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page