Skip to main content

Official Python SDK for Vuzo API - unified access to OpenAI, xAI (Grok), and Google models

Project description

Vuzo Python SDK

Official Python SDK for Vuzo API — unified access to OpenAI, Anthropic, and Google models through a single interface.

PyPI version Python 3.8+ License: MIT

Features

  • Single API key for OpenAI, Anthropic (Claude), and Google (Gemini) models
  • Streaming and non-streaming chat completions
  • Usage tracking and billing management
  • API key management
  • Full type hints and Pydantic models
  • Simple, intuitive interface: from vuzo import Vuzo

Installation

pip install vuzo

Quick Start

from vuzo import Vuzo

client = Vuzo("vz-sk_your_key_here")

# Simple one-liner
response = client.chat.complete("gpt-4o-mini", "Hello!")
print(response)

# Full chat with details
response = client.chat.create(
    model="gpt-4o-mini",
    messages=[{"role": "user", "content": "What is 2+2?"}],
    temperature=0.7
)
print(response.choices[0].message.content)
print(f"Tokens used: {response.usage.total_tokens}")

Authentication

Get your API key from the Vuzo Dashboard. All keys start with vz-sk_.

# Pass key directly
client = Vuzo("vz-sk_your_key_here")

# Or use environment variable
import os
os.environ["VUZO_API_KEY"] = "vz-sk_your_key_here"
client = Vuzo()

Available Models

Model Provider Description
gpt-4o OpenAI Flagship GPT-4o
gpt-4o-mini OpenAI Fast & affordable
gpt-4.1 OpenAI GPT-4.1
gpt-4.1-mini OpenAI GPT-4.1 Mini
gpt-4.1-nano OpenAI Cheapest OpenAI option
grok-3 xAI Grok 3 (flagship)
grok-3-mini xAI Grok 3 Mini
grok-2 xAI Grok 2
gemini-2.0-flash Google Gemini 2.0 Flash
gemini-3-flash Google Gemini 3 Flash

Chat Completions

Non-Streaming

response = client.chat.create(
    model="gpt-4o-mini",
    messages=[
        {"role": "system", "content": "You are a helpful assistant."},
        {"role": "user", "content": "Tell me a joke."}
    ],
    temperature=0.8,
    max_tokens=200
)
print(response.choices[0].message.content)

Streaming

for chunk in client.chat.stream(
    model="claude-sonnet-4-20250514",
    messages=[{"role": "user", "content": "Write a short poem."}]
):
    print(chunk, end="", flush=True)
print()

Using xAI or Google Models

No extra setup needed — just change the model name:

# xAI Grok
response = client.chat.complete("grok-3-mini", "Explain quantum computing simply.")

# Google Gemini
response = client.chat.complete("gemini-2.0-flash", "What's the weather like on Mars?")

Models

# List all available models
models = client.models.list()
for model in models:
    print(f"{model.id} ({model.provider}) - Input: ${model.input_price_per_million}/M, Output: ${model.output_price_per_million}/M")

Usage & Billing

# Check balance
balance = client.billing.get_balance()
print(f"Balance: ${balance:.4f}")

# Usage summary
summary = client.usage.summary()
print(f"Total requests: {summary.total_requests}")
print(f"Total tokens: {summary.total_tokens:,}")
print(f"Total cost: ${summary.total_vuzo_cost:.4f}")

# Recent usage logs
logs = client.usage.list(limit=10)
for log in logs:
    print(f"{log.model}: {log.total_tokens} tokens — ${log.vuzo_cost:.6f}")

# Daily usage breakdown
daily = client.usage.daily(start_date="2025-01-01", end_date="2025-01-31")
for day in daily:
    print(f"{day.date} | {day.model}: {day.total_requests} requests, {day.input_tokens + day.output_tokens} tokens")

# Transaction history
transactions = client.billing.transactions()
for tx in transactions:
    print(f"{tx.created_at}: {tx.type} ${tx.amount:.4f}")

API Key Management

# List all API keys
keys = client.api_keys.list()
for key in keys:
    print(f"{key.name}: {key.key_prefix}... (active: {key.is_active})")

# Create a new key
new_key = client.api_keys.create("My App Key")
print(f"New key: {new_key.api_key}")

# Delete a key
client.api_keys.delete("key_id_here")

Error Handling

from vuzo import (
    Vuzo,
    AuthenticationError,
    InsufficientCreditsError,
    RateLimitError,
    InvalidRequestError,
    APIError,
)

try:
    response = client.chat.complete("gpt-4o-mini", "Hello!")
except AuthenticationError:
    print("Invalid API key — check your vz-sk_ key")
except InsufficientCreditsError:
    print("Top up your balance at the Vuzo dashboard")
except RateLimitError:
    print("Rate limit hit — slow down requests")
except InvalidRequestError as e:
    print(f"Bad request: {e}")
except APIError as e:
    print(f"API error {e.status_code}: {e}")

Multi-Provider Example

from vuzo import Vuzo

client = Vuzo("vz-sk_your_key_here")

prompt = "Explain neural networks in one sentence."

for model in ["gpt-4o-mini", "grok-3-mini", "gemini-2.0-flash"]:
    response = client.chat.complete(model, prompt)
    print(f"\n{model}:\n{response}")

Environment Variables

Variable Description
VUZO_API_KEY Your Vuzo API key (vz-sk_...)

Requirements

  • Python 3.8+
  • requests >= 2.31.0
  • pydantic >= 2.0.0

Development

# Clone the repo
git clone https://github.com/AurissoRnD/vuzo-unifai.git
cd vuzo-unifai

# Install in editable mode with dev dependencies
pip install -e ".[dev]"

# Run tests
pytest tests/ -v

License

MIT License — see LICENSE for details.

Links

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

vuzo-0.1.1.tar.gz (12.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

vuzo-0.1.1-py3-none-any.whl (12.5 kB view details)

Uploaded Python 3

File details

Details for the file vuzo-0.1.1.tar.gz.

File metadata

  • Download URL: vuzo-0.1.1.tar.gz
  • Upload date:
  • Size: 12.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.7

File hashes

Hashes for vuzo-0.1.1.tar.gz
Algorithm Hash digest
SHA256 8a1b109c12b1d302f03a7336856a95936f7163531a4485370947ead5ce94ec49
MD5 3ccf836c4c57587a9a6e28da5c7e944b
BLAKE2b-256 d30ac5ad5e43855967eb8587fd282a1379c7098c54c39ec2cb245c71ee388358

See more details on using hashes here.

File details

Details for the file vuzo-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: vuzo-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 12.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.7

File hashes

Hashes for vuzo-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 63ebdad2ae23887ec160834848c87f1541c5d4e2fcf4b08ed9ed3ad7d0d40973
MD5 cd166aa26849df0299dc0f9f70a4c90d
BLAKE2b-256 7c8bcad7cdc8445840aa2b51e293660f958fb7189e0c259d94105e949a23bf1c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page