注册

腾讯混元图像创建接口 - AI 图像生成 - QuickRouter API 中转接口

POST https://api.quickrouter.ai/tencent-vod/v1/aigc-image 在线调试 →
Authorization

在 Header 添加参数 Authorization,其值为 Bearer 之后拼接 Token

示例: Authorization: Bearer ********************

概述

官方文档:https://cloud.tencent.com/document/product/266/126240

请求参数

Header 参数
Authorization string
可选
示例: Bearer {{YOUR_API_KEY}} Content-Type
string
可选
示例: application/json
Body 参数 application/json
model_name string
必需
模型名称。取值: GEM:Gemini; Qwen:千问。 Hunyuan:混元。 示例值:GEM
model_version string
必需
模型版本。取值: 当 ModelName 是 GEM,可选值为 2.5、3.0; 当 ModelName 是 Qwen,可选值为 0925; 当 ModelName 是 Hunyuan,可选值为 3.0; 示例值:2.5
prompt string
可选
提示词 必需
file_infos array [object]
可选
type string
可选
输入的视频文件类型。取值有: File:点播媒体文件; Url:可访问的 URL; 示例值:File
file_id string
可选
图片文件的媒体文件 ID,即该文件在云点播上的全局唯一标识符,在上传成功后由云点播后台分配。可以在 视频上传完成事件通知 或 云点播控制台 获取该字段。当 Type 取值为 File 时,本参数有效。 说明: 1. 推荐使用小于7M的图片; 2. 图片格式的取值为:jpeg,jpg, png, webp。 示例值:3704211***509819
url string
可选
可访问的文件 URL。当 Type 取值为 Url 时,本参数有效。 说明: 1. 推荐使用小于7M的图片; 2. 图片格式的取值为:jpeg,jpg, png, webp。 示例值:https://test.com/1.png
text string
可选
输入图片的描述信息,用于帮助模型理解图片。仅GEM 2.5、GEM 3.0 有效。 示例值:任务背景:这是需要翻新的主建筑(图1),不得改变其几何结构。
negative_prompt string
可选
要阻止模型生成图片的提示词。
enhance_prompt string
可选
是否自动优化提示词。开启时将自动优化传入的 Prompt,以提升生成质量。取值有: Enabled:开启; Disabled:关闭;
output_config object
可选
生图任务的输出媒体文件配置。
storage_mode string
可选
存储模式。取值有: Permanent:永久存储,生成的图片文件将存储到云点播,可在事件通知中获取到 FileId; Temporary:临时存储,生成的图片文件不会存储到云点播,可在事件通知中获取到临时访问的 URL; 默认值:Temporary
resolution string
可选
生成图片的分辨率。可选值为 720P、1080P、2K、4K、1024x1024、2048x2048、2304x1728、2496x1664、2560x1440、3024x1296、4096x4096、4694x3520、4992x3328、5404x3040、6198x2656,其中使用模型 Jimeng 时,推荐通过 Prompt 指定图片分辨率和宽高比。 示例值:1024x1024
aspect_ratio string
可选
指定所生成图片的宽高比。 当 ModelName 是 GEM,可选值是 1:1、3:2、2:3、3:4、4:3、4:5、5:4、9:16、16:9 和 21:9; 当 ModelName 是 Qwen、Jimeng,则暂不支持,其中 Jimeng 会结合 Prompt意图、参考图片尺寸,由模型智能判断输出图片的宽高比。 示例值:16:9
person_generation string
可选
是否允许人物或人脸生成。取值有: AllowAdult:允许生成成人; Disallowed:禁止在图片中包含人物或人脸; 示例值:AllowAdult
input_compliance_check string
可选
是否开启输入内容的合规性检查。取值有: Enabled:开启; Disabled:关闭; 示例值:Enabled
output_compliance_check string
可选
是否开启输出内容的合规性检查。取值有: Enabled:开启; Disabled:关闭; 示例值:Enabled
session_id string
可选
用于去重的识别码,如果三天内曾有过相同的识别码的请求,则本次的请求会返回错误。最长 50 个字符,不带或者带空字符串表示不做去重。 示例值:mysession
session_context string
可选
来源上下文,用于透传用户请求信息,音画质重生完成回调将返回该字段值,最长 1000 个字符。 示例值:mySessionContext
tasks_priority string
可选
任务的优先级,数值越大优先级越高,取值范围是 -10 到 10,不填代表 0。 示例值:10
ext_info string
可选
保留字段,特殊用途时使用。 示例值:myextinfo { "model_name": "GEM", "model_version": "3.0", "file_infos": [ { "type": "file", "file_id": "387702299774574677", "url": "", "text": "原始图片的描述信息" } ], "prompt": "convert this image to anime style", "negative_prompt": "blur, distorted", "enhance_prompt": "Enabled", "output_config": { "storage_mode": "Temporary", "resolution": "1080P", "aspect_ratio": "1:1", "person_generation": "AllowAdult", "input_compliance_check": "Enabled", "output_compliance_check": "Enabled" }, "session_id": "image-task-67890", "session_context": "{\"user_id\": \"123\", \"scene\": \"profile_picture\"}", "tasks_priority": 10, "ext_info": "" } 请求
示例
{
    "model_name": "GEM",
    "model_version": "3.0",
    "file_infos": [
        {
            "type": "file",
            "file_id": "387702299774574677",
            "url": "",
            "text": "原始图片的描述信息"
        }
    ],
    "prompt": "convert this image to anime style",
    "negative_prompt": "blur, distorted",
    "enhance_prompt": "Enabled",
    "output_config": {
        "storage_mode": "Temporary",
        "resolution": "1080P",
        "aspect_ratio": "1:1",
        "person_generation": "AllowAdult",
        "input_compliance_check": "Enabled",
        "output_compliance_check": "Enabled"
    },
    "session_id": "image-task-67890",
    "session_context": "{\"user_id\": \"123\", \"scene\": \"profile_picture\"}",
    "tasks_priority": 10,
    "ext_info": ""
}

