这是一个用于调用 RunPod API 的 Hyperf 组件,支持常用 Serverless 接口,如异步作业提交、状态查询、取消任务等。
run:异步提交作业并返回作业 IDrunsync:同步执行作业并直接返回结果status:查询作业状态及输出stream:读取流式增量结果cancel:取消进行中的作业retry:重试失败或超时的作业purge-queue:清空队列中的作业health:检查运行状态
composer require zzhenping/runpod-clientphp bin/hyperf.php vendor:publish zzhenping/runpod-clientuse 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'), // 新的连接
];
}
}