Skip to main content

Unified multi-provider Python client for text, audio, image, music, and video AI APIs.

Project description

easy-ai-clients

PyPI version Python versions License: MIT

easy-ai-clients is a Python library with dispatcher-style clients for text, audio, image, music, video, media, webhook, and account workflows across multiple AI providers.

The package is a library, not a hosted service. It calls provider APIs only when your code calls a public dispatcher with an explicit api= argument.

Install

pip install easy-ai-clients

Requirements:

  • Python >=3.11
  • Credentials only for the providers you call
  • Local ffmpeg support through imageio-ffmpeg / pydub for non-WAV audio inputs

Quickstart

from dotenv import load_dotenv
from easy_ai_clients import audio, image, music, text, video

load_dotenv("path/to/private.env")

text_result = text.generate(
    "Write one release note sentence.",
    instruction="Use plain English.",
    api="openai",
)
print(text_result["output_text"])

speech = audio.generate("Hello from easy-ai-clients.", api="openai", voice="alloy")
speech["audio"].export("hello.mp3", format="mp3")

transcript = audio.transcribe("hello.mp3", api="deepgram")
print(transcript["text"])

generated = image.generate("a clean paper airplane app icon", api="openai")
print(generated["request_id"])

song = music.generate(
    lyrics="[Verse]\nWe build the morning line\n[Chorus]\nThe work begins to shine",
    api="runware",
    model="ace_step_v1_5_xl_turbo",
    style="rock",
)
print(song["status"], song["request_id"])

clip = video.generate(
    "A smooth four-second product shot of a paper airplane.",
    api="google",
    duration_seconds=4,
)
print(clip["video_url"])

Public API

Import public dispatchers from the top-level package:

from easy_ai_clients import account, audio, image, media, music, text, video, webhooks

Provider modules under private _apis packages are implementation details. Applications should use the public dispatcher modules.

Module Main Functions Purpose
text generate, list_models, update_cost, available_apis Text-in/text-out generation
audio generate, transcribe, prepare_transcription_audio, voice helpers, update_cost Speech synthesis, transcription, and voice workflows
image generate, edit, remix, analyze, update_cost Image generation, editing, remixing, and vision analysis
music generate, get_status, download_result, get_generation_options, get_style_presets, build_lyrics_prompt Narrow validated lyric-based music generation
video generate, text_to_video, image_to_video, video_to_video, motion_control, avatar_video, video_with_audio, create_avatar, image_lipsync, video_lipsync, agent_video, translate, async helpers Video generation, lip-sync, avatar, translation, and HeyGen resource workflows
media upload_asset, delete_asset, available_apis Provider asset helpers
webhooks endpoint, event, and secret-rotation helpers Provider webhook management
account get_current_user, available_apis Provider account lookup

Supported Providers

Use provider discovery helpers to inspect the provider IDs available for each operation:

from easy_ai_clients import account, audio, image, media, music, text, video, webhooks

text.available_apis()
audio.available_synthesize_apis()
audio.available_transcribe_apis()
audio.available_voice_apis()
image.available_generate_apis()
image.available_edit_apis()
image.available_remix_apis()
image.available_analyze_apis()
music.available_apis()
video.available_text_to_video_apis()
video.available_image_to_video_apis()
video.available_video_to_video_apis()
video.available_motion_control_apis()
video.available_avatar_video_apis()
video.available_video_with_audio_apis()
video.available_create_avatar_apis()
video.available_image_lipsync_apis()
video.available_video_lipsync_apis()
video.available_agent_video_apis()
video.available_translate_apis()
video.available_video_resource_apis()
media.available_apis()
webhooks.available_apis()
account.available_apis()

Detailed provider matrices live in docs/providers.md.

Configuration

Credentials are resolved from environment variables at provider-call time. Configure only the providers your application will call.

export OPENAI_API_KEY="sk-..."
export DEEPGRAM_API_KEY="..."
$env:OPENAI_API_KEY = "sk-..."
$env:DEEPGRAM_API_KEY = "..."

For local dotenv workflows, load a private file explicitly before using the library. Keep real secret files outside the repository.

from dotenv import load_dotenv

load_dotenv("path/to/private.env")

Reference files:

Usage Notes

Audio

Transcription accepts local paths, supported URLs, bytes, base64 strings, data URLs, and pydub.AudioSegment objects where the selected provider supports them. prepare_transcription_audio(...) can prepare reusable upload payloads for comparing providers or models.

Deepgram receives one whole prepared payload per audio.transcribe(...) call. Segment long media before calling the library if your workflow needs multiple provider requests.

Images