请求示例代码

curl --location --request POST 'https://api.quickrouter.ai/tencent-vod/v1/aigc-image' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data-raw '{
    "model_name": "GEM",
    "model_version": "3.0",
    "file_infos": [
        {
            "type": "file",
            "file_id": "387702299774574677",
            "url": "",
            "text": "原始图片的描述信息"
        }
    ],
    "prompt": "convert this image to anime style",
    "negative_prompt": "blur, distorted",
    "enhance_prompt": "Enabled",
    "output_config": {
        "storage_mode": "Temporary",
        "resolution": "1080P",
        "aspect_ratio": "1:1",
        "person_generation": "AllowAdult",
        "input_compliance_check": "Enabled",
        "output_compliance_check": "Enabled"
    },
    "session_id": "image-task-67890",
    "session_context": "{\"user_id\": \"123\", \"scene\": \"profile_picture\"}",
    "tasks_priority": 10,
    "ext_info": ""
}'
var myHeaders = new Headers();
myHeaders.append("Accept", "application/json");
myHeaders.append("Authorization", "Bearer YOUR_API_KEY");
myHeaders.append("Content-Type", "application/json");

var raw = JSON.stringify({
    "model_name": "GEM",
    "model_version": "3.0",
    "file_infos": [
        {
            "type": "file",
            "file_id": "387702299774574677",
            "url": "",
            "text": "原始图片的描述信息"
        }
    ],
    "prompt": "convert this image to anime style",
    "negative_prompt": "blur, distorted",
    "enhance_prompt": "Enabled",
    "output_config": {
        "storage_mode": "Temporary",
        "resolution": "1080P",
        "aspect_ratio": "1:1",
        "person_generation": "AllowAdult",
        "input_compliance_check": "Enabled",
        "output_compliance_check": "Enabled"
    },
    "session_id": "image-task-67890",
    "session_context": "{\"user_id\": \"123\", \"scene\": \"profile_picture\"}",
    "tasks_priority": 10,
    "ext_info": ""
});

var requestOptions = {
   method: 'POST',
   headers: myHeaders,
   body: raw,
   redirect: 'follow'
};

fetch("https://api.quickrouter.ai/tencent-vod/v1/aigc-image", requestOptions)
   .then(response => response.text())
   .then(result => console.log(result))
   .catch(error => console.log('error', error));
import java.io.*;
import java.net.*;
import java.util.*;

