You need to enable JavaScript to run this app.
导航
附加组件 2.0
最近更新时间:2025.11.06 16:14:05首次发布时间:2025.03.31 22:50:52
复制全文
我的收藏
有用
有用
无用
无用

阅读本文,您可以获取 PHP SDK 附加组件 2.0(即 AIGC 大模型超分辨率、智能图像扩展、图像超分辨率(云端)、电商万创、AIGC 图片翻译以及大模型画质评估组件)的接口调用示例,实现快速开发。

说明

本文的调用示例包含接口的部分参数。由于参数间可能存在互斥关系,在调用时,请您参考注释,进行调整。

调用说明

  • 本文提供的接口调用示例均通过 AK 和 SK 初始化实例。
  • 接口的参数说明和错误码等信息可通过接口文档查看。

前提条件

调用接口前,请先完成 PHP SDK 的安装及初始化操作。

调用示例

本节为您介绍附加组件 2.0(即 AIGC 大模型超分辨率、智能图像扩展、图像超分辨率(云端)、电商万创、AIGC 图片翻译以及大模型画质评估组件)相关接口的功能和调用示例。

AI 图像处理(同步)

您可以调用 AIProcess 接口执行同步 AI 图像处理任务。详细的参数说明可参见 AIProcess 接口文档。
接口调用示例如下所示。

<?php
include_once(__DIR__ . '/../../../../vendor/autoload.php');

use Volc\Service\ImageX\V2\Imagex;

$client = Imagex::getInstance();

// call below method if you dont set ak and sk in ~/.volc/config
$client->setAccessKey("ak");
$client->setSecretKey("sk");

$query = [];

$body = [];

$response = $client->aIProcess($query, $body);
print_r($response);

创建 AI 图像处理任务(异步)

您可以调用 CreateImageAITask 接口执行异步 AI 图像处理任务。详细的参数说明可参见 CreateImageAITask 接口文档。
接口调用示例如下所示。

<?php
include_once(__DIR__ . '/../../../../vendor/autoload.php');

use Volc\Service\ImageX\V2\Imagex;

$client = Imagex::getInstance();

// call below method if you dont set ak and sk in ~/.volc/config
$client->setAccessKey("ak");
$client->setSecretKey("sk");

$query = [];

$body = [];

$response = $client->createImageAITask($query, $body);
print_r($response);

获取 AI 图像处理任务信息

发起异步任务后,您可以调用 GetImageAITasks 接口获取 AI 图像处理任务信息。详细的参数说明可参见 GetImageAITasks 接口文档。
接口调用示例如下所示。

<?php
include_once(__DIR__ . '/../../../../vendor/autoload.php');

use Volc\Service\ImageX\V2\Imagex;

$client = Imagex::getInstance();

// call below method if you dont set ak and sk in ~/.volc/config
$client->setAccessKey("ak");
$client->setSecretKey("sk");

$query = [];

$response = $client->getImageAITasks($query);
print_r($response);

获取 AI 图像处理任务执行详情

发起异步任务后,您可以调用 GetImageAIDetails 接口获取 AI 图像处理任务信息。详细的参数说明可参见 GetImageAIDetails 接口文档。
接口调用示例如下所示。

<?php
include_once(__DIR__ . '/../../../../vendor/autoload.php');

use Volc\Service\ImageX\V2\Imagex;

$client = Imagex::getInstance();

// call below method if you dont set ak and sk in ~/.volc/config
$client->setAccessKey("ak");
$client->setSecretKey("sk");

$query = [];

$response = $client->getImageAIDetails($query);
print_r($response);