curl https://api.cometapi.com/v1/images/generations \ -H "Authorization: Bearer $COMETAPI_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "doubao-seedream-5-0-260128", "prompt": "A clean studio photograph of a small red ceramic teapot on a pale blue table, soft window light, no text.", "size": "2K", "response_format": "url", "watermark": false, "async": true }'
import os
import requests
response = requests.post(
"https://api.cometapi.com/v1/images/generations",
headers={
"Authorization": "Bearer " + os.environ["COMETAPI_KEY"],
"Content-Type": "application/json",
},
json={
"model": "doubao-seedream-5-0-260128",
"prompt": "A clean studio photograph of a small red ceramic teapot on a pale blue table, soft window light, no text.",
"size": "2K",
"response_format": "url",
"watermark": False,
"async": True,
},
timeout=60,
)
response.raise_for_status()
print(response.json()["data"]["task_id"])
const response = await fetch("https://api.cometapi.com/v1/images/generations", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.COMETAPI_KEY}`,
"Content-Type": "application/json",
},
signal: AbortSignal.timeout(60_000),
body: JSON.stringify({
model: "doubao-seedream-5-0-260128",
prompt: "A clean studio photograph of a small red ceramic teapot on a pale blue table, soft window light, no text.",
size: "2K",
response_format: "url",
watermark: false,
async: true,
}),
});
if (!response.ok) throw new Error(await response.text());
const task = await response.json();
console.log(task.data.task_id);
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.cometapi.com/v1/images/generations",
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([
'model' => 'doubao-seedream-5-0-260128',
'prompt' => 'A clean studio photograph of a small red ceramic teapot on a pale blue table, soft window light, no text.',
'async' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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://api.cometapi.com/v1/images/generations"
payload := strings.NewReader("{\n \"model\": \"doubao-seedream-5-0-260128\",\n \"prompt\": \"A clean studio photograph of a small red ceramic teapot on a pale blue table, soft window light, no text.\",\n \"async\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://api.cometapi.com/v1/images/generations")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"doubao-seedream-5-0-260128\",\n \"prompt\": \"A clean studio photograph of a small red ceramic teapot on a pale blue table, soft window light, no text.\",\n \"async\": true\n}")
.asString();
require 'uri'
require 'net/http'
url = URI("https://api.cometapi.com/v1/images/generations")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"doubao-seedream-5-0-260128\",\n \"prompt\": \"A clean studio photograph of a small red ceramic teapot on a pale blue table, soft window light, no text.\",\n \"async\": true\n}"
response = http.request(request)
puts response.read_body
Bearer token authentication. Use your CometAPI key.
请求体
application/json
model
string
必填
Seedream model ID. This async workflow is documented for doubao-seedream-4-0-250828, doubao-seedream-4-5-251128, doubao-seedream-5-0-260128, and seedream-5-0-pro-260628. Query /v1/models or open the Models page for account availability.
示例:
"doubao-seedream-5-0-260128"
prompt
string
必填
Text prompt describing the image to generate.
示例:
"A clean studio photograph of a small red ceramic teapot on a pale blue table, soft window light, no text."
async
boolean
必填
Asynchronous task mode. Set this to true, store data.task_id, and poll the task endpoint.
size
string
Requested output size. Use a value supported by the selected model.
示例:
"2K"
response_format
string
Response workflow for this async request. The example uses url and retrieves the URL from the completed task.
示例:
"url"
watermark
boolean
Whether to request a visible watermark on the generated image.
示例:
false
响应
200 - application/json
Seedream asynchronous task submission response.
code
string
必填
Request status code. A successful submission returns success.
示例:
"success"
message
string
必填
Status message. A successful submission can return an empty string.
data
object
必填
Show child attributes
最后修改于 2026年7月31日
⌘I
cURL
curl https://api.cometapi.com/v1/images/generations \ -H "Authorization: Bearer $COMETAPI_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "doubao-seedream-5-0-260128", "prompt": "A clean studio photograph of a small red ceramic teapot on a pale blue table, soft window light, no text.", "size": "2K", "response_format": "url", "watermark": false, "async": true }'
import os
import requests
response = requests.post(
"https://api.cometapi.com/v1/images/generations",
headers={
"Authorization": "Bearer " + os.environ["COMETAPI_KEY"],
"Content-Type": "application/json",
},
json={
"model": "doubao-seedream-5-0-260128",
"prompt": "A clean studio photograph of a small red ceramic teapot on a pale blue table, soft window light, no text.",
"size": "2K",
"response_format": "url",
"watermark": False,
"async": True,
},
timeout=60,
)
response.raise_for_status()
print(response.json()["data"]["task_id"])
const response = await fetch("https://api.cometapi.com/v1/images/generations", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.COMETAPI_KEY}`,
"Content-Type": "application/json",
},
signal: AbortSignal.timeout(60_000),
body: JSON.stringify({
model: "doubao-seedream-5-0-260128",
prompt: "A clean studio photograph of a small red ceramic teapot on a pale blue table, soft window light, no text.",
size: "2K",
response_format: "url",
watermark: false,
async: true,
}),
});
if (!response.ok) throw new Error(await response.text());
const task = await response.json();
console.log(task.data.task_id);
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.cometapi.com/v1/images/generations",
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([
'model' => 'doubao-seedream-5-0-260128',
'prompt' => 'A clean studio photograph of a small red ceramic teapot on a pale blue table, soft window light, no text.',
'async' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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://api.cometapi.com/v1/images/generations"
payload := strings.NewReader("{\n \"model\": \"doubao-seedream-5-0-260128\",\n \"prompt\": \"A clean studio photograph of a small red ceramic teapot on a pale blue table, soft window light, no text.\",\n \"async\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://api.cometapi.com/v1/images/generations")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"doubao-seedream-5-0-260128\",\n \"prompt\": \"A clean studio photograph of a small red ceramic teapot on a pale blue table, soft window light, no text.\",\n \"async\": true\n}")
.asString();
require 'uri'
require 'net/http'
url = URI("https://api.cometapi.com/v1/images/generations")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"doubao-seedream-5-0-260128\",\n \"prompt\": \"A clean studio photograph of a small red ceramic teapot on a pale blue table, soft window light, no text.\",\n \"async\": true\n}"
response = http.request(request)
puts response.read_body