Maintained. Last release 7 weeks ago, commits in 5 of the last 26 weeks. Weaker on commit activity and issue handling.
pip install vapi-server-sdkVapi Python Library
The Vapi Python library provides convenient access to the Vapi API from Python.
Installation
This release supports Python 3.10 through 3.14.
python -m pip install vapi_server_sdk
Install the optional async transport:
python -m pip install "vapi_server_sdk[aiohttp]"
Upgrade to 3.0.0
Version 3.0.0 updates the generated types to the current Vapi API definition. Review the 3.0.0 migration notes before upgrading from 1.x. Public helper imports, declared model fields, and structured-output run response types have changed.
python -m pip install --upgrade "vapi_server_sdk>=3.0.0,<4"
Reference
See the Python SDK reference for methods, parameters, and response types.
Usage
Set the VAPI_API_KEY environment variable to your Vapi private API key. Create a client and list up to 10 assistants in your organization:
import os
from vapi import Vapi
client = Vapi(token=os.environ["VAPI_API_KEY"])
assistants = client.assistants.list(limit=10)
for assistant in assistants:
print(assistant.id)
Async Client
Use AsyncVapi to await API requests:
import asyncio
import os
from vapi import AsyncVapi
async def main() -> None:
client = AsyncVapi(token=os.environ["VAPI_API_KEY"])
assistants = await client.assistants.list(limit=10)
for assistant in assistants:
print(assistant.id)
asyncio.run(main())
Exception Handling
Catch ApiError to inspect an unsuccessful API response:
import os
from vapi import Vapi
from vapi.core.api_error import ApiError
client = Vapi(token=os.environ["VAPI_API_KEY"])
try:
client.assistants.list(limit=10)
except ApiError as error:
print(error.status_code)
print(error.body)