URL url = new URL("https://api.quickrouter.ai/tencent-vod/v1/aigc-image");
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("POST");
conn.setRequestProperty("Accept", "application/json");
conn.setRequestProperty("Authorization", "Bearer YOUR_API_KEY");
conn.setRequestProperty("Content-Type", "application/json");
conn.setDoOutput(true);
String jsonInputString = "{
    \"model_name\": \"GEM\",
    \"model_version\": \"3.0\",
    \"file_infos\": [
        {
            \"type\": \"file\",
            \"file_id\": \"387702299774574677\",
            \"url\": \"\",
            \"text\": \"原始图片的描述信息\"
        }
    ],
    \"prompt\": \"convert this image to anime style\",
    \"negative_prompt\": \"blur, distorted\",
    \"enhance_prompt\": \"Enabled\",
    \"output_config\": {
        \"storage_mode\": \"Temporary\",
        \"resolution\": \"1080P\",
        \"aspect_ratio\": \"1:1\",
        \"person_generation\": \"AllowAdult\",
        \"input_compliance_check\": \"Enabled\",
        \"output_compliance_check\": \"Enabled\"
    },
    \"session_id\": \"image-task-67890\",
    \"session_context\": \"{\\"user_id\\": \\"123\\", \\"scene\\": \\"profile_picture\\"}\",
    \"tasks_priority\": 10,
    \"ext_info\": \"\"
}";
try(OutputStream os = conn.getOutputStream()) {
    byte[] input = jsonInputString.getBytes("utf-8");
    os.write(input, 0, input.length);
}
int responseCode = conn.getResponseCode();
System.out.println("Response Code: " + responseCode);
import Foundation

let urlString = "https://api.quickrouter.ai/tencent-vod/v1/aigc-image"
guard let url = URL(string: urlString) else { return }
var request = URLRequest(url: url)
request.httpMethod = "POST"
request.addValue("application/json", forHTTPHeaderField: "Accept")
request.addValue("Bearer YOUR_API_KEY", forHTTPHeaderField: "Authorization")
request.addValue("application/json", forHTTPHeaderField: "Content-Type")
let httpBody = "{
    \"model_name\": \"GEM\",
    \"model_version\": \"3.0\",
    \"file_infos\": [
        {
            \"type\": \"file\",
            \"file_id\": \"387702299774574677\",
            \"url\": \"\",
            \"text\": \"原始图片的描述信息\"
        }
    ],
    \"prompt\": \"convert this image to anime style\",
    \"negative_prompt\": \"blur, distorted\",
    \"enhance_prompt\": \"Enabled\",
    \"output_config\": {
        \"storage_mode\": \"Temporary\",
        \"resolution\": \"1080P\",
        \"aspect_ratio\": \"1:1\",
        \"person_generation\": \"AllowAdult\",
        \"input_compliance_check\": \"Enabled\",
        \"output_compliance_check\": \"Enabled\"
    },
    \"session_id\": \"image-task-67890\",
    \"session_context\": \"{\\"user_id\\": \\"123\\", \\"scene\\": \\"profile_picture\\"}\",
    \"tasks_priority\": 10,
    \"ext_info\": \"\"
}"
request.httpBody = httpBody.data(using: .utf8)

let task = URLSession.shared.dataTask(with: request) { data, response, error in
    if let data = data {
        print(String(data: data, encoding: .utf8)!)
    }
}
task.resume()
package main

import (
    "fmt"
    "io"
    "net/http"
)

func main() {
    body := strings.NewReader(`{
    "model_name": "GEM",
    "model_version": "3.0",
    "file_infos": [
        {
            "type": "file",
            "file_id": "387702299774574677",
            "url": "",
            "text": "原始图片的描述信息"
        }
    ],
    "prompt": "convert this image to anime style",
    "negative_prompt": "blur, distorted",
    "enhance_prompt": "Enabled",
    "output_config": {
        "storage_mode": "Temporary",
        "resolution": "1080P",
        "aspect_ratio": "1:1",
        "person_generation": "AllowAdult",
        "input_compliance_check": "Enabled",
        "output_compliance_check": "Enabled"
    },
    "session_id": "image-task-67890",
    "session_context": "{\"user_id\": \"123\", \"scene\": \"profile_picture\"}",
    "tasks_priority": 10,
    "ext_info": ""
}`)
    req, _ := http.NewRequest("POST", "https://api.quickrouter.ai/tencent-vod/v1/aigc-image", body)
    req.Header.Set("Accept", "application/json")
    req.Header.Set("Authorization", "Bearer YOUR_API_KEY")
    req.Header.Set("Content-Type", "application/json")
    client := &http.Client{}
    resp, _ := client.Do(req)
    defer resp.Body.Close()
    bodyBytes, _ := io.ReadAll(resp.Body)
    fmt.Println(string(bodyBytes))
}
<?php

