Metadata-Version: 2.4
Name: xidao-ai
Version: 1.0.1
Summary: Official Python SDK for XiDao AI API Gateway
Home-page: https://github.com/XidaoApi/xidao-python-sdk
Author: XiDao Team
Author-email: XiDao Team <support@xidao.online>
License: MIT
Project-URL: Homepage, https://xidaoapi.com
Project-URL: Documentation, https://github.com/XidaoApi/xidao-python-sdk
Project-URL: Repository, https://github.com/XidaoApi/xidao-python-sdk
Project-URL: Issues, https://github.com/XidaoApi/xidao-python-sdk/issues
Keywords: ai,api,openai,claude,gpt,gemini,llm,gateway
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Requires-Python: >=3.8
Description-Content-Type: text/markdown
Requires-Dist: httpx>=0.24.0
Provides-Extra: dev
Requires-Dist: pytest>=7.0; extra == "dev"
Requires-Dist: pytest-asyncio>=0.21; extra == "dev"
Requires-Dist: black>=23.0; extra == "dev"
Requires-Dist: isort>=5.0; extra == "dev"
Requires-Dist: mypy>=1.0; extra == "dev"
Dynamic: author
Dynamic: home-page
Dynamic: requires-python

# XiDao AI API Gateway - Python SDK

[![PyPI version](https://badge.fury.io/py/xidao-ai.svg)](https://badge.fury.io/py/xidao-ai)
[![Python](https://img.shields.io/pypi/pyversions/xidao-ai.svg)](https://pypi.org/project/xidao-ai/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

Official Python SDK for [XiDao AI API Gateway](https://xidaoapi.com) - Access Claude 4.7, GPT-5.5, Gemini 3.0 and more through a single API.

## Installation

```bash
pip install xidao-ai
```

## Quick Start

```python
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

```python
models = client.models.list()
for model in models:
    print(f"{model.id}: {model.owned_by}")
```

### Async Client

```python
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

```python
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

```python
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:

```bash
export XIDAO_API_KEY="your_api_key"
```

Then initialize the client without passing the key:

```python
client = XiDao()  # Will use XIDAO_API_KEY environment variable
```

## License

MIT License - see [LICENSE](LICENSE) for details.

## Support

- 📧 Email: support@xidao.online
- 📢 Telegram: [@xidaoapi](https://t.me/xidaoapi)
- 🐛 Issues: [GitHub Issues](https://github.com/XidaoApi/xidao-python-sdk/issues)

## Links

- [XiDao AI API Gateway](https://xidaoapi.com)
- [Documentation](https://github.com/XidaoApi/xidao-python-sdk)
- [PyPI Package](https://pypi.org/project/xidao-ai/)
