A unified wrapper for various reverse-engineered AI provider APIs, aiming for OpenAI compatibility.
Project description
a4f-local
A unified, professional Python wrapper for various reverse-engineered AI provider APIs, designed to be OpenAI-compatible and easy to use.
Key Features
- Unified API: Call multiple unofficial AI providers with a single, OpenAI-like interface.
- Modular: Easily extend with new providers and capabilities.
- Supports Text-to-Speech (TTS): Initial implementation includes OpenAI.fm reverse-engineered TTS.
- OpenAI-Compatible: Accepts and returns data in the same format as OpenAI's official API.
- Simple to Use: Designed for developers of all skill levels.
Installation
Install directly from PyPI:
pip install -U a4f-local
Usage Example
from a4f_local import A4F
client = A4F()
try:
audio_bytes = client.audio.speech.create(
model="tts-1", # Model name (currently informational)
input="Hello from a4f-local!",
voice="alloy" # Choose a supported voice
)
with open("output.mp3", "wb") as f:
f.write(audio_bytes)
print("Generated output.mp3")
except Exception as e:
print(f"An error occurred: {e}")
Supported Voices
The following voice names are supported (mapped to OpenAI's official voices):
alloyechofableonyxnovashimmer
Use one of these as the voice parameter in your TTS requests.
How It Works
- You interact with the
A4Fclient just like OpenAI's Python SDK. - The client automatically discovers available providers and their capabilities.
- When you call a method (e.g.,
client.audio.speech.create()), it routes the request to the appropriate provider. - The provider translates the OpenAI-compatible request into its own API format, calls the API, and translates the response back.
Roadmap
- More Providers: Support for chat, image generation, and other AI capabilities.
- Configuration: Easier ways to configure API keys and provider preferences.
- Async Support: Async versions of API calls.
- Better Error Handling: More informative error messages and exceptions.
License
See the LICENSE file for details. This software is not open source in the traditional sense. Please review the license terms carefully before use.
Disclaimer
This package uses reverse-engineered, unofficial APIs. These may break or change at any time. Use at your own risk.
More Information
More detailed documentation, tutorials, and examples will be published here and on PyPI.
For now, refer to the example above and the source code for guidance.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file a4f_local-0.1.1.tar.gz.
File metadata
- Download URL: a4f_local-0.1.1.tar.gz
- Upload date:
- Size: 17.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e15007f654c1f4410c6fe407ab303bc2c70ae0e5113ab0fc056ec44541a72471
|
|
| MD5 |
03234d138b2208a9aeed3c4068dd57ef
|
|
| BLAKE2b-256 |
69ec2a094ac716cd199e1667a229626ec16e14e00f53024ffd9dab0e61ede027
|
Provenance
The following attestation bundles were made for a4f_local-0.1.1.tar.gz:
Publisher:
publish.yml on Devs-Do-Code/a4f-local
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
a4f_local-0.1.1.tar.gz -
Subject digest:
e15007f654c1f4410c6fe407ab303bc2c70ae0e5113ab0fc056ec44541a72471 - Sigstore transparency entry: 196421809
- Sigstore integration time:
-
Permalink:
Devs-Do-Code/a4f-local@2bb8dadb6310e17944443e39f82da5d4d065eefb -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/Devs-Do-Code
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@2bb8dadb6310e17944443e39f82da5d4d065eefb -
Trigger Event:
release
-
Statement type:
File details
Details for the file a4f_local-0.1.1-py3-none-any.whl.
File metadata
- Download URL: a4f_local-0.1.1-py3-none-any.whl
- Upload date:
- Size: 18.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
381bf7130839fbffb38a7cf5a8d287f11935a6fae682d0322ba5cea3683cdc8a
|
|
| MD5 |
bdb60388a17a6388abc6cfd68af41b80
|
|
| BLAKE2b-256 |
82e3150f4cea698e3671a2954c10b88abd3fcd1ba86c1fa1695c2bb40e12e8a0
|
Provenance
The following attestation bundles were made for a4f_local-0.1.1-py3-none-any.whl:
Publisher:
publish.yml on Devs-Do-Code/a4f-local
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
a4f_local-0.1.1-py3-none-any.whl -
Subject digest:
381bf7130839fbffb38a7cf5a8d287f11935a6fae682d0322ba5cea3683cdc8a - Sigstore transparency entry: 196421813
- Sigstore integration time:
-
Permalink:
Devs-Do-Code/a4f-local@2bb8dadb6310e17944443e39f82da5d4d065eefb -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/Devs-Do-Code
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@2bb8dadb6310e17944443e39f82da5d4d065eefb -
Trigger Event:
release
-
Statement type: