GPT-4o Image 画像生成
curl --request POST \
--url https://api.sinancode.com/v1/generate/k/gpt4o-image \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"size": "1:1",
"filesUrl": [
""
],
"isEnhance": false,
"maskUrl": "",
"nVariants": 1,
"prompt": "A beautiful sunset over the mountains"
}
'import requests
url = "https://api.sinancode.com/v1/generate/k/gpt4o-image"
payload = {
"size": "1:1",
"filesUrl": [""],
"isEnhance": False,
"maskUrl": "",
"nVariants": 1,
"prompt": "A beautiful sunset over the mountains"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
size: '1:1',
filesUrl: [''],
isEnhance: false,
maskUrl: '',
nVariants: 1,
prompt: 'A beautiful sunset over the mountains'
})
};
fetch('https://api.sinancode.com/v1/generate/k/gpt4o-image', 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.sinancode.com/v1/generate/k/gpt4o-image",
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([
'size' => '1:1',
'filesUrl' => [
''
],
'isEnhance' => false,
'maskUrl' => '',
'nVariants' => 1,
'prompt' => 'A beautiful sunset over the mountains'
]),
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.sinancode.com/v1/generate/k/gpt4o-image"
payload := strings.NewReader("{\n \"size\": \"1:1\",\n \"filesUrl\": [\n \"\"\n ],\n \"isEnhance\": false,\n \"maskUrl\": \"\",\n \"nVariants\": 1,\n \"prompt\": \"A beautiful sunset over the mountains\"\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.sinancode.com/v1/generate/k/gpt4o-image")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"size\": \"1:1\",\n \"filesUrl\": [\n \"\"\n ],\n \"isEnhance\": false,\n \"maskUrl\": \"\",\n \"nVariants\": 1,\n \"prompt\": \"A beautiful sunset over the mountains\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sinancode.com/v1/generate/k/gpt4o-image")
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 \"size\": \"1:1\",\n \"filesUrl\": [\n \"\"\n ],\n \"isEnhance\": false,\n \"maskUrl\": \"\",\n \"nVariants\": 1,\n \"prompt\": \"A beautiful sunset over the mountains\"\n}"
response = http.request(request)
puts response.read_body{
"task_id": "01234567-89ab-cdef-0123-456789abcdef"
}{
"error_code": "<string>",
"message": "<string>"
}{
"error_code": "<string>",
"message": "<string>"
}{
"error_code": "<string>",
"message": "<string>"
}画像生成 - GPT4o
GPT-4o Image
OpenAI GPT-4o モデルを使用して画像を生成します(非同期)
POST
/
generate
/
k
/
gpt4o-image
GPT-4o Image 画像生成
curl --request POST \
--url https://api.sinancode.com/v1/generate/k/gpt4o-image \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"size": "1:1",
"filesUrl": [
""
],
"isEnhance": false,
"maskUrl": "",
"nVariants": 1,
"prompt": "A beautiful sunset over the mountains"
}
'import requests
url = "https://api.sinancode.com/v1/generate/k/gpt4o-image"
payload = {
"size": "1:1",
"filesUrl": [""],
"isEnhance": False,
"maskUrl": "",
"nVariants": 1,
"prompt": "A beautiful sunset over the mountains"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
size: '1:1',
filesUrl: [''],
isEnhance: false,
maskUrl: '',
nVariants: 1,
prompt: 'A beautiful sunset over the mountains'
})
};
fetch('https://api.sinancode.com/v1/generate/k/gpt4o-image', 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.sinancode.com/v1/generate/k/gpt4o-image",
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([
'size' => '1:1',
'filesUrl' => [
''
],
'isEnhance' => false,
'maskUrl' => '',
'nVariants' => 1,
'prompt' => 'A beautiful sunset over the mountains'
]),
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.sinancode.com/v1/generate/k/gpt4o-image"
payload := strings.NewReader("{\n \"size\": \"1:1\",\n \"filesUrl\": [\n \"\"\n ],\n \"isEnhance\": false,\n \"maskUrl\": \"\",\n \"nVariants\": 1,\n \"prompt\": \"A beautiful sunset over the mountains\"\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.sinancode.com/v1/generate/k/gpt4o-image")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"size\": \"1:1\",\n \"filesUrl\": [\n \"\"\n ],\n \"isEnhance\": false,\n \"maskUrl\": \"\",\n \"nVariants\": 1,\n \"prompt\": \"A beautiful sunset over the mountains\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sinancode.com/v1/generate/k/gpt4o-image")
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 \"size\": \"1:1\",\n \"filesUrl\": [\n \"\"\n ],\n \"isEnhance\": false,\n \"maskUrl\": \"\",\n \"nVariants\": 1,\n \"prompt\": \"A beautiful sunset over the mountains\"\n}"
response = http.request(request)
puts response.read_body{
"task_id": "01234567-89ab-cdef-0123-456789abcdef"
}{
"error_code": "<string>",
"message": "<string>"
}{
"error_code": "<string>",
"message": "<string>"
}{
"error_code": "<string>",
"message": "<string>"
}OpenAI の GPT-4o モデルを使用して画像を生成します。
承認
API Tokenを使用して認証を行ってください
ボディ
application/json
タスクパラメータ
サイズ(必須)- 画像のアスペクト比、サポートされている形式のいずれかである必要があります
利用可能なオプション:
1:1, 3:2, 2:3 例:
"1:1"
ファイルURLリスト(オプション)- ファイルURLリスト、最大5枚の画像
例:
[""]
拡張を有効化(オプション)- プロンプト拡張、デフォルト false
例:
false
マスクURL(オプション)- 編集用のマスク画像URL、黒色の領域が置換/修正されます
例:
""
バリエーション数(オプション)- 画像バリエーション数、1、2、または4を選択可能、デフォルト1
利用可能なオプション:
1, 2, 4 例:
1
プロンプト(オプション)- GPT-4oに生成してほしい内容を記述
例:
"A beautiful sunset over the mountains"
レスポンス
OK
タスクID
例:
"01234567-89ab-cdef-0123-456789abcdef"
⌘I