$curl = curl_init();
curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://api.quickrouter.ai/tencent-vod/v1/aigc-image',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS => '{
    "model_name": "GEM",
    "model_version": "3.0",
    "file_infos": [
        {
            "type": "file",
            "file_id": "387702299774574677",
            "url": "",
            "text": "原始图片的描述信息"
        }
    ],
    "prompt": "convert this image to anime style",
    "negative_prompt": "blur, distorted",
    "enhance_prompt": "Enabled",
    "output_config": {
        "storage_mode": "Temporary",
        "resolution": "1080P",
        "aspect_ratio": "1:1",
        "person_generation": "AllowAdult",
        "input_compliance_check": "Enabled",
        "output_compliance_check": "Enabled"
    },
    "session_id": "image-task-67890",
    "session_context": "{\"user_id\": \"123\", \"scene\": \"profile_picture\"}",
    "tasks_priority": 10,
    "ext_info": ""
}',
  CURLOPT_HTTPHEADER => array(
    "Accept: application/json",
    "Authorization: Bearer YOUR_API_KEY",
    "Content-Type: application/json",
  ),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import http.client
import json

conn = http.client.HTTPSConnection("api.quickrouter.ai")
payload = json.dumps({
    "model_name": "GEM",
    "model_version": "3.0",
    "file_infos": [
        {
            "type": "file",
            "file_id": "387702299774574677",
            "url": "",
            "text": "原始图片的描述信息"
        }
    ],
    "prompt": "convert this image to anime style",
    "negative_prompt": "blur, distorted",
    "enhance_prompt": "Enabled",
    "output_config": {
        "storage_mode": "Temporary",
        "resolution": "1080P",
        "aspect_ratio": "1:1",
        "person_generation": "AllowAdult",
        "input_compliance_check": "Enabled",
        "output_compliance_check": "Enabled"
    },
    "session_id": "image-task-67890",
    "session_context": "{\"user_id\": \"123\", \"scene\": \"profile_picture\"}",
    "tasks_priority": 10,
    "ext_info": ""
})
headers = {
   'Accept': 'application/json',
   'Authorization': 'Bearer YOUR_API_KEY',
   'Content-Type': 'application/json',
}
conn.request("POST", "/tencent-vod/v1/aigc-image", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
POST https://api.quickrouter.ai/tencent-vod/v1/aigc-image HTTP/1.1
Accept: application/json
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json

{
    "model_name": "GEM",
    "model_version": "3.0",
    "file_infos": [
        {
            "type": "file",
            "file_id": "387702299774574677",
            "url": "",
            "text": "原始图片的描述信息"
        }
    ],
    "prompt": "convert this image to anime style",
    "negative_prompt": "blur, distorted",
    "enhance_prompt": "Enabled",
    "output_config": {
        "storage_mode": "Temporary",
        "resolution": "1080P",
        "aspect_ratio": "1:1",
        "person_generation": "AllowAdult",
        "input_compliance_check": "Enabled",
        "output_compliance_check": "Enabled"
    },
    "session_id": "image-task-67890",
    "session_context": "{\"user_id\": \"123\", \"scene\": \"profile_picture\"}",
    "tasks_priority": 10,
    "ext_info": ""
}
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "https://api.quickrouter.ai/tencent-vod/v1/aigc-image");

struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "Accept: application/json");
headers = curl_slist_append(headers, "Authorization: Bearer YOUR_API_KEY");
headers = curl_slist_append(headers, "Content-Type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{
    \"model_name\": \"GEM\",
    \"model_version\": \"3.0\",
    \"file_infos\": [
        {
            \"type\": \"file\",
            \"file_id\": \"387702299774574677\",
            \"url\": \"\",
            \"text\": \"原始图片的描述信息\"
        }
    ],
    \"prompt\": \"convert this image to anime style\",
    \"negative_prompt\": \"blur, distorted\",
    \"enhance_prompt\": \"Enabled\",
    \"output_config\": {
        \"storage_mode\": \"Temporary\",
        \"resolution\": \"1080P\",
        \"aspect_ratio\": \"1:1\",
        \"person_generation\": \"AllowAdult\",
        \"input_compliance_check\": \"Enabled\",
        \"output_compliance_check\": \"Enabled\"
    },
    \"session_id\": \"image-task-67890\",
    \"session_context\": \"{\\"user_id\\": \\"123\\", \\"scene\\": \\"profile_picture\\"}\",
    \"tasks_priority\": 10,
    \"ext_info\": \"\"
}");
CURLcode ret = curl_easy_perform(hnd);
var client = new RestClient("https://api.quickrouter.ai/tencent-vod/v1/aigc-image");
var request = new RestRequest(Method.POST);
request.AddHeader("Accept", "application/json");
request.AddHeader("Authorization", "Bearer YOUR_API_KEY");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", @"{
    "model_name": "GEM",
    "model_version": "3.0",
    "file_infos": [
        {
            "type": "file",
            "file_id": "387702299774574677",
            "url": "",
            "text": "原始图片的描述信息"
        }
    ],
    "prompt": "convert this image to anime style",
    "negative_prompt": "blur, distorted",
    "enhance_prompt": "Enabled",
    "output_config": {
        "storage_mode": "Temporary",
        "resolution": "1080P",
        "aspect_ratio": "1:1",
        "person_generation": "AllowAdult",
        "input_compliance_check": "Enabled",
        "output_compliance_check": "Enabled"
    },
    "session_id": "image-task-67890",
    "session_context": "{\"user_id\": \"123\", \"scene\": \"profile_picture\"}",
    "tasks_priority": 10,
    "ext_info": ""
}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
#import <Foundation/Foundation.h>

NSURL *url = [NSURL URLWithString:@"https://api.quickrouter.ai/tencent-vod/v1/aigc-image"];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
[request setHTTPMethod:@"POST"];
[request setValue:@"application/json" forHTTPHeaderField:@"Accept"];
[request setValue:@"Bearer YOUR_API_KEY" forHTTPHeaderField:@"Authorization"];
[request setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
[request setHTTPBody:[@"{
    \"model_name\": \"GEM\",
    \"model_version\": \"3.0\",
    \"file_infos\": [
        {
            \"type\": \"file\",
            \"file_id\": \"387702299774574677\",
            \"url\": \"\",
            \"text\": \"原始图片的描述信息\"
        }
    ],
    \"prompt\": \"convert this image to anime style\",
    \"negative_prompt\": \"blur, distorted\",
    \"enhance_prompt\": \"Enabled\",
    \"output_config\": {
        \"storage_mode\": \"Temporary\",
        \"resolution\": \"1080P\",
        \"aspect_ratio\": \"1:1\",
        \"person_generation\": \"AllowAdult\",
        \"input_compliance_check\": \"Enabled\",
        \"output_compliance_check\": \"Enabled\"
    },
    \"session_id\": \"image-task-67890\",
    \"session_context\": \"{\\"user_id\\": \\"123\\", \\"scene\\": \\"profile_picture\\"}\",
    \"tasks_priority\": 10,
    \"ext_info\": \"\"
}" dataUsingEncoding:NSUTF8StringEncoding]];
NSURLSessionDataTask *task = [[NSURLSession sharedSession] dataTaskWithRequest:request completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
    NSLog(@"%@", [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]);
}];
[task resume];
require "uri"
require "net/http"
require "json"

url = URI("https://api.quickrouter.ai/tencent-vod/v1/aigc-image")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Accept"] = "application/json"
request["Authorization"] = "Bearer YOUR_API_KEY"
request["Content-Type"] = "application/json"
request.body = '{
    "model_name": "GEM",
    "model_version": "3.0",
    "file_infos": [
        {
            "type": "file",
            "file_id": "387702299774574677",
            "url": "",
            "text": "原始图片的描述信息"
        }
    ],
    "prompt": "convert this image to anime style",
    "negative_prompt": "blur, distorted",
    "enhance_prompt": "Enabled",
    "output_config": {
        "storage_mode": "Temporary",
        "resolution": "1080P",
        "aspect_ratio": "1:1",
        "person_generation": "AllowAdult",
        "input_compliance_check": "Enabled",
        "output_compliance_check": "Enabled"
    },
    "session_id": "image-task-67890",
    "session_context": "{\"user_id\": \"123\", \"scene\": \"profile_picture\"}",
    "tasks_priority": 10,
    "ext_info": ""
}'
response = http.request(request)
puts response.read_body
(* Requires cohttp and lwt *)

