zzhenping / runpod-client
A Hyperf component that provides a convenient client for interacting with the RunPod API. This package simplifies serverless GPU workload management, allowing easy deployment and execution of AI/ML tasks on RunPod's cloud infrastructure.
v2
2025-05-12 06:46 UTC
Requires
- php: >=8.1
- hyperf/guzzle: ^3.1
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.0
- hyperf/di: ^3.1
- mockery/mockery: ^1.0
- phpstan/phpstan: ^1.0
- phpunit/phpunit: ^10.0
- swoole/ide-helper: dev-master
Suggests
- swow/swow: Required to create swow components.
This package is auto-updated.
Last update: 2025-06-12 07:24:57 UTC
README
这是一个用于调用 RunPod API 的 Hyperf 组件,支持常用 Serverless 接口,如异步作业提交、状态查询、取消任务等。
✨ 功能特性
run
:异步提交作业并返回作业 IDrunsync
:同步执行作业并直接返回结果status
:查询作业状态及输出stream
:读取流式增量结果cancel
:取消进行中的作业retry
:重试失败或超时的作业purge-queue
:清空队列中的作业health
:检查运行状态
📦 安装
composer require zzhenping/runpod-client
🔧 快速生成配置文件
php bin/hyperf.php vendor:publish zzhenping/runpod-client
🧩 使用示例
use Zzhenping\RunPodClient\Serverless\ServerlessService;
class IndexController extends AbstractController
{
public function __construct(protected ServerlessService $runpod){}
public function index()
{
return [
'health' => $this->runpod->health('bcb5un8ejvlce7'),
'new_health' => $this->runpod->withPool('new_run_pod')->health('m9d0vbz7fzbjum'), // 新的连接
];
}
}