Metadata-Version: 2.4
Name: quick-tts
Version: 0.1.2
Summary: Convert text to speech using OpenAI's Text-to-Speech API
Project-URL: Homepage, https://github.com/diogoseca/quick-tts
Project-URL: Repository, https://github.com/diogoseca/quick-tts
Project-URL: Issues, https://github.com/diogoseca/quick-tts/issues
Author-email: Diogo Seca <diogoseca@users.noreply.github.com>
License: MIT License
        
        Copyright (c) 2025 Diogo Seca
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
License-File: LICENSE
Keywords: audio,openai,speech,text-to-speech,tts
Classifier: Development Status :: 4 - Beta
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
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.8
Requires-Dist: openai>=1.86.0
Requires-Dist: python-dotenv>=1.1.0
Description-Content-Type: text/markdown

# quick-tts

Convert text to speech using OpenAI's Text-to-Speech API. A simple, effective Python package that works as both a library and command-line tool.

## Installation

```bash
pip install quick-tts
```

## Usage

### As a Library

```python
from quick_tts import text_to_speech

# Basic usage
text_to_speech("Hello, world!", "hello.mp3")

# With custom options
text_to_speech(
    text="Good morning!",
    output_file="morning.wav",
    model="tts-1-hd",
    voice="nova"
)
```

### As a Command-Line Tool

```bash
# Basic usage
quick-tts "Hello, world!" -o hello.mp3

# Read from file
quick-tts -f input.txt -o output.mp3

# Custom voice and model
quick-tts "Welcome!" --voice nova --model tts-1-hd -o welcome.mp3

# See all options
quick-tts --help
```

## Configuration

### Option 1: .env File (Recommended)

Create a `.env` file in your project directory:

```bash
# .env
OPENAI_API_KEY=sk-your-api-key-here
```

The package automatically loads `.env` files - no additional setup required!

### Option 2: Environment Variable

```bash
export OPENAI_API_KEY=sk-your-api-key-here
```

### Option 3: Direct Parameter

```python
text_to_speech("Hello!", "hello.mp3", api_key="sk-your-api-key")
```

## API Reference

### `text_to_speech(text, output_file="speech.mp3", model="tts-1-hd", voice="alloy", api_key=None)`

Convert text to speech using OpenAI's API.

**Parameters:**
- `text` (str): The text to convert to speech
- `output_file` (str|Path): Path to save the audio file (default: "speech.mp3")
- `model` (str): OpenAI TTS model ("tts-1" or "tts-1-hd", default: "tts-1-hd")
- `voice` (str): Voice to use ("alloy", "echo", "fable", "onyx", "nova", "shimmer", default: "alloy")
- `api_key` (str, optional): OpenAI API key (uses OPENAI_API_KEY env var if not provided)

**Returns:**
- `str`: Absolute path to the generated audio file

## Supported Voices

- **alloy** - Balanced, versatile voice
- **echo** - Clear, professional tone
- **fable** - Warm, storytelling quality
- **onyx** - Deep, authoritative voice
- **nova** - Bright, engaging tone
- **shimmer** - Soft, pleasant voice

## Models

- **tts-1** - Standard quality, faster generation
- **tts-1-hd** - High definition quality, more detailed audio

## Requirements

- Python 3.8+
- OpenAI API key
- `openai>=1.86.0`
- `python-dotenv>=1.1.0`

## License

MIT License - see LICENSE file for details.

## Contributing

Issues and pull requests welcome at [GitHub](https://github.com/diogoseca/quick-tts).
