Skip to main content

Official Python SDK for the HeroShots / StudioHero platform (JWT/API key auth).

Project description

heroshots (Python SDK)

High-level Python client for the HeroShots / StudioHero platform, authenticated with a portal JWT or API key. Covers the full JWT/API-key reachable API surface.

Install

pip install heroshots          # from a registry
pip install -e ".[dev]"        # local dev (runs the test suite)

Requires Python 3.9+. Only runtime dependency: requests.

Authenticate

from heroshots import Client

# Email/password login (recommended): stores the JWT, auto re-logins on expiry.
# Base URL defaults to https://app.heroshots.ai.
client = Client.from_login("dev@partner.com", "secret")

# Or reuse an existing token.
client = Client(token="eyJ...")

Agency act-as

Agency API keys can operate as a managed brand by passing the managed_user_id returned by the managed-client provisioning API. The SDK adds X-Managed-User-Id to authenticated requests.

from heroshots import Client

client = Client(token="lz_live_YOUR_AGENCY_KEY", managed_user_id=12345)
job = client.images.generate(product_image_url="https://example.com/product.jpg")

# Switch target brand later, or pass None to clear it.
client.with_managed_user(67890)

Usage

# Local file paths are auto-uploaded to hosted URLs.
briefs = client.storyboard.brief_suggestions(
    product_image_url="product.jpg", subject_image_url="model.jpg",
    duration_seconds=30, language_code="it",
)

candidates = client.storyboard.candidates(
    custom_prompt=briefs[0], duration_seconds=30,
    product_image_url="product.jpg", subject_image_url="model.jpg",
)

job = client.storyboard.generate(
    custom_prompt=briefs[0], duration_seconds=30, selected_candidate=candidates[0],
    product_image_url="product.jpg", subject_image_url="model.jpg",
)
sb = client.storyboard.wait(job["job_id"])           # polls until done/failed

vjob = client.longvideo.start(image_url="product.jpg", storyboard=sb["storyboard"])
final = client.longvideo.wait(vjob["job_id"])
print(final["final_video_url"])                       # also: final.final_video_url

Responses support both result["key"] and result.key access. /api/v1 billing metadata is under result["_meta"].

Guide

For step-by-step examples organized by use case, read the full guide: GUIDE.md.

Resources

uploads · images · videos · longvideo · stilllife · storyboard · avatars

Plus on the client: login(), me(), balance(), stats().

Every method maps 1:1 to an endpoint; pass extra backend fields as keyword arguments (they are forwarded verbatim).

Errors

from heroshots import ValidationError, TokenExpiredError, RateLimitError

try:
    client.storyboard.candidates(custom_prompt="", duration_seconds=30,
                                 product_image_url="p.jpg")
except ValidationError as e:
    print(e.code, e.message, e.details)

Test

pytest          # offline, mocked HTTP

Billing

Generations cost credits. Check remaining credits with client.balance() (hs_credits + wallet_balance). Use client.stats() for the full raw /api/auth/stats payload, including recent generations and offered plans. See examples/full_storyboard_flow.py.

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

heroshots-0.2.5.tar.gz (16.3 kB view details)

Uploaded Source

Built Distribution

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

heroshots-0.2.5-py3-none-any.whl (18.1 kB view details)

Uploaded Python 3

File details

Details for the file heroshots-0.2.5.tar.gz.

File metadata

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

File hashes

Hashes for heroshots-0.2.5.tar.gz
Algorithm Hash digest
SHA256 bf7c5f5b45861a5159329adf570ae9d1961096127e81dacfc6fbd6e7180b21b6
MD5 63dc3382dec3d0139a6633e157e0df11
BLAKE2b-256 d419baf9c516d14596425b31071c0df6dc8b557b5c8d6bdf6e0dad7856c14262

See more details on using hashes here.

Provenance

The following attestation bundles were made for heroshots-0.2.5.tar.gz:

Publisher: publish.yml on JasonPriore/HeroShotsSDK-Python

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

File details

Details for the file heroshots-0.2.5-py3-none-any.whl.

File metadata

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

File hashes

Hashes for heroshots-0.2.5-py3-none-any.whl
Algorithm Hash digest
SHA256 f9adeca3cfe5bd5cda06e093a4d1d2016b61a828261f2c35cf5a78b972dc34b4
MD5 30df0aaad05ad8c8ed1788e7bd8f7b02
BLAKE2b-256 d3648703a3444743576c2a33c54392be8f16de1f03f1105fab9c473abfa27192

See more details on using hashes here.

Provenance

The following attestation bundles were made for heroshots-0.2.5-py3-none-any.whl:

Publisher: publish.yml on JasonPriore/HeroShotsSDK-Python

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