let url = "https://api.quickrouter.ai/tencent-vod/v1/aigc-image" in
let headers = Cohttp.Header.of_list [
  ("Accept", "application/json");
  ("Authorization", "Bearer YOUR_API_KEY");
  ("Content-Type", "application/json");
] in
let body = Cohttp_lwt.Body.of_string '{
    "model_name": "GEM",
    "model_version": "3.0",
    "file_infos": [
        {
            "type": "file",
            "file_id": "387702299774574677",
            "url": "",
            "text": "原始图片的描述信息"
        }
    ],
    "prompt": "convert this image to anime style",
    "negative_prompt": "blur, distorted",
    "enhance_prompt": "Enabled",
    "output_config": {
        "storage_mode": "Temporary",
        "resolution": "1080P",
        "aspect_ratio": "1:1",
        "person_generation": "AllowAdult",
        "input_compliance_check": "Enabled",
        "output_compliance_check": "Enabled"
    },
    "session_id": "image-task-67890",
    "session_context": "{\"user_id\": \"123\", \"scene\": \"profile_picture\"}",
    "tasks_priority": 10,
    "ext_info": ""
}' in
Lwt_main.run (
  Cohttp_lwt_unix.Client.request ?body:(Some body) ~method_:`POST ~headers (Uri.of_string url)
  >>= fun (resp, body) ->
  Cohttp_lwt.Body.to_string body >|= fun s -> print_endline s
)
import 'package:http/http.dart' as http;
import 'dart:convert';

var headers = {
  "Accept": "application/json",
  "Authorization": "Bearer YOUR_API_KEY",
  "Content-Type": "application/json",
};
var body = json.encode({
    "model_name": "GEM",
    "model_version": "3.0",
    "file_infos": [
        {
            "type": "file",
            "file_id": "387702299774574677",
            "url": "",
            "text": "原始图片的描述信息"
        }
    ],
    "prompt": "convert this image to anime style",
    "negative_prompt": "blur, distorted",
    "enhance_prompt": "Enabled",
    "output_config": {
        "storage_mode": "Temporary",
        "resolution": "1080P",
        "aspect_ratio": "1:1",
        "person_generation": "AllowAdult",
        "input_compliance_check": "Enabled",
        "output_compliance_check": "Enabled"
    },
    "session_id": "image-task-67890",
    "session_context": "{\"user_id\": \"123\", \"scene\": \"profile_picture\"}",
    "tasks_priority": 10,
    "ext_info": ""
});
var response = await http.post(Uri.parse("https://api.quickrouter.ai/tencent-vod/v1/aigc-image"), headers: headers, body: body);
print(response.body);
library(httr)

url <- "https://api.quickrouter.ai/tencent-vod/v1/aigc-image"
body <- '{
    "model_name": "GEM",
    "model_version": "3.0",
    "file_infos": [
        {
            "type": "file",
            "file_id": "387702299774574677",
            "url": "",
            "text": "原始图片的描述信息"
        }
    ],
    "prompt": "convert this image to anime style",
    "negative_prompt": "blur, distorted",
    "enhance_prompt": "Enabled",
    "output_config": {
        "storage_mode": "Temporary",
        "resolution": "1080P",
        "aspect_ratio": "1:1",
        "person_generation": "AllowAdult",
        "input_compliance_check": "Enabled",
        "output_compliance_check": "Enabled"
    },
    "session_id": "image-task-67890",
    "session_context": "{\"user_id\": \"123\", \"scene\": \"profile_picture\"}",
    "tasks_priority": 10,
    "ext_info": ""
}'
response <- post(url, body = body, add_headers("Accept" = "application/json", "Authorization" = "Bearer YOUR_API_KEY", "Content-Type" = "application/json"))
content(response, "text", encoding = "UTF-8")

返回响应

响应参数 🟢 200 OK · application/json
status string
必需
request_id string
必需
response_url string
必需
status_url string
必需
cancel_url string
必需
logs null
必需
metrics object
必需
queue_position integer
必需
{ "Response": { "TaskId": "251007502-AigcImage***2782aff1e896673f1ft", "RequestId": "f50d7667-72d8-46bb-a7e3-0613588971b6" } }
示例
{
    "Response": {
        "TaskId": "251007502-AigcImage***2782aff1e896673f1ft",
        "RequestId": "f50d7667-72d8-46bb-a7e3-0613588971b6"
    }
}

常见错误

  • 401 认证失败:检查 API Key 是否正确
  • 429 请求限流:降低调用频率或升级套餐
  • 500 服务器错误:稍后重试

注意事项

  • 请确保 API Key 有足够的余额
  • 请求频率受 API 限制,请参考价格页面