Python SDK
The official Python client (sync and asyncio) for every VoiceMint product.
Python 3.9+, one dependency (httpx). Sync VoiceMint and asyncio AsyncVoiceMint clients, typed errors, automatic retries and helpers that wait for jobs. Source: github.com/alphaaiservice/voicemint-python.
Install#
Not on PyPI yet. Install from GitHub:
pip install "git+https://github.com/alphaaiservice/voicemint-python.git"
# a specific release
pip install "git+https://github.com/alphaaiservice/voicemint-python.git@v0.3.0"Once published: pip install voicemint.
Configure#
from voicemint import VoiceMint
client = VoiceMint() # reads VOICEMINT_API_KEY
client = VoiceMint(api_key="vm_sk_live_...", timeout=60.0, max_retries=2)base_url (or VOICEMINT_BASE_URL) points the client at another environment.
Five lines#
from voicemint import VoiceMint
client = VoiceMint()
agent = client.agents.create("Support bot", instructions="Answer briefly.", status="active")
print(client.agents.chat(agent["id"], "What are your opening hours?")["reply"])What it covers#
| Area | Methods |
|---|---|
| Agents | agents.create/list/update/delete/chat, knowledge.*, calls.create/get/list/wait, numbers.*, telephony.providers, campaigns.*, live_sessions.create |
| Voice Lab | text_to_speech.create, speech_to_text.transcribe, voices.clone/speak/list/catalog, translation.*, audio.* |
| Music | music.generate, music.songs.create/wait, music.generate_lyria |
| Video & Image | video.generate, image.generate/edit/upload, jobs.wait/download |
| Meet | meet.personas, meet.experts.*, meet.meets.* |
| Anything else | client.request(method, path, json=..., params=..., files=..., data=...) |
Each API reference page shows the SDK method for that endpoint when there is one. The repository's API-COVERAGE.md lists all of them.
Async#
import asyncio
from voicemint import AsyncVoiceMint
async def main():
async with AsyncVoiceMint() as client:
r = await client.agents.chat("AGENT_ID", "Hello")
print(r["reply"])
asyncio.run(main())Errors and retries#
Errors are voicemint.APIError subclasses per status (see Errors). 429 and 5xx are retried automatically, honouring Retry-After; 402 is not.