Python SDK for APIYi image & video APIs (GPT-Image-2, Nano Banana, VEO 3.1, Seedance 2.0, icover asset library)
Project description
apiyi-sdk
Python SDK for APIYi image & video generation APIs.
Supported APIs
Images
| Resource | Model | Text-to-image | Image edit |
|---|---|---|---|
client.gpt_image_all |
gpt-image-2-all |
✅ | ✅ |
client.gpt_image_vip |
gpt-image-2-vip |
✅ | ✅ |
client.nano_banana_2 |
gemini-3.1-flash-image-preview |
✅ | ✅ |
client.nano_banana_lite |
gemini-3.1-flash-lite-image |
✅ | ✅ |
Videos
| Resource | Capabilities |
|---|---|
client.veo |
VEO 3.1 文生视频 / 图生视频(异步:创建 → 轮询 → 下载) |
client.seedance2 |
Seedance 2.0 文生视频 / 首尾帧 / 多模态参考 |
client.asset_library |
icover 素材库(上传 → 入库 → asset:// ID) |
client.asset_reference |
端到端:本地图片入库 + 素材引用生视频 |
Install
# 本地开发
pip install -e "./apiyi_sdk[dev]"
# PyPI(发布后)
pip install apiyi-sdk
# Git
pip install "apiyi-sdk @ git+https://github.com/suix-maker/apiyi_sdk.git@v0.2.0"
Quick start
import os
from apiyi_sdk import ApiyiClient, ImageInput
client = ApiyiClient(
api_key=os.environ["APIYI_API_KEY"],
seedance_api_key=os.environ.get("APIYI_SEEDANCE2_API_KEY"),
asset_library_api_key=os.environ.get("ICOVER_ASSET_LIBRARY_KEY"),
)
# VEO 文生视频(seconds 必须是字符串 "4" / "6" / "8")
task = client.veo.create_text_to_video(
"黄昏海边的灯塔,镜头缓慢推进,海浪声",
seconds="8",
resolution="720p",
)
task = client.veo.wait_for_completion(task.task_id)
mp4_bytes = client.veo.download_content(task.task_id)
# VEO 图生视频(multipart,字段 input_reference,仅 1 张图)
task = client.veo.create_image_to_video(
"镜头从灯塔基座缓慢上升",
ImageInput.from_path("lighthouse.png"),
seconds="8",
)
# Seedance 2.0 文生视频
result = client.seedance2.generate_text_to_video(
"海浪拍打礁石,夕阳金色海面",
duration=5,
generate_audio=False,
)
# 素材引用全流程(需素材库 KEY + SeeDance2 KEY)
result = client.require_asset_reference().run(
"portrait.jpg",
"图片1中的人物正面微笑,镜头缓慢推近,自然光",
)
print(result.video.video_url)
API Keys
SDK 不包含任何密钥,运行时由调用方传入。
| 用途 | 参数 | 环境变量 | 说明 |
|---|---|---|---|
| 生图 / VEO | api_key |
APIYI_API_KEY |
API易控制台令牌 |
| Seedance 2.0 | seedance_api_key |
APIYI_SEEDANCE2_API_KEY |
须勾选 SeeDance2 分组;未传则回退 api_key |
| 素材库 | asset_library_api_key |
ICOVER_ASSET_LIBRARY_KEY |
icover.ai「设置 → 素材库 KEY」,独立 sk,不可与 SeeDance2 混用 |
未配置 asset_library_api_key 时,client.asset_library 与 client.asset_reference 为 None。
Development
cd apiyi_sdk
pip install -e ".[dev]"
pytest
python -m build
Publish
python -m build
twine upload --repository testpypi dist/* # 先试装
twine upload dist/* # 正式 PyPI
Docs
License
MIT — see LICENSE.
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
apiyi_sdk-0.2.0.tar.gz
(21.1 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
apiyi_sdk-0.2.0-py3-none-any.whl
(25.7 kB
view details)
File details
Details for the file apiyi_sdk-0.2.0.tar.gz.
File metadata
- Download URL: apiyi_sdk-0.2.0.tar.gz
- Upload date:
- Size: 21.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fb7ecdec794f12ce645c3f134375f7ed80db1fb2b11fd6c6ba077901b5eb4764
|
|
| MD5 |
05d04c2709828a54b15768716a909678
|
|
| BLAKE2b-256 |
091afdd91c621ab769c86e9935a412abf0a5cffda7b833e752ff3421cb7f086d
|
File details
Details for the file apiyi_sdk-0.2.0-py3-none-any.whl.
File metadata
- Download URL: apiyi_sdk-0.2.0-py3-none-any.whl
- Upload date:
- Size: 25.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
024061515b40a6c731976ca0887409764d48aac46926bb35681d1d3c63cf6a95
|
|
| MD5 |
e3cdf5833f884b2fd6f91ff7120d837b
|
|
| BLAKE2b-256 |
7a929db319f12308dd2caecc4ca5b733925825093dc2a656ea86dec42e9471e3
|