Skip to content

Commit 2bb8dad

Browse files
Add support for new OpenAI TTS voices: ash, coral, and sage
Expanded the list of supported voices in the TTS engine and type definitions to include ash, coral, and sage, reflecting recent updates to the OpenAI.fm API. Updated the README to clarify installation instructions and roadmap. Incremented the package version to 0.1.1 for release. This change allows users to select the new voices in their TTS requests, provided the backend API supports them. No breaking changes were introduced and all previous voices remain supported.
1 parent 693ef54 commit 2bb8dad

4 files changed

Lines changed: 12 additions & 17 deletions

File tree

README.md

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# a4f-local
22

3+
[![PyPI version](https://img.shields.io/pypi/v/a4f-local.svg?style=flat-square)](https://pypi.org/project/a4f-local/)
4+
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/a4f-local.svg?style=flat-square)](https://pypi.org/project/a4f-local/)
5+
36
A unified, professional Python wrapper for various reverse-engineered AI provider APIs, designed to be **OpenAI-compatible** and **easy to use**.
47

58
---
@@ -16,17 +19,10 @@ A unified, professional Python wrapper for various reverse-engineered AI provide
1619

1720
## Installation
1821

19-
First, **clone this repository**:
20-
21-
```bash
22-
git clone https://github.com/Devs-Do-Code/a4f-local.git
23-
cd a4f-local
24-
```
25-
26-
Then, **install the package locally**:
22+
Install directly from PyPI:
2723

2824
```bash
29-
pip install .
25+
pip install -U a4f-local
3026
```
3127

3228
---
@@ -80,8 +76,6 @@ Use one of these as the `voice` parameter in your TTS requests.
8076
## Roadmap
8177

8278
- **More Providers:** Support for chat, image generation, and other AI capabilities.
83-
- **New Models:** If everything goes well, support for **OpenAI's latest and most advanced models**`ash`, `coral`, and `sage` — will also be added.
84-
- **PyPI Release:** This package will be published on PyPI soon. More detailed documentation and examples will be added at that time.
8579
- **Configuration:** Easier ways to configure API keys and provider preferences.
8680
- **Async Support:** Async versions of API calls.
8781
- **Better Error Handling:** More informative error messages and exceptions.
@@ -102,7 +96,7 @@ This package uses **reverse-engineered, unofficial APIs**. These may break or ch
10296

10397
## More Information
10498

105-
More detailed documentation, tutorials, and examples will be published **once the package is released on PyPI**.
99+
More detailed documentation, tutorials, and examples will be published here and on PyPI.
106100

107101
For now, refer to the example above and the source code for guidance.
108102

a4f_local/providers/provider_1/tts/engine.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
import requests
22
import logging
3-
from ....types.audio import SpeechCreateRequest # Relative import from a4f_local/types/audio.py
3+
from ....types.audio import SpeechCreateRequest
44

55
# Optional: Import from provider_1.config if URL/headers/secrets were stored there
66
# from ..config import PROVIDER_URL, PROVIDER_HEADERS # Example if config.py existed
77

88
logger = logging.getLogger(__name__)
99

1010
# Define standard OpenAI voices supported by this specific provider (OpenAI.fm)
11-
SUPPORTED_VOICES = ["alloy", "echo", "fable", "onyx", "nova", "shimmer"]
11+
# Includes standard voices and potentially newer ones if the backend supports them.
12+
SUPPORTED_VOICES = ["alloy", "echo", "fable", "onyx", "nova", "shimmer", "ash", "coral", "sage"]
1213

1314
# Headers based on the reverse-engineered request in the guide
1415
# Consider moving sensitive or frequently changing parts to a config file or env vars later
@@ -20,7 +21,7 @@
2021
"origin": "https://www.openai.fm",
2122
"referer": "https://www.openai.fm/", # Simplified referer, adjust if needed
2223
# Using a generic user-agent might be less likely to break than a specific worker JS referer
23-
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36" # Example UA
24+
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36"
2425
}
2526
PROVIDER_URL = "https://www.openai.fm/api/generate"
2627

a4f_local/types/audio.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class SpeechCreateRequest(BaseModel):
99
"""
1010
model: str = Field(..., description="One of the available TTS models, e.g., tts-1 or tts-1-hd")
1111
input: str = Field(..., max_length=4096, description="The text to generate audio from. The maximum length is 4096 characters.")
12-
voice: Literal["alloy", "echo", "fable", "onyx", "nova", "shimmer"] = Field(..., description="The voice to use for synthesis.")
12+
voice: Literal["alloy", "echo", "fable", "onyx", "nova", "shimmer", "ash", "coral", "sage"] = Field(..., description="The voice to use for synthesis.")
1313
response_format: Optional[Literal["mp3", "opus", "aac", "flac", "wav", "pcm"]] = Field(
1414
default="mp3",
1515
description="The format to audio in. Supported formats are mp3, opus, aac, flac, wav, and pcm."

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "a4f-local"
7-
version = "0.1.0"
7+
version = "0.1.1"
88
description = "A unified wrapper for various reverse-engineered AI provider APIs, aiming for OpenAI compatibility."
99
readme = "README.md"
1010
requires-python = ">=3.8"

0 commit comments

Comments
 (0)