Skip to content

Latest commit

History

19 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

Skyreels Python SDK

This library provides a simple and efficient way to integrate advanced AI video generation into your Python projects.

Key Features

  • Text-to-Video (T2V): Create videos from text prompts, with or without audio.
  • Image-to-Video (I2V): Create video from an image and a text prompt, with or without audio.
  • Sync & Async Support: Full support for both synchronous and asynchronous (asyncio) programming models.
  • Automatic Polling: One-line methods to submit and wait for final video results.
  • 1080P Support: High-definition video generation via pro mode.

Installation

From Source

Install the SDK directly from the repository:

git clone https://github.com/Howe2018/skyreels_api.git
cd skyreels_api
pip install .

Quick Start

1. Set Your API Key

The quickest way to get started is by setting your API key as an environment variable:

export SKYREELS_API_KEY="your_api_key_here"

2. Simple Video Generation (Automatic Polling)

The generate_* methods are high-level helpers that submit a task and automatically poll for the result until completion or until max_wait_time is reached.

2.1 Text-to-Video (T2V) without Audio

fromskyreelsimportSkyreelsClientclient=SkyreelsClient()
task=client.generate_text2video(
prompt="****",
sound=False,
max_wait_time=900, # Max seconds to wait for completion
)
iftask.status=="success":
print(f"Video ready: {task.data.video_url}")
else:
print(f"Task failed: {task}")

2.2 Text-to-Video (T2V) with Audio

fromskyreelsimportSkyreelsClientclient=SkyreelsClient()
task=client.generate_text2video(
prompt="****",
sound=True, # Enable AI-generated synchronized audiomax_wait_time=900,
)
iftask.status=="success":
print(f"Video ready: {task.data.video_url}")
else:
print(f"Task failed: {task}")

2.3 Image-to-Video (I2V) without Audio

fromskyreelsimportSkyreelsClientclient=SkyreelsClient()
task=client.generate_image2video(
prompt="****",
image_url="***", # Must be a public image URLsound=False,
max_wait_time=900,
)
iftask.status=="success":
print(f"Video ready: {task.data.video_url}")
else:
print(f"Task failed: {task}")

2.4 Image-to-Video (I2V) with Audio

fromskyreelsimportSkyreelsClientclient=SkyreelsClient()
task=client.generate_image2video(
prompt="***",
image_url="***", # Must be a public image URLsound=True, # Enable AI-generated synchronized audiomax_wait_time=900,
)
iftask.status=="success":
print(f"Video ready: {task.data.video_url}")
else:
print(f"Task failed: {task}")

Documentation

For a full list of all parameters, manual task management (submit/query), and detailed model schemas, please see our:

👉 Comprehensive API Reference & Guide

Error Handling

The SDK raises specific exceptions based on API error codes. All custom exceptions inherit from SkyreelsError.

CodeExceptionDescription
401InvalidAPIKeyErrorInvalid or missing API key.
422ParameterErrorInvalid parameters (e.g., duration out of range).
429ServiceBusyErrorServer is busy, retry later.
480InsufficientCreditsErrorInsufficient account credits.
481QuotaExceededErrorQPS/Concurrency limit reached.
500InternalErrorInternal server error.
503SecurityPolicyErrorContent blocked by safety policy.
fromskyreelsimportSkyreelsClient, InsufficientCreditsErrorclient=SkyreelsClient()
try:
client.generate_text2video(prompt="...")
exceptInsufficientCreditsError:
print("Please top up your account.")
exceptExceptionase:
print(f"Error: {e}")

License

MIT

About

Client SDK for the Skyreels API

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages