接口文档 服务鉴权 服务接口调用时需要严格遵循服务鉴权规则,服务调用鉴权规则请参见:开发指南 接口签名认证。 请求示例 plaintext { "seqid": "test001", "taskid": 1, "imagetype": 0, "image": [" "prompt": "一只猫在奔跑", "resolution": [720, 720], "returnmode": 0, "extramessage": [ { "key": "videoseed", "value": "42" }, { "key": "negativeprompt", "value": "模糊,低质量" }, { "key": "enablepromptenhance", "value": true } ], "callbackurl": " } 响应结果示例 plaintext { "seqid": "test001", "sendptsms": 1694280000000, "code": 10000, "message": "success", "taskid": 1, "flag": "success", "data": { "status": 0, "taskresult": { "outimage": "", "outvideo": "", "outtext": "" } } } 调用示例 Java调用示例 plaintext import cn.hutool.http.HttpRequest; import cn.hutool.http.HttpResponse; import cn.hutool.json.JSONUtil; import java.util.Arrays; import java.util.HashMap; import java.util.Map; / 主类,用于发起HTTP请求并处理响应 / public class Example { public static void main(String[] args) { example(); } / 方法中使用到的 JSONUtil、HttpRequest、HttpResponse均来自Hutool工具类。 具体maven依赖为: cn.hutool hutoolall 5.8.29 / public static void example() { try { String url "算法调用地址"; // 设置请求头 Map headers new HashMap<>(); //调用鉴权 headers.put("ContentType", "application/json"); headers.put("XAPPID", "yourAppId"); headers.put("Authorization", "yourAuthorization"); // 创建请求对象 Map request new HashMap<>(); request.put("seqid", "test001"); request.put("taskid", 30004); request.put("image", Arrays.asList("yourImageUrl")); request.put("prompt", "she is dancing in the sun"); request.put("callbackurl", " // 将请求对象转换为JsonNode String requestString JSONUtil.toJsonStr(request); // 发起HTTP请求 HttpResponse response HttpRequest.post(url) .headerMap(headers, true) .body(requestString) .execute(); // 输出响应结果 System.out.println(response.body()); } catch (Exception e) { e.printStackTrace(); } } }