以下示例使用 gpt-image-2-vip 模型生成一张 2K 分辨率的猫咪舔毛图片。请将 YOUR_API_KEY 替换为你的真实 Key。
cURL
# 调用 gpt-image-2-vip 生成 2K 猫咪舔毛图片
curl -X POST "https://aitkapi.com/v1/images/generations" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-image-2-vip",
"prompt": "A cute cat licking its fur, ultra detailed, photorealistic, soft natural lighting, high resolution 2K quality",
"size": "2048x2048",
"n": 1
}'
Python (requests)
import requests
url = "https://aitkapi.com/v1/images/generations"
headers = {
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json",
}
payload = {
"model": "gpt-image-2-vip",
"prompt": "A cute cat licking its fur, ultra detailed, "
"photorealistic, soft natural lighting, 2K",
"size": "2048x2048",
"n": 1,
}
resp = requests.post(url, headers=headers, json=payload, timeout=300)
data = resp.json()
print(data["data"][0]["url"])
Node.js (fetch)
const res = await fetch("https://aitkapi.com/v1/images/generations", {
method: "POST",
headers: {
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json",
},
body: JSON.stringify({
model: "gpt-image-2-vip",
prompt: "A cute cat licking its fur, ultra detailed, photorealistic, 2K",
size: "2048x2048",
n: 1,
}),
});
const data = await res.json();
console.log(data.data[0].url);
实际响应(已脱敏)
{
"created": 1779966348,
"data": [
{
"url": "https://file2.aitohumanize.com/file/690dfab496f949ebbe56ff5d518f35ab.png"
}
],
"usage": {
"total_tokens": 3599,
"input_tokens": 31,
"output_tokens": 3568,
"input_tokens_details": {}
}
}
生成结果预览