Skip to main content

Python SDK for BytePlus ModelArk APIs, starting with Seedance video generation.

Project description

byteplus-py

A small convenience SDK for BytePlus ModelArk APIs, starting with Seedance video generation. It wraps the official byteplus-python-sdk-v2 Ark runtime and adds fal-style submit, retrieve, wait, and subscribe helpers.

Install

python -m pip install -e ".[dev]"

Configure

Create a .env file:

BYTEPLUS_API_KEY=ark-...

ARK_API_KEY is also supported.

Usage

from byteplus_py import BytePlus
from byteplus_py.seedance import image_url, text

client = BytePlus.from_env()

task = client.seedance.submit(
    model="dreamina-seedance-2-0-fast-260128",
    content=[
        text("A cinematic shot of fruit tea being prepared."),
        image_url(
            "https://ark-doc.tos-ap-southeast-1.bytepluses.com/doc_image/r2v_tea_pic1.jpg",
            role="reference_image",
        ),
    ],
    generate_audio=True,
    ratio="16:9",
    duration=4,
    watermark=False,
)

print(task.id)

For fal-style polling:

result = client.seedance.subscribe(
    model="dreamina-seedance-2-0-fast-260128",
    content=[text("A tiny robot waters a basil plant in morning light.")],
    duration=4,
)

print(result.video_url)

Download a Completed Video

from byteplus_py import BytePlus

client = BytePlus.from_env()
path = client.seedance.download_video("cgt-...", output_dir="downloads")

print(path)

Estimate Video Cost

The Seedance API returns usage.completion_tokens for completed tasks. The SDK can combine that with the video generation rates in docs/byteplus-pricing.md:

task = client.seedance.retrieve("cgt-...")
cost = client.seedance.estimate_cost(task, input_includes_video=True)

print(cost.amount_usd)

Smoke Test

The smoke script submits the multimodal sample from docs/video-api-docs.md and prints only non-secret task data:

python examples/seedance_smoke.py --no-wait

To poll until completion:

python examples/seedance_smoke.py --wait --timeout 900

To wait and download the completed video:

python examples/seedance_smoke.py --wait --download

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

byteplus_py-0.1.0.tar.gz (33.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

byteplus_py-0.1.0-py3-none-any.whl (11.0 kB view details)

Uploaded Python 3

File details

Details for the file byteplus_py-0.1.0.tar.gz.

File metadata

  • Download URL: byteplus_py-0.1.0.tar.gz
  • Upload date:
  • Size: 33.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for byteplus_py-0.1.0.tar.gz
Algorithm Hash digest
SHA256 3ece2d65225719fc736961fd9f33cbd53e4e25e7103bbb3ef9296dbbbe791faf
MD5 28569eb5ac540bf0f06942960cddd674
BLAKE2b-256 895ee5b7f90e6757671100cffd3c4fcada4d69f6d88894a8411db2433b5d4df6

See more details on using hashes here.

Provenance

The following attestation bundles were made for byteplus_py-0.1.0.tar.gz:

Publisher: publish.yml on ZeroSpaceStudios/byteplus-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file byteplus_py-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: byteplus_py-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 11.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for byteplus_py-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 989a01541a9734815ad83e863ff20181b35ce065ddb338f1667d8ce9a149b648
MD5 11d894645934d7178e5ced35993c1b2e
BLAKE2b-256 665dd5cc71131187859b1783304e9493dfd59eb5508d8e0b2a89e618bc985b95

See more details on using hashes here.

Provenance

The following attestation bundles were made for byteplus_py-0.1.0-py3-none-any.whl:

Publisher: publish.yml on ZeroSpaceStudios/byteplus-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page