Official Python SDK for Xeno API - Access 100+ AI models for image, video, music, and text generation
Project description
Xeno AI Python SDK
The official Python SDK for Xeno API - access 100+ AI models for image, video, music, and text generation with a single API.
Installation
# Primary package
pip install xeno-ai
# Alternative package name (same functionality)
pip install xeno-sdk
Quick Start
import xeno
# Initialize client
client = xeno.Client(api_key="your-api-key")
# Or use environment variable: export XENO_API_KEY="your-api-key"
client = xeno.Client()
Image Generation
# Generate an image
image = client.image.generate(
model="flux-pro-1.1",
prompt="A futuristic cityscape at sunset",
width=1024,
height=1024
)
print(image.url)
# Edit an image
edited = client.image.edit(
model="flux-kontext",
image="https://example.com/image.jpg",
prompt="Add a rainbow in the sky"
)
print(edited.url)
Available Image Models
| Model | Description |
|---|---|
flux-pro-1.1 |
High quality, fast generation |
flux-kontext |
Image editing and variations |
dall-e-3 |
OpenAI's DALL-E 3 |
4o-image |
GPT-4o image generation |
stable-diffusion-xl |
Stability AI SDXL |
Video Generation
# Generate a video
video = client.video.generate(
model="veo-3.1",
prompt="A drone shot flying over mountains at sunrise",
duration=5,
resolution="1080p"
)
print(video.url)
# Image to video
video = client.video.generate(
model="runway-aleph",
prompt="Make the water flow",
image="https://example.com/landscape.jpg"
)
Available Video Models
| Model | Description |
|---|---|
veo-3.1 |
Google's latest video model |
runway-aleph |
Runway's multi-task video model |
runway-gen-3 |
Runway Gen-3 |
minimax-video-01 |
Minimax video generation |
kling-v2.1 |
Kling video model |
Music Generation
# Generate a music track
music = client.music.generate(
model="suno-v4",
prompt="An upbeat electronic track with synths and drums",
duration=120,
genre="electronic"
)
print(music.url)
# With custom lyrics
music = client.music.generate(
model="suno-v4",
prompt="A pop ballad about summer love",
lyrics="Walking on the beach, sun shining bright...",
duration=180
)
Available Music Models
| Model | Description |
|---|---|
suno-v4 |
Latest Suno model |
suno-v3.5 |
Suno v3.5 |
udio |
Udio music generation |
Chat Completions (LLM)
# Chat completion
response = client.chat.completions.create(
model="gpt-4o",
messages=[
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Explain quantum computing in simple terms."}
]
)
print(response.choices[0].message.content)
# Streaming
for chunk in client.chat.completions.create(
model="claude-3.5-sonnet",
messages=[{"role": "user", "content": "Write a poem about AI"}],
stream=True
):
print(chunk.choices[0].delta.content or "", end="")
Available LLM Models
| Model | Description |
|---|---|
gpt-4o |
OpenAI GPT-4o |
gpt-4-turbo |
OpenAI GPT-4 Turbo |
claude-3.5-sonnet |
Anthropic Claude 3.5 Sonnet |
claude-3-opus |
Anthropic Claude 3 Opus |
gemini-pro |
Google Gemini Pro |
llama-3.1-405b |
Meta Llama 3.1 405B |
Async Usage
import asyncio
import xeno
async def main():
async with xeno.AsyncClient(api_key="your-api-key") as client:
# Generate image
image = await client.image.generate(
model="flux-pro-1.1",
prompt="A beautiful sunset"
)
print(image.url)
# Chat completion
response = await client.chat.completions.create(
model="gpt-4o",
messages=[{"role": "user", "content": "Hello!"}]
)
print(response.choices[0].message.content)
asyncio.run(main())
Error Handling
from xeno import (
XenoError,
AuthenticationError,
RateLimitError,
InsufficientCreditsError
)
try:
image = client.image.generate(model="flux-pro-1.1", prompt="...")
except AuthenticationError:
print("Invalid API key")
except RateLimitError as e:
print(f"Rate limited. Retry after {e.retry_after} seconds")
except InsufficientCreditsError:
print("Not enough credits. Please top up.")
except XenoError as e:
print(f"API error: {e.message}")
Configuration
client = xeno.Client(
api_key="your-api-key",
base_url="https://api.xenostudio.ai/v1", # Custom endpoint
timeout=60.0, # Request timeout in seconds
max_retries=2, # Number of retries on failure
)
Using with OpenAI SDK
The Xeno API is OpenAI-compatible, so you can also use the OpenAI SDK:
from openai import OpenAI
client = OpenAI(
api_key="your-xeno-api-key",
base_url="https://api.xenostudio.ai/v1"
)
response = client.chat.completions.create(
model="gpt-4o",
messages=[{"role": "user", "content": "Hello!"}]
)
Package Aliases
This SDK is available under two package names on PyPI:
Both packages are identical and maintained together. Choose whichever you prefer.
Links
Changelog
v0.1.0 (2026-01-31)
- Initial release
- Image generation (generate, edit, variations)
- Video generation with async polling
- Music generation with async polling
- Chat completions with streaming
- Async client support
- Full type hints with Pydantic models
License
MIT
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 xeno_ai-0.1.1.tar.gz.
File metadata
- Download URL: xeno_ai-0.1.1.tar.gz
- Upload date:
- Size: 13.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4e646d6e9ed747ec05eaba5a0595a0b3d734fc177b8ad4a01f4c244fb354f949
|
|
| MD5 |
3089ecfef1c28c4d9e52717ae2b0279c
|
|
| BLAKE2b-256 |
39615e2ae8e3f1b54ba389cdf942aa29fbeba3a3004b7caf294b1e835980fb8c
|
File details
Details for the file xeno_ai-0.1.1-py3-none-any.whl.
File metadata
- Download URL: xeno_ai-0.1.1-py3-none-any.whl
- Upload date:
- Size: 15.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
94a70a8ffc87e9f30eee18697e27b439188b21001e66732bc4d83dd39b764b47
|
|
| MD5 |
e4c90bedb2b0f4cbbab84fc8173c3e5a
|
|
| BLAKE2b-256 |
c0c7ce89eb8eb148eb4b7e88cd287bbca255fc69d47cfec9b453fe3c7196aecd
|