Skip to main content

Universal OpenAI-compatible Client with Structured Output Guarantees

Project description

Vidai

Universal OpenAI-compatible Client with structured output guarantees and provider abstraction.

Installation

pip install vidaisdk

Quick Start

import os
from vidai import Vidai
from pydantic import BaseModel

# Optional: Alias as OpenAI for drop-in compatibility if desired
# from vidai import Vidai as OpenAI

class User(BaseModel):
    name: str
    age: int

client = Vidai(
    api_key=os.environ.get("OPENAI_API_KEY"),
    # It sends requests to OpenAI by default,
    # but strictly validates/repairs responses locally
)
# If you want to use a custom base_url or proxy, you can do this:
# client = Vidai(
#     api_key="your-key",
#     base_url="https://your-proxy.com/v1"
# )

response = client.chat.completions.create(
    model="gpt-4",
    messages=[{"role": "user", "content": "Create a user named John, age 25"}],
    response_format=User
)

user = response.choices[0].message.parsed
print(user.name)  # "John"
print(user.age)   # 25

Using with Vidai Server (Auto-Discovery)

Vidai acts as a smart facade when connected to a Vidai Server proxy. It automatically discovers available models and applies provider-specific optimizations (like Claude tool-use) without any client-side configuration changes.

  1. Set your environment:
export VIDAI_PROVIDER=vidai
export VIDAI_BASE_URL=http://localhost:8000/v1
export VIDAI_SERVER_API_KEY=sk-...
  1. Use the client as usual:
client = Vidai() # Automatically detects 'vidai' provider from env
# Automatically routes to Anthropic, DeepSeek, Google based on model name
response = client.chat.completions.create(model="claude-3-haiku", ...)

Features

  • Drop-in Compatibility: 100% compatible with OpenAI SDK API (Completions & Responses)
  • Responses API: Type-safe, object-based access normalized across all providers.
  • Structured Output Guarantees: Automatic JSON repair and validation
  • Performance Tracking: Monitor SDK overhead and repair times
  • Provider Agnostic: Works with any AI provider through your proxy
  • Developer Friendly: Clear error messages and debugging support

Documentation

See the GitHub Repository for the latest updates.

License

Apache-2.0

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

vidaisdk-0.5.0.tar.gz (82.9 kB view details)

Uploaded Source

Built Distribution

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

vidaisdk-0.5.0-py3-none-any.whl (39.7 kB view details)

Uploaded Python 3

File details

Details for the file vidaisdk-0.5.0.tar.gz.

File metadata

  • Download URL: vidaisdk-0.5.0.tar.gz
  • Upload date:
  • Size: 82.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for vidaisdk-0.5.0.tar.gz
Algorithm Hash digest
SHA256 22feea849c3215d59c511778b39b29e9bbec0bcba97c2ff6021571f23e0fbf27
MD5 474499fad36777225426f95f094d9327
BLAKE2b-256 800cd6a8fe021ceacefc89eb632e5d6cfced889a35702a8e235879ee3d692d11

See more details on using hashes here.

Provenance

The following attestation bundles were made for vidaisdk-0.5.0.tar.gz:

Publisher: pypi_publish.yml on vidaiUK/vidaisdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file vidaisdk-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: vidaisdk-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 39.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for vidaisdk-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d0e38e32b6d4761bbe69e5609f088c828da9cacf46144b3565186cb0a1dd4434
MD5 2c7f9cbc40663e1af7fefa4182da7b7f
BLAKE2b-256 dab6419fb33bd72e7f9bdd8325610b885396678b325f8da98188a00dd14ad612

See more details on using hashes here.

Provenance

The following attestation bundles were made for vidaisdk-0.5.0-py3-none-any.whl:

Publisher: pypi_publish.yml on vidaiUK/vidaisdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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