Official Python SDK for the Xysera API
Project description
xysera
Official Python SDK for the Xysera API.
Installation
pip install xysera
Requires Python 3.10+ and installs httpx automatically.
Quick start
import xysera
client = xysera.Client("xys_your_api_key_here")
result = client.upscale("https://example.com/video.mp4")
print(result.result_url) # download before it expires (1 hour)
print(result.credits_charged) # credits deducted for this job
Endpoints
Upscale a video or image
result = client.upscale(
"https://example.com/video.mp4",
scale=4, # 2 or 4 (default 4)
model="RealESRGAN_x4plus", # see models below
quality="balanced",
input_duration_seconds=120.5, # optional — used for preflight credit estimate
)
print(result.job_id)
print(result.result_url) # pre-signed URL, valid for 1 hour
print(result.width)
print(result.height)
print(result.size_bytes)
print(result.credits_charged)
print(result.processing_time)
print(result.cold_start_time)
print(result.inference_time)
print(result.status) # "complete"
print(result.hit_cold_start) # True if the worker cold-started (cold_start_time > 0)
Available models
| Model | Best for |
|---|---|
RealESRGAN_x4plus (default) |
General photos and video |
RealESRGAN_x2plus |
2× upscaling |
realesr-animevideov3 |
Anime / animation |
Note:
result_urlis a pre-signed download URL that expires 1 hour after the job completes. Download the file promptly — callingget_joblater will return the same URL, but it may have expired.
Cold starts: When a model worker hasn't been used recently it may need to cold-start before your job runs.
result.hit_cold_startisTruewhen this happened. Cold starts are reflected incold_start_time(seconds) and are included inprocessing_time.
The upscale endpoint is synchronous — it holds the connection open until the job completes (up to 16 minutes). The SDK sets a 960-second timeout automatically.
Check credits
credits = client.get_credits()
print(credits.credits_balance) # float
print(credits.key_label) # str | None — human-readable label for the key
Retrieve a job
job = client.get_job("job_abc123")
print(job.job_id)
print(job.status) # "complete" or "failed"
print(job.result_url) # None if failed
print(job.credits_charged) # None if failed
Async usage
import asyncio
import xysera
async def main():
async with xysera.AsyncClient("xys_your_api_key_here") as client:
result = await client.upscale("https://example.com/video.mp4", scale=4)
print(result.result_url)
credits = await client.get_credits()
print(credits.credits_balance)
job = await client.get_job(result.job_id)
print(job.status)
asyncio.run(main())
Error handling
import xysera
client = xysera.Client("xys_your_api_key_here")
try:
result = client.upscale("https://example.com/video.mp4")
except xysera.AuthenticationError:
print("Invalid or missing API key.")
except xysera.InsufficientCreditsError:
print("Not enough credits — top up your account.")
except xysera.ValidationError as e:
print(f"Bad request: {e}")
except xysera.RateLimitError:
print("Rate limit hit — slow down requests.")
except xysera.JobFailedError:
print("Processing failed on the server. No credits were charged.")
except xysera.ModelUnavailableError:
print("The requested model is not yet deployed.")
except xysera.XyseraError as e:
print(f"Unexpected API error (HTTP {e.status_code}): {e}")
All exceptions inherit from xysera.XyseraError and expose a status_code attribute with the HTTP status code returned by the API.
| Exception | HTTP status | Description |
|---|---|---|
AuthenticationError |
401 | Invalid or missing API key |
InsufficientCreditsError |
402 | Account has insufficient credits |
ValidationError |
422 | Invalid request parameters |
RateLimitError |
429 | Too many requests |
JobFailedError |
502 | Upstream processing failed; no credits charged |
ModelUnavailableError |
503 | Model not yet deployed |
Rate limits
| Endpoint | Limit |
|---|---|
POST /upscale |
5 req / min |
GET /credits |
60 req / min |
GET /jobs/{job_id} |
60 req / min |
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 xysera-0.1.0.tar.gz.
File metadata
- Download URL: xysera-0.1.0.tar.gz
- Upload date:
- Size: 5.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
845eade186663793c6663994ab7f9d7f70314073fb1b5c41d31e0ed1508b9127
|
|
| MD5 |
d629affa12d5d0ab8ae51eb24639b991
|
|
| BLAKE2b-256 |
95f672e5f81a8623e29f594638577bc0bd4e2537664fe78a8ad7d0f399572959
|
File details
Details for the file xysera-0.1.0-py3-none-any.whl.
File metadata
- Download URL: xysera-0.1.0-py3-none-any.whl
- Upload date:
- Size: 6.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4f1fa50f885174f02ab2a6f8e38c8878d5989f93f8a523a198ee46fd21bb0ecc
|
|
| MD5 |
78e731ce094d38d988d1e8dcb4db9c49
|
|
| BLAKE2b-256 |
9318a1b94040d2fc80976c7580b396cf66e0d7aa170512dac5c038f03de051a5
|