Official Python SDK for the Aethex voice AI platform
Project description
Aethex AI Python SDK
Deploy production voice agents with the AethexAI Voice API.
Create governed voice agents, place customer calls, synthesize speech, transcribe recordings, and operate realtime voice workflows from Python.
Install
pip install aethexai
Optional extras:
pip install "aethexai[realtime]" # WebRTC conversations (Conversation class)
The [realtime] extra installs aiortc and av (PyAV). PyAV needs system
FFmpeg headers at wheel-build time — on Debian/Ubuntu install
libavformat-dev libavfilter-dev libavdevice-dev first; on macOS,
brew install ffmpeg.
Requires Python 3.10+.
Quickstart
Create an agent for a customer operations workflow and place an outbound call.
from aethexai import AethexAI
client = AethexAI(api_key="ae_live_...") # or set AETHEX_API_KEY
voices = client.list_voices(language="french", limit=5)
voice = voices[0]
agent = client.create_agent(
name="Customer Operations Assistant",
system_prompt=(
"You are a professional customer operations assistant. "
"Help callers confirm appointments, answer policy questions, "
"and escalate to a human when required."
),
first_message="Bonjour, comment puis-je vous aider?",
voice_id=voice.id,
language="french",
dialect_style="local",
)
call = client.trigger_call(
agent_id=agent.id,
to_number="+221700000000",
)
print(call.id, call.status)
Clients
The SDK exposes two main clients.
| Client | Use it for |
|---|---|
AethexAI |
API-key authenticated platform operations: agents, calls, TTS, transcription jobs, conversations, phone numbers, SIP trunks, Twilio accounts, usage, uploads, and API keys. |
Kora |
Focused voice-agent workflows: agents, outbound calls, voices, TTS, transcription, and conversation history. |
DeveloperClient |
JWT-authenticated developer account and billing operations. |
Async code uses AsyncAethexAI, which mirrors the sync client method-for-method.
import asyncio
from aethexai import AsyncAethexAI
async def main() -> None:
async with AsyncAethexAI(api_key="ae_live_...") as client:
voices = await client.list_voices(language="english")
print([voice.id for voice in voices])
asyncio.run(main())
Core Workflows
Text to speech
Generate a complete audio asset for IVR, onboarding, or customer support:
audio = client.synthesize_speech(
text="Your appointment has been confirmed for tomorrow at 10 AM.",
voice_id="fatima",
language="english",
)
with open("appointment-confirmation.wav", "wb") as f:
f.write(audio)
Stream audio chunks for low-latency playback:
for chunk in client.stream_speech(
text="I am checking your account now. Please hold for a moment.",
voice_id="fatima",
language="english",
):
speaker.write(chunk) # PCM16 audio chunks
Transcription
For file transcription workflows, use Kora.
from aethexai import Kora
kora = Kora("https://api.aethexai.com", "ae_live_...")
with open("call.wav", "rb") as f:
result = kora.transcribe(
f,
language="french",
file_name="call.wav",
mime_type="audio/wav",
)
print(result.text)
Submit longer recordings as asynchronous transcription jobs:
import time
from aethexai import Kora
kora = Kora("https://api.aethexai.com", "ae_live_...")
with open("long-call.wav", "rb") as f:
job = kora.transcribe_async(
f,
language="french",
file_name="long-call.wav",
mime_type="audio/wav",
)
while True:
job = kora.get_transcribe_job(job.id)
if job.status in ("completed", "failed"):
break
time.sleep(2)
print(job.text)
Realtime conversations
Install the realtime extra for full-duplex WebRTC conversations.
pip install "aethexai[realtime]"
import asyncio
from aethexai import AsyncAethexAI
from aethexai.realtime import Conversation, ConversationCallbacks
async def main() -> None:
client = AsyncAethexAI(api_key="ae_live_...")
conversation = Conversation(
client,
agent_id="agent-uuid",
callbacks=ConversationCallbacks(
on_agent_text=lambda text: print("agent:", text),
on_user_transcript=lambda text: print("user:", text),
),
)
await conversation.start()
# Audio flows over WebRTC until you end the session.
await conversation.end()
await client.close()
asyncio.run(main())
Platform Coverage
AethexAI uses a flat method surface: one method per endpoint, no nested
namespaces. This keeps platform automation explicit and easy to audit.
| Area | Methods |
|---|---|
| Agents | create_agent, list_agents, get_agent, update_agent, delete_agent, duplicate_agent |
| Tools | add_agent_tool, list_agent_tools, update_agent_tool, delete_agent_tool |
| Knowledge base | upload_knowledge_doc, upload_knowledge_doc_by_upload, list_knowledge_docs, query_knowledge_base |
| Calls | trigger_call, batch_calls, list_calls, get_call, get_call_status |
| TTS | synthesize_speech, stream_speech, batch_synthesize, get_tts_batch |
| Transcription | transcribe_audio, transcribe_audio_async, get_transcription_job, cancel_transcription_job |
| Conversations | list_conversations, get_conversation, get_transcript, stream_audio, submit_feedback |
| Phone and SIP | list_phone_numbers, register_twilio_phone_number, register_sip_phone_number, list_sip_trunks |
| Twilio accounts | register_twilio_account, list_twilio_accounts, get_twilio_account, release_twilio_account |
| Usage | get_usage, get_usage_summary |
| API keys | list_api_keys, create_api_key, rotate_api_key, revoke_api_key |
See the API reference for request and response fields.
Developer Account and Billing
Billing and account endpoints require a developer JWT from the dashboard auth
flow, not an API key. Use DeveloperClient for those calls.
from aethexai import DeveloperClient
developer = DeveloperClient(
access_token="eyJhbGciOi...",
refresh_token="eyJhbGciOi...", # optional; enables one retry after refresh
)
balance = developer.get_balance()
plans = developer.list_plans()
DeveloperClient reads AETHEX_DEVELOPER_ACCESS_TOKEN and
AETHEX_DEVELOPER_REFRESH_TOKEN when tokens are not passed explicitly.
Configuration
from aethexai import AethexAI
client = AethexAI(
api_key="ae_live_...",
base_url="https://api.aethexai.com",
timeout=30.0,
max_retries=2,
)
| Parameter | Default | Description |
|---|---|---|
api_key |
$AETHEX_API_KEY |
API key sent as X-API-Key. |
base_url |
https://api.aethexai.com |
AethexAI API base URL. |
timeout |
30.0 |
Per-request timeout in seconds. |
max_retries |
2 |
HTTP transport retries for retryable failures. |
httpx_client |
None |
Optional custom httpx.Client or httpx.AsyncClient. |
Errors
Non-2xx responses raise typed exceptions. Transport failures are mapped to SDK errors, so production callers can centralize retry, alerting, and escalation logic.
from aethexai import (
AethexAI,
AethexError,
AuthenticationError,
NotFoundError,
RateLimitError,
ValidationError,
)
client = AethexAI(api_key="ae_live_...")
try:
agent = client.get_agent("00000000-0000-0000-0000-000000000000")
except NotFoundError:
print("Agent not found")
except RateLimitError as e:
print(f"Rate limited. Retry after {e.retry_after}s")
except AuthenticationError:
print("Invalid API key")
except ValidationError as e:
print(f"Request rejected: {e.response}")
except AethexError as e:
print(f"SDK error: {e}")
| Status | Exception |
|---|---|
| 401 | AuthenticationError |
| 403 | PermissionDeniedError |
| 404 | NotFoundError |
| 409 | ConflictError |
| 422 | ValidationError |
| 429 | RateLimitError |
| 5xx | InternalServerError |
| Network failure | APIConnectionError |
| Timeout | APITimeoutError |
Development
The generated REST client lives under src/aethexai/_generated/ and is built
from openapi.json. The maintained SDK surface lives in:
src/aethexai/client.pysrc/aethexai/_async_client.pysrc/aethexai/kora.pysrc/aethexai/realtime/
Run the local checks:
uv run pytest
uv run ruff check .
uv run ruff format --check src/ tests/ scripts/
uv run mypy src/aethexai
See CONTRIBUTING.md for the full development workflow.
Questions about the SDK can be sent to developers@aethexai.com.
Community
- GitHub: github.com/Aethex-AI
- X: @aethexailabs
- LinkedIn: AethexAI
- Discord: discord.gg/3yAMnpRd
License
Released under the MIT License.
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 aethexai-0.2.1.tar.gz.
File metadata
- Download URL: aethexai-0.2.1.tar.gz
- Upload date:
- Size: 297.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b7aa833a6e420a5566b6acf9eb650022371135f60291b9df63be45b470a3a519
|
|
| MD5 |
307b926fe1c6a2dfbecccf8a84da170b
|
|
| BLAKE2b-256 |
6309c33ea0fa881c421cfd8dbf1a765d848815ddf879a799f638b4389d729c9b
|
Provenance
The following attestation bundles were made for aethexai-0.2.1.tar.gz:
Publisher:
release.yml on aethexai/aethexai-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
aethexai-0.2.1.tar.gz -
Subject digest:
b7aa833a6e420a5566b6acf9eb650022371135f60291b9df63be45b470a3a519 - Sigstore transparency entry: 1587910024
- Sigstore integration time:
-
Permalink:
aethexai/aethexai-python@cff936529a41563c4de92260ab23affb7ecb83d6 -
Branch / Tag:
refs/tags/v0.2.1 - Owner: https://github.com/aethexai
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@cff936529a41563c4de92260ab23affb7ecb83d6 -
Trigger Event:
push
-
Statement type:
File details
Details for the file aethexai-0.2.1-py3-none-any.whl.
File metadata
- Download URL: aethexai-0.2.1-py3-none-any.whl
- Upload date:
- Size: 426.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7dd7e3e49e8e8e0d09d2aa5382be336fa02ee9d0867d46538e4208195736f81a
|
|
| MD5 |
918021f041e20ae5b2d2a9f2f09e935d
|
|
| BLAKE2b-256 |
10dc580e1de21621ec8310d5fe931019d75567de66034fbaf34e3bc59c5922f8
|
Provenance
The following attestation bundles were made for aethexai-0.2.1-py3-none-any.whl:
Publisher:
release.yml on aethexai/aethexai-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
aethexai-0.2.1-py3-none-any.whl -
Subject digest:
7dd7e3e49e8e8e0d09d2aa5382be336fa02ee9d0867d46538e4208195736f81a - Sigstore transparency entry: 1587910075
- Sigstore integration time:
-
Permalink:
aethexai/aethexai-python@cff936529a41563c4de92260ab23affb7ecb83d6 -
Branch / Tag:
refs/tags/v0.2.1 - Owner: https://github.com/aethexai
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@cff936529a41563c4de92260ab23affb7ecb83d6 -
Trigger Event:
push
-
Statement type: