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.
- Set your environment:
export VIDAI_PROVIDER=vidai
export VIDAI_BASE_URL=http://localhost:8000/v1
export VIDAI_SERVER_API_KEY=sk-...
- 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
22feea849c3215d59c511778b39b29e9bbec0bcba97c2ff6021571f23e0fbf27
|
|
| MD5 |
474499fad36777225426f95f094d9327
|
|
| BLAKE2b-256 |
800cd6a8fe021ceacefc89eb632e5d6cfced889a35702a8e235879ee3d692d11
|
Provenance
The following attestation bundles were made for vidaisdk-0.5.0.tar.gz:
Publisher:
pypi_publish.yml on vidaiUK/vidaisdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
vidaisdk-0.5.0.tar.gz -
Subject digest:
22feea849c3215d59c511778b39b29e9bbec0bcba97c2ff6021571f23e0fbf27 - Sigstore transparency entry: 785889665
- Sigstore integration time:
-
Permalink:
vidaiUK/vidaisdk@1a8311f58bfe3e1105bafa73718ea31f5ebb9c5b -
Branch / Tag:
refs/tags/v0.5.0 - Owner: https://github.com/vidaiUK
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi_publish.yml@1a8311f58bfe3e1105bafa73718ea31f5ebb9c5b -
Trigger Event:
release
-
Statement type:
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d0e38e32b6d4761bbe69e5609f088c828da9cacf46144b3565186cb0a1dd4434
|
|
| MD5 |
2c7f9cbc40663e1af7fefa4182da7b7f
|
|
| BLAKE2b-256 |
dab6419fb33bd72e7f9bdd8325610b885396678b325f8da98188a00dd14ad612
|
Provenance
The following attestation bundles were made for vidaisdk-0.5.0-py3-none-any.whl:
Publisher:
pypi_publish.yml on vidaiUK/vidaisdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
vidaisdk-0.5.0-py3-none-any.whl -
Subject digest:
d0e38e32b6d4761bbe69e5609f088c828da9cacf46144b3565186cb0a1dd4434 - Sigstore transparency entry: 785889674
- Sigstore integration time:
-
Permalink:
vidaiUK/vidaisdk@1a8311f58bfe3e1105bafa73718ea31f5ebb9c5b -
Branch / Tag:
refs/tags/v0.5.0 - Owner: https://github.com/vidaiUK
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi_publish.yml@1a8311f58bfe3e1105bafa73718ea31f5ebb9c5b -
Trigger Event:
release
-
Statement type: