生成图片
curl --request POST \
--url https://api.bianxie.ai/v1/images/generationsimport requests
url = "https://api.bianxie.ai/v1/images/generations"
response = requests.post(url)
print(response.text)const options = {method: 'POST'};
fetch('https://api.bianxie.ai/v1/images/generations', 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://api.bianxie.ai/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",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.bianxie.ai/v1/images/generations"
req, _ := http.NewRequest("POST", url, nil)
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.bianxie.ai/v1/images/generations")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.bianxie.ai/v1/images/generations")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
response = http.request(request)
puts response.read_bodyOpenAI
生成图片
根据提示词创建图片
POST
/
v1
/
images
/
generations
生成图片
curl --request POST \
--url https://api.bianxie.ai/v1/images/generationsimport requests
url = "https://api.bianxie.ai/v1/images/generations"
response = requests.post(url)
print(response.text)const options = {method: 'POST'};
fetch('https://api.bianxie.ai/v1/images/generations', 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://api.bianxie.ai/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",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.bianxie.ai/v1/images/generations"
req, _ := http.NewRequest("POST", url, nil)
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.bianxie.ai/v1/images/generations")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.bianxie.ai/v1/images/generations")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
response = http.request(request)
puts response.read_body| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
model | string | 是 | 图片生成模型 ID。 |
prompt | string | 是 | 图片描述。 |
n | integer | 否 | 生成数量,模型可能限制该值。 |
size | string | 否 | 模型支持的输出尺寸。 |
quality | string | 否 | 输出质量。 |
background | string | 否 | 背景模式,如透明或不透明。 |
output_format | string | 否 | 输出格式,如 png、jpeg、webp。 |
moderation, user | string | 否 | 审查级别与用户标识。 |
curl https://api.bianxie.ai/v1/images/generations \
-H "Authorization: Bearer API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "your-model",
"prompt": "蓝天下的未来城市"
}'
client.images.generate(model="your-model", prompt="蓝天下的未来城市")
await client.images.generate({ model: "your-model", prompt: "A futuristic city" });
created 与 data[];图片可能以 b64_json 或 URL 返回,并可包含修订后的提示词。是否支持流式进度取决于所选模型,默认按非流式处理。⌘I
