Official Python SDK for XiDao AI API Gateway
Project description
XiDao AI API Gateway - Python SDK
Official Python SDK for XiDao AI API Gateway - Access Claude 4.7, GPT-5.5, Gemini 3.0 and more through a single API.
Installation
pip install xidao-ai
Quick Start
from xidao_ai import XiDao
# Initialize client
client = XiDao(api_key="your_api_key")
# Chat completion
response = client.chat.completions.create(
model="claude-4.7",
messages=[{"role": "user", "content": "Hello!"}]
)
print(response.choices[0].message.content)
Available Models
- Claude 4.7 - Best for reasoning and analysis
- GPT-5.5 - Universal model from OpenAI
- Gemini 3.0 - Best price/performance ratio
- DeepSeek V3 - Powerful open-source model
- Qwen Max - Excellent for Chinese language
Features
- ✅ OpenAI-compatible API
- ✅ Automatic model routing
- ✅ Response caching
- ✅ Rate limiting handling
- ✅ Async support
- ✅ Type hints
Advanced Usage
List Available Models
models = client.models.list()
for model in models:
print(f"{model.id}: {model.owned_by}")
Async Client
import asyncio
from xidao_ai import AsyncXiDao
async def main():
client = AsyncXiDao(api_key="your_api_key")
response = await client.chat.completions.create(
model="gpt-5.5",
messages=[{"role": "user", "content": "Hello!"}]
)
print(response.choices[0].message.content)
asyncio.run(main())
Streaming
stream = client.chat.completions.create(
model="claude-4.7",
messages=[{"role": "user", "content": "Tell me a story"}],
stream=True
)
for chunk in stream:
print(chunk.choices[0].delta.content, end="")
Error Handling
from xidao_ai import XiDao, APIError, AuthenticationError
try:
client = XiDao(api_key="invalid_key")
except AuthenticationError as e:
print(f"Authentication failed: {e}")
try:
response = client.chat.completions.create(
model="invalid-model",
messages=[{"role": "user", "content": "Hello"}]
)
except APIError as e:
print(f"API error: {e.status_code} - {e.message}")
Environment Variables
You can set your API key as an environment variable:
export XIDAO_API_KEY="your_api_key"
Then initialize the client without passing the key:
client = XiDao() # Will use XIDAO_API_KEY environment variable
License
MIT License - see LICENSE for details.
Support
- 📧 Email: support@xidao.online
- 📢 Telegram: @xidao_gateway
- 🐛 Issues: GitHub Issues
Links
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
xidao_ai-1.0.0.tar.gz
(5.5 kB
view details)
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 xidao_ai-1.0.0.tar.gz.
File metadata
- Download URL: xidao_ai-1.0.0.tar.gz
- Upload date:
- Size: 5.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2dcab550fe1f88e83a7f54985c7839dce629e7c3dcd44ad500dda815538734a3
|
|
| MD5 |
8cd723d4d2ffb7d2c4178bcb9039f023
|
|
| BLAKE2b-256 |
8220061ed252e320564ca3bd3109592375ea8ddd1eff4ba0e66be03af948540a
|
File details
Details for the file xidao_ai-1.0.0-py3-none-any.whl.
File metadata
- Download URL: xidao_ai-1.0.0-py3-none-any.whl
- Upload date:
- Size: 5.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
395da362b23cba39146adb48d32c71ae76342c3b3ca542fb2c5201cf0025c637
|
|
| MD5 |
71071dadbc62d5a8e7bbed98c7dbf44f
|
|
| BLAKE2b-256 |
74932258fc005ca146c334bfc5b03961e9100fbc9b82f09afaed31b5613652c4
|