heroshots/sdk 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

heroshots/sdk

Composer 安装命令:

composer require heroshots/sdk

包简介

Official PHP SDK for the HeroShots / StudioHero platform (JWT auth).

README 文档

README

High-level PHP client for the HeroShots / StudioHero platform, authenticated with a portal JWT. PSR-4 namespace HeroShots\.

Scope: image generation (incl. still-life), short video, long video, still-life video, the full Studio Hero storyboard flow, avatar listing & generation, and account balance. See GUIDE.md for use-case walkthroughs.

Install

composer require heroshots/sdk

Requires PHP 8.1+. Runtime dependency: guzzlehttp/guzzle.

Authenticate

use HeroShots\Client;

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

// Or reuse an existing token.
$client = new Client(token: 'eyJ...');

Usage

// Local file paths are auto-uploaded to hosted URLs.
$briefs = $client->storyboard->briefSuggestions('product.jpg', 'model.jpg', [
    'duration_seconds' => 30, 'language_code' => 'it',
]);

$candidates = $client->storyboard->candidates($briefs[0], 30, 'product.jpg', 'model.jpg');

$job = $client->storyboard->generate($briefs[0], 30, $candidates[0], 'product.jpg', 'model.jpg');
$sb  = $client->storyboard->wait($job['job_id']);          // polls until done/failed

$vjob  = $client->longvideo->start('product.jpg', null, $sb['storyboard']);
$final = $client->longvideo->wait($vjob['job_id']);
echo $final['final_video_url'];

Extra backend fields go in the trailing $payload/$fields array argument and are forwarded verbatim. /api/v1 billing metadata is under $result['_meta'].

Resources

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

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

Errors

use HeroShots\Errors\ValidationException;

try {
    $client->storyboard->candidates('', 30, 'p.jpg');
} catch (ValidationException $e) {
    echo $e->errorCode . ': ' . $e->getMessage();
}

All errors extend HeroShots\Errors\ApiException (->errorCode, ->status, ->details).

Test

composer install
composer test       # PHPUnit, offline (Guzzle MockHandler)

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.php.

统计信息

  • 总下载量: 0
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-07-10

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固