创建任务

POST /tencent-vod/v1/aigc-image

MethodPOST
Path/tencent-vod/v1/aigc-image
Typehttp
Status1
Module2102810
Folder75014226

说明

概览

MethodPOST
Path/tencent-vod/v1/aigc-image
Typehttp
Status1
Module2102810
Folder75014226

参数

{
  "query": [],
  "path": [],
  "cookie": [],
  "header": [
    {
      "required": false,
      "description": "",
      "type": "string",
      "id": "Jsj23RwEo1",
      "enable": true,
      "name": "Authorization",
      "sampleValue": "Bearer {{YOUR_API_KEY}}"
    },
    {
      "required": false,
      "description": "",
      "type": "string",
      "id": "jjYSOg2NrR",
      "enable": true,
      "name": "Content-Type",
      "sampleValue": "application/json"
    }
  ]
}

请求体

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

响应

[
  {
    "id": 755089939,
    "name": "成功",
    "code": 200,
    "contentType": "json",
    "jsonSchema": {
      "type": "object",
      "properties": {
        "status": {
          "type": "string"
        },
        "request_id": {
          "type": "string"
        },
        "response_url": {
          "type": "string"
        },
        "status_url": {
          "type": "string"
        },
        "cancel_url": {
          "type": "string"
        },
        "logs": {
          "type": "null"
        },
        "metrics": {
          "type": "object",
          "properties": {}
        },
        "queue_position": {
          "type": "integer"
        }
      },
      "required": [
        "status",
        "request_id",
        "response_url",
        "status_url",
        "cancel_url",
        "logs",
        "metrics",
        "queue_position"
      ]
    },
    "itemSchema": {},
    "description": "",
    "mediaType": "",
    "headers": [],
    "oasExtensions": ""
  }
]

响应示例

[
  {
    "name": "成功示例",
    "responseId": 755089939,
    "data": "{\r\n    \"Response\": {\r\n        \"TaskId\": \"251007502-AigcImage***2782aff1e896673f1ft\",\r\n        \"RequestId\": \"f50d7667-72d8-46bb-a7e3-0613588971b6\"\r\n    }\r\n}",
    "description": "",
    "oasKey": "",
    "oasExtensions": "",
    "id": 671652211
  }
]