AI生图-图生图
curl --request POST \
--url https://leapx-hub.com/prod-api/nebula/v4/api/img2imgSubmit \
--header 'Authorization: <authorization>' \
--header 'Content-Type: application/json' \
--data '
{
"volcImageBo.imageUrl": "<string>",
"volcImageBo.image_urls": {},
"volcImageBo.prompt": "<string>",
"volcImageBo.req_key": "<string>",
"volcImageBo.return_url": true
}
'import requests
url = "https://leapx-hub.com/prod-api/nebula/v4/api/img2imgSubmit"
payload = {
"volcImageBo.imageUrl": "<string>",
"volcImageBo.image_urls": {},
"volcImageBo.prompt": "<string>",
"volcImageBo.req_key": "<string>",
"volcImageBo.return_url": True
}
headers = {
"Authorization": "<authorization>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<authorization>', 'Content-Type': 'application/json'},
body: JSON.stringify({
'volcImageBo.imageUrl': '<string>',
'volcImageBo.image_urls': {},
'volcImageBo.prompt': '<string>',
'volcImageBo.req_key': '<string>',
'volcImageBo.return_url': true
})
};
fetch('https://leapx-hub.com/prod-api/nebula/v4/api/img2imgSubmit', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://leapx-hub.com/prod-api/nebula/v4/api/img2imgSubmit",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'volcImageBo.imageUrl' => '<string>',
'volcImageBo.image_urls' => [
],
'volcImageBo.prompt' => '<string>',
'volcImageBo.req_key' => '<string>',
'volcImageBo.return_url' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://leapx-hub.com/prod-api/nebula/v4/api/img2imgSubmit"
payload := strings.NewReader("{\n \"volcImageBo.imageUrl\": \"<string>\",\n \"volcImageBo.image_urls\": {},\n \"volcImageBo.prompt\": \"<string>\",\n \"volcImageBo.req_key\": \"<string>\",\n \"volcImageBo.return_url\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<authorization>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://leapx-hub.com/prod-api/nebula/v4/api/img2imgSubmit")
.header("Authorization", "<authorization>")
.header("Content-Type", "application/json")
.body("{\n \"volcImageBo.imageUrl\": \"<string>\",\n \"volcImageBo.image_urls\": {},\n \"volcImageBo.prompt\": \"<string>\",\n \"volcImageBo.req_key\": \"<string>\",\n \"volcImageBo.return_url\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://leapx-hub.com/prod-api/nebula/v4/api/img2imgSubmit")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<authorization>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"volcImageBo.imageUrl\": \"<string>\",\n \"volcImageBo.image_urls\": {},\n \"volcImageBo.prompt\": \"<string>\",\n \"volcImageBo.req_key\": \"<string>\",\n \"volcImageBo.return_url\": true\n}"
response = http.request(request)
puts response.read_body{
"code": 200,
"msg": "操作成功",
"data": {
"images": [{
"url": "https://example.com/image.jpg"
}]
}
}
AI 生图
AI生图-图生图
POST
/
prod-api
/
nebula
/
v4
/
api
/
img2imgSubmit
AI生图-图生图
curl --request POST \
--url https://leapx-hub.com/prod-api/nebula/v4/api/img2imgSubmit \
--header 'Authorization: <authorization>' \
--header 'Content-Type: application/json' \
--data '
{
"volcImageBo.imageUrl": "<string>",
"volcImageBo.image_urls": {},
"volcImageBo.prompt": "<string>",
"volcImageBo.req_key": "<string>",
"volcImageBo.return_url": true
}
'import requests
url = "https://leapx-hub.com/prod-api/nebula/v4/api/img2imgSubmit"
payload = {
"volcImageBo.imageUrl": "<string>",
"volcImageBo.image_urls": {},
"volcImageBo.prompt": "<string>",
"volcImageBo.req_key": "<string>",
"volcImageBo.return_url": True
}
headers = {
"Authorization": "<authorization>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<authorization>', 'Content-Type': 'application/json'},
body: JSON.stringify({
'volcImageBo.imageUrl': '<string>',
'volcImageBo.image_urls': {},
'volcImageBo.prompt': '<string>',
'volcImageBo.req_key': '<string>',
'volcImageBo.return_url': true
})
};
fetch('https://leapx-hub.com/prod-api/nebula/v4/api/img2imgSubmit', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://leapx-hub.com/prod-api/nebula/v4/api/img2imgSubmit",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'volcImageBo.imageUrl' => '<string>',
'volcImageBo.image_urls' => [
],
'volcImageBo.prompt' => '<string>',
'volcImageBo.req_key' => '<string>',
'volcImageBo.return_url' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://leapx-hub.com/prod-api/nebula/v4/api/img2imgSubmit"
payload := strings.NewReader("{\n \"volcImageBo.imageUrl\": \"<string>\",\n \"volcImageBo.image_urls\": {},\n \"volcImageBo.prompt\": \"<string>\",\n \"volcImageBo.req_key\": \"<string>\",\n \"volcImageBo.return_url\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<authorization>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://leapx-hub.com/prod-api/nebula/v4/api/img2imgSubmit")
.header("Authorization", "<authorization>")
.header("Content-Type", "application/json")
.body("{\n \"volcImageBo.imageUrl\": \"<string>\",\n \"volcImageBo.image_urls\": {},\n \"volcImageBo.prompt\": \"<string>\",\n \"volcImageBo.req_key\": \"<string>\",\n \"volcImageBo.return_url\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://leapx-hub.com/prod-api/nebula/v4/api/img2imgSubmit")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<authorization>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"volcImageBo.imageUrl\": \"<string>\",\n \"volcImageBo.image_urls\": {},\n \"volcImageBo.prompt\": \"<string>\",\n \"volcImageBo.req_key\": \"<string>\",\n \"volcImageBo.return_url\": true\n}"
response = http.request(request)
puts response.read_body{
"code": 200,
"msg": "操作成功",
"data": {
"images": [{
"url": "https://example.com/image.jpg"
}]
}
}
简介
提交图生图任务,用于根据输入图片生成新的图片。请求体使用 VolcImageDTO,根级为volcImageBo 对象(与 OpenAPI 默认模块一致)。
认证
string
必填
Bearer Token,如
Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9...
获取方法:依照左侧最上面认证模块的post接口获取,https://docs.leapx-hub.com/cn/leapx-lab-v4/endpoint/get-token请求参数
请求体为 JSON,根级字段volcImageBo 对应图生图参数对象。
string
必填
图片链接(单图)
array[string]
图片 url 数组。0:输入图片(三通道 RGB);1:输入 mask(单通道灰度,原图保持为 0/黑色,待消除区域为 255/白色)
string
必填
提示词
string
请求标识
boolean
是否返回图片 URL
示例代码
- cURL示例
- Python示例
curl -X POST "https://leapx-hub.com/prod-api/nebula/v4/api/img2imgSubmit" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk-xxxxxxxxxx" \
-d '{
"volcImageBo": {
"imageUrl": "https://example.com/source.jpg",
"image_urls": ["https://example.com/source.jpg"],
"prompt": "变成油画风格",
"req_key": "img2img_001",
"return_url": true
}
}'
import requests
import json
url = "https://leapx-hub.com/prod-api/nebula/v4/api/img2imgSubmit"
headers = {
"Content-Type": "application/json",
"Authorization": "Bearer sk-xxxxxxxxxx"
}
data = {
"volcImageBo": {
"imageUrl": "https://example.com/source.jpg",
"image_urls": ["https://example.com/source.jpg"],
"prompt": "变成油画风格",
"req_key": "img2img_001",
"return_url": True
}
}
response = requests.post(url, headers=headers, data=json.dumps(data))
print(response.json())
响应示例
{
"code": 200,
"msg": "操作成功",
"data": {
"images": [{
"url": "https://example.com/image.jpg"
}]
}
}
⌘I
