Skip to main content
The official Zavu SDK for Python provides a clean, Pythonic interface to the Zavu API with full type hints.

Installation

pip install zavudev
# or
uv add zavudev
# or
poetry add zavudev

Requirements

  • Python 3.9 or higher

Quick Start

import os
from zavudev import Zavudev

zavu = Zavudev(
    api_key=os.environ.get("ZAVUDEV_API_KEY"),
)

result = zavu.messages.send(
    to="+14155551234",
    text="Hello from Zavu!"
)

print(f"Message sent: {result.message.id}")

Configuration

Initialize the Client

from zavudev import Zavudev

# Basic initialization
zavu = Zavudev(
    api_key="zv_live_xxx",
)

# With custom base URL
zavu = Zavudev(
    api_key="zv_live_xxx",
    base_url="https://api.zavu.dev"
)

Environment Variables

We recommend storing your API key in environment variables:
import os
from zavudev import Zavudev

zavu = Zavudev(
    api_key=os.environ.get("ZAVUDEV_API_KEY"),
)

Accessing Response Headers

Use .with_raw_response() to access the full HTTP response including headers:
response = zavu.messages.send.with_raw_response(
    to="+14155551234",
    text="Hello!"
)

remaining = response.headers.get("X-RateLimit-Remaining")
print(f"Remaining requests: {remaining}")

result = response.parse()
print(f"Message ID: {result.message.id}")

Error Handling

from zavudev import Zavudev, ZavudevError, APIError

zavu = Zavudev(
    api_key=os.environ.get("ZAVUDEV_API_KEY"),
)

try:
    zavu.messages.send(to="invalid-number", text="Hello")
except APIError as e:
    print(f"Status: {e.status_code}")
    print(f"Message: {e.message}")
except ZavudevError as e:
    print(f"Error: {e.message}")

Exception Types

ExceptionDescription
ZavudevErrorBase exception class
APIErrorAPI error with status code

Async Support

The SDK supports async/await with asyncio:
import asyncio
import os
from zavudev import AsyncZavudev

async def main():
    zavu = AsyncZavudev(
        api_key=os.environ.get("ZAVUDEV_API_KEY"),
    )

    result = await zavu.messages.send(
        to="+14155551234",
        text="Hello async!"
    )

    print(f"Message sent: {result.message.id}")

asyncio.run(main())

Retries

The SDK supports automatic retries with configurable backoff:
from zavudev import Zavudev

zavu = Zavudev(
    api_key="zv_live_xxx",
    max_retries=3,
)

result = zavu.messages.send(
    to="+14155551234",
    text="Hello!"
)

Type Hints

The SDK includes full type annotations:
from zavudev import Zavudev
from zavudev.types import Message

zavu = Zavudev(
    api_key=os.environ.get("ZAVUDEV_API_KEY"),
)

result = zavu.messages.send(
    to="+14155551234",
    text="Hello!"
)

message: Message = result.message

Debugging

Enable debug logging:
import logging
from zavudev import Zavudev

logging.basicConfig(level=logging.DEBUG)

zavu = Zavudev(
    api_key="zv_live_xxx",
)