curl --request POST \
--url 'https://api.elkapi.com/v1/images/generations' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"prompt": "日差しのある庭を走る小さな子猫、映画的、高精細",
"model": "gpt-image-1.5",
"size": "1024x1024",
"stream": false
}'
import requests
url = "https://api.elkapi.com/v1/images/generations"
headers = {
"Authorization": "Bearer <token>"
}
headers["Content-Type"] = "application/json"
payload = {
"prompt": "日差しのある庭を走る小さな子猫、映画的、高精細",
"model": "gpt-image-1.5",
"size": "1024x1024",
"stream": False
}
response = requests.request("POST", url, headers=headers, json=payload)
print(response.json())
const url = "https://api.elkapi.com/v1/images/generations";
const headers = {
"Authorization": "Bearer <token>"
};
headers["Content-Type"] = "application/json";
const payload = {
"prompt": "日差しのある庭を走る小さな子猫、映画的、高精細",
"model": "gpt-image-1.5",
"size": "1024x1024",
"stream": false
};
const response = await fetch(url, {
method: "POST",
headers,
body: JSON.stringify(payload)
});
console.log(await response.json());
{
"created": 1,
"data": [
{
"b64_json": "b64_json",
"url": "https://example.com/image.png"
}
],
"usage": {
"total_tokens": 1,
"input_tokens": 1,
"output_tokens": 1,
"input_tokens_details": {
"text_tokens": 1,
"image_tokens": 1
}
}
}
ネイティブ OpenAI 形式
画像を生成
- 指定したプロンプトから画像を作成します。詳細。
POST
/
v1
/
images
/
generations
curl --request POST \
--url 'https://api.elkapi.com/v1/images/generations' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"prompt": "日差しのある庭を走る小さな子猫、映画的、高精細",
"model": "gpt-image-1.5",
"size": "1024x1024",
"stream": false
}'
import requests
url = "https://api.elkapi.com/v1/images/generations"
headers = {
"Authorization": "Bearer <token>"
}
headers["Content-Type"] = "application/json"
payload = {
"prompt": "日差しのある庭を走る小さな子猫、映画的、高精細",
"model": "gpt-image-1.5",
"size": "1024x1024",
"stream": False
}
response = requests.request("POST", url, headers=headers, json=payload)
print(response.json())
const url = "https://api.elkapi.com/v1/images/generations";
const headers = {
"Authorization": "Bearer <token>"
};
headers["Content-Type"] = "application/json";
const payload = {
"prompt": "日差しのある庭を走る小さな子猫、映画的、高精細",
"model": "gpt-image-1.5",
"size": "1024x1024",
"stream": false
};
const response = await fetch(url, {
method: "POST",
headers,
body: JSON.stringify(payload)
});
console.log(await response.json());
{
"created": 1,
"data": [
{
"b64_json": "b64_json",
"url": "https://example.com/image.png"
}
],
"usage": {
"total_tokens": 1,
"input_tokens": 1,
"output_tokens": 1,
"input_tokens_details": {
"text_tokens": 1,
"image_tokens": 1
}
}
}
curl --request POST \
--url 'https://api.elkapi.com/v1/images/generations' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"prompt": "日差しのある庭を走る小さな子猫、映画的、高精細",
"model": "gpt-image-1.5",
"size": "1024x1024",
"stream": false
}'
import requests
url = "https://api.elkapi.com/v1/images/generations"
headers = {
"Authorization": "Bearer <token>"
}
headers["Content-Type"] = "application/json"
payload = {
"prompt": "日差しのある庭を走る小さな子猫、映画的、高精細",
"model": "gpt-image-1.5",
"size": "1024x1024",
"stream": False
}
response = requests.request("POST", url, headers=headers, json=payload)
print(response.json())
const url = "https://api.elkapi.com/v1/images/generations";
const headers = {
"Authorization": "Bearer <token>"
};
headers["Content-Type"] = "application/json";
const payload = {
"prompt": "日差しのある庭を走る小さな子猫、映画的、高精細",
"model": "gpt-image-1.5",
"size": "1024x1024",
"stream": false
};
const response = await fetch(url, {
method: "POST",
headers,
body: JSON.stringify(payload)
});
console.log(await response.json());
{
"created": 1,
"data": [
{
"b64_json": "b64_json",
"url": "https://example.com/image.png"
}
],
"usage": {
"total_tokens": 1,
"input_tokens": 1,
"output_tokens": 1,
"input_tokens_details": {
"text_tokens": 1,
"image_tokens": 1
}
}
}
Authorizations
string
必須
すべてのエンドポイントで Bearer Token 認証が必要です。リクエストヘッダーに追加します:
Authorization: Bearer YOUR_API_KEY
Body
string
デフォルト:"gpt-image-1.5"
画像生成に使用するモデル。
dall-e-2、dall-e-3、gpt-image-1 のいずれかです。gpt-image-1 専用パラメーターを使用しない限り、デフォルトは dall-e-2 です。例:gpt-image-1.5string
必須
生成したい画像のテキスト説明。最大長は
gpt-image-1 が32,000文字、dall-e-2 が1,000文字、dall-e-3 が4,000文字です。integer
生成する画像数。1〜10の範囲で指定します。
dall-e-3 では n=1 のみ対応します。string
生成画像のサイズ。
gpt-image-1 では 1024x1024、1536x1024(横向き)、1024x1536(縦向き)、または auto(デフォルト)のいずれかです。dall-e-2 では 256x256、512x512、1024x1024 のいずれかです。dall-e-3 では 1024x1024、1792x1024、1024x1792 のいずれかです。string
生成画像の背景透明度を設定できます。このパラメーターは
gpt-image-1 のみ対応します。transparent、opaque、auto(デフォルト)のいずれかです。auto を使用すると、モデルが画像に最適な背景を自動判定します。背景が transparent の場合、出力形式は透明度に対応している必要があるため、png(デフォルト)または webp に設定してください。string
gpt-image-1 が生成する画像のコンテンツモデレーションレベルを制御します。より制限の少ないフィルタリングには low、または auto(デフォルト)を指定します。string
生成画像の品質。
string
string
string
Response
integer