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: @xidaoapi
- 🐛 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.1.tar.gz
(5.6 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.1.tar.gz.
File metadata
- Download URL: xidao_ai-1.0.1.tar.gz
- Upload date:
- Size: 5.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
69f5048928492abdd3036a4bcc806d211d9b1300fdd9403972f088e44ae2fb4e
|
|
| MD5 |
fde9c093355dbbcac48a291b988eaf8f
|
|
| BLAKE2b-256 |
ab7a383405415c27703391817458298b30ccc2850c2f89eb3a88caeb1c6b6bed
|
File details
Details for the file xidao_ai-1.0.1-py3-none-any.whl.
File metadata
- Download URL: xidao_ai-1.0.1-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 |
fb260210fd271f1fe38443a1a26a6a9504515618d095ae8e98aa4c0c856d4d89
|
|
| MD5 |
cd742b6d261214ad5de33ff6584bc930
|
|
| BLAKE2b-256 |
9626dfa3164076028ec651ceb19ac885f54847f5e9094a4e3bc15bc65f4ea6ba
|