Skip to main content

A unified wrapper for various reverse-engineered AI provider APIs, aiming for OpenAI compatibility.

Project description

a4f-local

PyPI version PyPI - Python Version

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):

  • alloy
  • echo
  • fable
  • onyx
  • nova
  • shimmer

Use one of these as the voice parameter in your TTS requests.


How It Works

  • You interact with the A4F client 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


Download files

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

Source Distribution

a4f_local-0.1.1.tar.gz (17.9 kB view details)

Uploaded Source

Built Distribution

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

a4f_local-0.1.1-py3-none-any.whl (18.1 kB view details)

Uploaded Python 3

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

Hashes for a4f_local-0.1.1.tar.gz
Algorithm Hash digest
SHA256 e15007f654c1f4410c6fe407ab303bc2c70ae0e5113ab0fc056ec44541a72471
MD5 03234d138b2208a9aeed3c4068dd57ef
BLAKE2b-256 69ec2a094ac716cd199e1667a229626ec16e14e00f53024ffd9dab0e61ede027

See more details on using hashes here.

Provenance

The following attestation bundles were made for a4f_local-0.1.1.tar.gz:

Publisher: publish.yml on Devs-Do-Code/a4f-local

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for a4f_local-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 381bf7130839fbffb38a7cf5a8d287f11935a6fae682d0322ba5cea3683cdc8a
MD5 bdb60388a17a6388abc6cfd68af41b80
BLAKE2b-256 82e3150f4cea698e3671a2954c10b88abd3fcd1ba86c1fa1695c2bb40e12e8a0

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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