Vapi 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)
List Resources
client.assistants.list() returns a Python list. Use its limit and timestamp filters to select results. Other endpoints have their own response types and pagination parameters; consult the SDK reference for the endpoint you use.
Advanced
Retries
The SDK retries HTTP 408, 409, 429, and 5xx responses with backoff. The default maximum is two retries. Set max_retries for an individual request:
import os
from vapi import Vapi
client = Vapi(token=os.environ["VAPI_API_KEY"])
client.assistants.list(limit=10, request_options={"max_retries": 1})
Timeouts
The default client timeout is 60 seconds. Set timeout when creating the client or override it with timeout_in_seconds for a request. When you supply a custom HTTPX client, its read timeout becomes the default unless you set timeout explicitly.
import os
from vapi import Vapi
client = Vapi(token=os.environ["VAPI_API_KEY"], timeout=20.0)
client.assistants.list(limit=10, request_options={"timeout_in_seconds": 1})
Custom Client
Pass an HTTPX client to configure its transport. This example sets HTTPTransport.local_address and closes the custom client when the block finishes:
import os
import httpx
from vapi import Vapi
with httpx.Client(transport=httpx.HTTPTransport(local_address="0.0.0.0")) as http:
client = Vapi(token=os.environ["VAPI_API_KEY"], httpx_client=http)
assistants = client.assistants.list(limit=10)
for assistant in assistants:
print(assistant.id)
Contributing
While we value open-source contributions to this SDK, this library is generated programmatically. Additions made directly to this library would have to be moved over to our generation code, otherwise they would be overwritten upon the next generated release. Feel free to open a PR as a proof of concept, but know that we will not be able to merge it as-is. We suggest opening an issue first to discuss with us!
On the other hand, contributions to the README are always very welcome!
Metadata
Release files for vapi-server-sdk 3.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| vapi_server_sdk-3.0.0.tar.gz | 1.3 MB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| vapi_server_sdk-3.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 4.0 MB
Release files / vapi_server_sdk-3.0.0.tar.gz
| Download URL | vapi_server_sdk-3.0.0.tar.gz |
|---|---|
| Size | 1.3 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a0f9de93d86c4c96d9f27cf2ebc52090a5582b1da4c37363542d3ce3c8de35eb
|
|
BLAKE2b-256 checksum How to use checksums |
ce1df7f5e9fbe2353bd05bf965620208d55a9d50eafd0a5b1b8f866c9e7ffba2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.5.1 CPython/3.10.22 Darwin/25.6.0
|
Release files / vapi_server_sdk-3.0.0-py3-none-any.whl
| Download URL | vapi_server_sdk-3.0.0-py3-none-any.whl |
|---|---|
| Size | 2.7 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
44616500ab465c3bcd508c6d8743395fcc26929fbbe71cd11b7e38eb552484d9
|
|
BLAKE2b-256 checksum How to use checksums |
f531c047a3565808ad8f8f061e2ead5877a4f92632f82d5d69e758235ad33226
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.5.1 CPython/3.10.22 Darwin/25.6.0
|