Image inputs can be local file paths, public http / https URLs, raw base64 strings, or base64 data URLs. For image.edit, the public mask convention is black = editable and white = preserve.

Music

easy_ai_clients.music is intentionally narrow. It supports exactly:

("deapi", "elevenlabs", "google", "runware")

music.generate(...) validates provider/model support before dispatch. Public music results exclude raw provider responses, credentials, auth headers, provider audio URLs, signed URLs, and large audio payloads.

Video

Video operations support synchronous and asynchronous provider workflows where the selected provider exposes them. Async video results preserve safe provider references such as status_url, response_url, result_url, task_url, and operation_url when available.

For direct video.download(..., video_url=...), pass output_path; omitting it returns a normalized failure instead of silently returning None.

Return Contracts

Public dispatchers return normalized dictionaries when the operation can preserve its public result shape.

Operation Family Important Result Fields
text.generate(...) request_id, cost_source, cost_usd, input_text, instruction, output_text, optional error
audio.generate(...) cost_usd, audio as pydub.AudioSegment, words, optional error
audio.transcribe(...) text, words, segments, speaker_*, provider_metadata, request_id, cost_usd, cost_source, cost_is_estimated, cost_lookup_error
image.generate/edit/remix(...) cust_usd, cost_usd, cost_currency, cost_is_estimated, cost_source, cost_details, base64, warnings, request_id
image.analyze(...) request_id, cost_usd, cost_currency, cost_is_estimated, cost_source, cost_details, input_text, output
music.generate/status/download(...) provider, model, model_key, status, request_id, output_path, cost_usd, cost_currency, cost_source, cost_is_estimated, cost_details, metadata
video operations provider, model, status, request_id, video_url, output_path, cost_usd, cost_is_estimated, cost_source, raw_response, safe async refs when available
media, webhooks, account, video resources provider, data, raw_response; destructive delete helpers require confirm=True

The image cust_usd key is preserved as a legacy alias. New code should prefer the standardized cost_usd metadata.

Provider Parameters And Costs

Most dispatchers forward provider-native keyword arguments whenever the wrapper can assemble a request. Documented models and parameters are metadata for defaults, examples, and cost estimates; they are not a complete local acceptance list.

The music dispatcher is stricter. It rejects unsupported music models, unknown styles, removed public kwargs, and unsupported negative_prompt usage before provider dispatch.

Cost values are best-effort normalized USD values. Unknown costs use cost_source="unavailable" with supporting warnings or lookup-error metadata when available.

Errors

Public operations return normalized failure dictionaries when possible. Error messages are sanitized to avoid leaking credentials, authorization headers, or signed URLs.

Some helper functions and private adapter paths can still raise standard Python exceptions such as ValueError, RuntimeError, OSError, requests exceptions, or httpx exceptions.

See docs/errors.md for details.

Development And Validation

Install development dependencies:

pip install -e ".[dev]"

Safe local validation:

python -m compileall -q src tests
python -m pytest -m "not live"
python -m ruff check src tests
rm -rf dist build
python -m build
python -m twine check dist/*

Live tests are gated with explicit environment variables and are marked with pytest.mark.live. Keep those gates unset during ordinary local validation.

Documentation

License

MIT. See LICENSE.

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

easy_ai_clients-0.11.0.tar.gz (416.7 kB view details)

Uploaded Source

Built Distribution

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

easy_ai_clients-0.11.0-py3-none-any.whl (707.4 kB view details)

Uploaded Python 3

File details

Details for the file easy_ai_clients-0.11.0.tar.gz.

File metadata

  • Download URL: easy_ai_clients-0.11.0.tar.gz
  • Upload date:
  • Size: 416.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.13

File hashes

Hashes for easy_ai_clients-0.11.0.tar.gz
Algorithm Hash digest
SHA256 571ca0a2d10a8f3c52e3e1a016905b5306798c941e57cd73642b0fe80f85c5cf
MD5 46d8625d12ffe3281217626cfaad4214
BLAKE2b-256 36c8c3df1c5a9d79a0408c9938d9bf719aea2f8419d81203a8c82fe950f569c2

See more details on using hashes here.

File details

Details for the file easy_ai_clients-0.11.0-py3-none-any.whl.

File metadata

File hashes

Hashes for easy_ai_clients-0.11.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2a5410687d03002125760fcff20878dda88d5ade68de3c91f794e1ba8da8d7c1
MD5 64c09da6ca940d5c1c4670074cc69ce9
BLAKE2b-256 435b5114956eff369bce3e07c71e78653f5c553fac25622a459da701fb08ef36

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