API สร้างรูปภาพ
เรียกใช้โมเดลรูปภาพ จัดการรูปแบบผลลัพธ์ และติดตามต้นทุนการสร้างรูป
สรุปคู่มือ
เรียกใช้โมเดลรูปภาพ จัดการรูปแบบผลลัพธ์ และติดตามต้นทุนการสร้างรูป
เรียกใช้โมเดลรูปภาพ จัดการรูปแบบผลลัพธ์ และติดตามต้นทุนการสร้างรูป
ตัวอย่างโค้ด
These examples all call the same public LingCoreX endpoint.
curl — wan2.7-image
curl https://api.lingcorex.ai/v1/images/generations \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "wan2.7-image",
"prompt": "A quiet mountain lake at sunrise, cinematic photography, no text",
"n": 1,
"size": "1K"
}'Python — wan2.7-image-pro
import requests
response = requests.post(
"https://api.lingcorex.ai/v1/images/generations",
headers={
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json",
},
json={
"model": "wan2.7-image-pro",
"prompt": "A premium studio photograph of a blue glass perfume bottle",
"n": 1,
"size": "2K",
"watermark": False,
},
timeout=600,
)
response.raise_for_status()
payload = response.json()
print(payload["data"][0]["url"])JavaScript — fetch
const response = await fetch(
"https://api.lingcorex.ai/v1/images/generations",
{
method: "POST",
headers: {
Authorization: "Bearer YOUR_API_KEY",
"Content-Type": "application/json",
},
body: JSON.stringify({
model: "wan2.7-image",
prompt: "An isometric illustration of a small green energy laboratory",
n: 1,
size: "1024x1024",
}),
},
)
if (!response.ok) {
throw new Error(await response.text())
}
const result = await response.json()
console.log(result.data[0].url)ตัวอย่างโค้ด 2
Wan responses are normalized to the OpenAI Images API shape and include the successful image count.
Successful Wan response
{
"created": 1784962566,
"data": [
{
"url": "https://example-oss.aliyuncs.com/generated-image.png?SIGNED_QUERY"
}
],
"usage": {
"image_count": 1
}
}รายการตรวจสอบการเชื่อมต่อ
01
1
สร้างคีย์ API ในแดชบอร์ดและเลือกกลุ่มโมเดลที่ถูกต้อง
02
2
ทดสอบตัวอย่างและตรวจสอบข้อผิดพลาดกับบันทึกการใช้งาน
03
3
ก่อน production ให้ตรวจสอบ QPM งบประมาณ และราคาจริงของโมเดล