Kling Image 4.0 API
Kling Image4.0 สร้างภาพความละเอียดสูงพร้อมข้อความหลายภาษาและความสม่ำเสมอของภาพ
Kling Image4.0 จาก Kling AI (Kuaishou) เป็นโมเดลสร้างภาพระดับมืออาชีพที่รองรับ text input, image input และ image output โดยสร้างภาพแบบ Native8K พร้อมรองรับเอาต์พุต2K และ4K นอกจากนี้ยังสร้างข้อความในภาพได้สูงสุด2,000 characters per image รองรับมากกว่า70 fonts และข้อความหลายภาษา เช่น English, Japanese, Korean, Spanish และ Portuguese
โมเดลรองรับภาพอ้างอิงสูงสุด10 ภาพ เพื่อช่วยรักษาความสม่ำเสมอของบุคคล สินค้า และสถานที่ รวมถึงสร้างชุดภาพที่มีความต่อเนื่องได้สูงสุด10 ภาพ รองรับ long-form layouts และ9 aspect ratios จึงเหมาะกับงานโฆษณาสินค้า สื่อการตลาดที่ต้องคุมแบรนด์หรือบุคคล งานโปสเตอร์ ใบปลิว กราฟิกโซเชียลมีเดีย แคตตาล็อก และโบรชัวร์ อีกทั้งยังใช้ภาพเป็น keyframes หรือ reference materials สำหรับการสร้างวิดีโอด้วย Kling4.0 ได้
อัปเดต:
ID โมเดล
kling-4.0/image-generation- อินพุต
- ข้อความ / รูปภาพ
- เอาต์พุต
- รูปภาพ
จุดเด่น
- สร้างภาพ Native8K
- รองรับข้อความหลายภาษา
- อ้างอิงภาพได้10 ภาพ
- สร้างชุดภาพได้10 ภาพ
- รองรับ9 aspect ratios
- เชื่อมต่อ Kling4.0
ผู้ให้บริการ
ราคาที่ดีที่สุดเปรียบเทียบราคา API ระหว่างผู้ให้บริการ เลือกผู้ให้บริการเพื่อดูค่าใช้จ่ายและเงื่อนไขทั้งหมด
| อัตราความพร้อมใช้งาน | |
|---|---|
สถิติย้อนหลังไม่ใช่การตรวจสอบแบบเรียลไทม์ ข้อมูลที่หายไปไม่ได้หมายถึงบริการขัดข้อง
เบนช์มาร์ก
- 15
Image leaderboard
อันดับ15
คะแนนตามที่ผู้ให้บริการโมเดลเผยแพร่
เริ่มต้นอย่างรวดเร็ว
ส่งงานภาพ ตรวจสอบสถานะ แล้วบันทึกภาพ ตัวอย่างใช้ curl และไลบรารีมาตรฐานของ Python 3
POST https://openapi.felo.ai/api/v1/images/generations
1ตั้งค่าคีย์ API
สร้างคีย์จากบัญชี Felo API Platform ของคุณและตั้งเป็นตัวแปรสภาพแวดล้อม
export FELO_API_KEY="YOUR_API_KEY"2ส่งคำขอแรก
ค่าพารามิเตอร์เสริมแตกต่างกันตามโมเดล จึงไม่กำหนดในตัวอย่าง โปรดยืนยันใน Playground ฟิลด์อยู่ระดับเดียวกับ model และ prompt ไม่ห่อด้วย input
curl --fail-with-body --max-time 60 "https://openapi.felo.ai/api/v1/images/generations" \
-H "Authorization: Bearer $FELO_API_KEY" \
-H "Content-Type: application/json" \
-o created.json \
-d '{
"prompt": "A studio product photo of a ceramic coffee cup on warm linen, soft morning light",
"model": "kling-4.0/image-generation"
}'3สอบถามสถานะงาน
เมื่อส่งจะได้รับ task_id ตรวจสอบทุก 3 วินาทีขณะ queued หรือ running และหยุดเมื่อ succeeded, failed หรือ interrupted รอสูงสุด 30 นาที เก็บ created.json เพื่อกลับมาตรวจสอบงานเดิมโดยไม่ส่งซ้ำ
python3 - <<'PY'
import json, os, time
from pathlib import Path
from urllib.parse import quote
from urllib.request import Request, urlopen
task = json.loads(Path("created.json").read_text())
task_id = task["task_id"]
url = "https://openapi.felo.ai/api/v1/images/generations/" + quote(task_id, safe="")
headers = {"Authorization": "Bearer " + os.environ["FELO_API_KEY"]}
deadline = time.monotonic() + 1800
while task["status"] in ("queued", "running"):
if time.monotonic() >= deadline:
raise TimeoutError(f"Keep task_id={task_id} to resume polling")
time.sleep(3)
with urlopen(Request(url, headers=headers), timeout=60) as response:
task = json.load(response)
if task.get("task_id") != task_id or task.get("kind") != "image":
raise ValueError("Unexpected task response")
print(task["status"])
if task["status"] != "succeeded":
raise RuntimeError(task.get("error") or task["status"])
if not task.get("outputs"):
raise ValueError("Task succeeded without image outputs")
Path("task.json").write_text(json.dumps(task))
print("Saved task.json")
PY4ดาวน์โหลดเอาต์พุต
เมื่อสำเร็จ ให้บันทึก outputs จาก task.json รองรับ URL HTTPS ออบเจ็กต์ URL และ b64_json ควรดาวน์โหลด URL ที่ลงนามโดยเร็ว การดาวน์โหลดภาพไม่ต้องใช้ API Key
python3 - <<'PY'
import base64, json
from pathlib import Path
from urllib.request import urlopen
task = json.loads(Path("task.json").read_text())
if task.get("status") != "succeeded" or not task.get("outputs"):
raise ValueError("No completed image outputs")
extensions = {"image/png": ".png", "image/jpeg": ".jpg", "image/webp": ".webp", "image/gif": ".gif", "image/avif": ".avif"}
for index, output in enumerate(task["outputs"], 1):
item = output if isinstance(output, dict) else {}
url = output if isinstance(output, str) else item.get("url") or item.get("unsigned_url")
mime = item.get("media_type") or "image/png"
if url and url.startswith("https://"):
with urlopen(url, timeout=60) as response:
data = response.read()
mime = response.headers.get_content_type()
elif url and url.startswith("data:image/") and ";base64," in url:
header, encoded = url.split(",", 1)
mime = header[5:].split(";", 1)[0]
data = base64.b64decode(encoded, validate=True)
elif item.get("b64_json"):
data = base64.b64decode(item["b64_json"], validate=True)
else:
raise ValueError("Unrecognized image output")
path = Path(f"image-{index}" + extensions.get(mime, ".bin"))
path.write_bytes(data)
print(path)
PYinput_references
หากต้องการแก้ไขภาพ ให้แทน URL ตัวอย่างด้วย URL ภาพ HTTPS หรือ data URL ภาพ base64 ของคุณ ส่งครั้งเดียวแล้วใช้ขั้นตอนตรวจสอบและบันทึกเดิม
curl --fail-with-body --max-time 60 "https://openapi.felo.ai/api/v1/images/generations" \
-H "Authorization: Bearer $FELO_API_KEY" \
-H "Content-Type: application/json" \
-o created.json \
-d '{
"prompt": "Keep the product and framing. Replace the background with a sunlit marble countertop.",
"model": "kling-4.0/image-generation",
"input_references": [
{
"type": "image_url",
"image_url": {
"url": "https://example.com/product.png"
}
}
]
}'พารามิเตอร์ที่รองรับ
- n
- prompt
- resolution
- aspect_ratio
- input_references
ต้องการเอกสารอ้างอิงฉบับเต็มหรือไม่
เอกสารอ้างอิง API →คำถามที่พบบ่อย
รู้จัก Kling Image 4.0?
Kling Image4.0 จาก Kling AI (Kuaishou) เป็นโมเดลสร้างภาพระดับมืออาชีพที่รองรับ text input, image input และ image output โดยสร้างภาพแบบ Native8K พร้อมรองรับเอาต์พุต2K และ4K นอกจากนี้ยังสร้างข้อความในภาพได้สูงสุด2,000 characters per image รองรับมากกว่า70 fonts และข้อความหลายภาษา เช่น English, Japanese, Korean, Spanish และ Portuguese โมเดลรองรับภาพอ้างอิงสูงสุด10 ภาพ เพื่อช่วยรักษาความสม่ำเสมอของบุคคล สินค้า และสถานที่ รวมถึงสร้างชุดภาพที่มีความต่อเนื่องได้สูงสุด10 ภาพ รองรับ long-form layouts และ9 aspect ratios จึงเหมาะกับงานโฆษณาสินค้า สื่อการตลาดที่ต้องคุมแบรนด์หรือบุคคล งานโปสเตอร์ ใบปลิว กราฟิกโซเชียลมีเดีย แคตตาล็อก และโบรชัวร์ อีกทั้งยังใช้ภาพเป็น keyframes หรือ reference materials สำหรับการสร้างวิดีโอด้วย Kling4.0 ได้
การใช้งานถูกเรียกเก็บเงินอย่างไร
ค่าใช้จ่ายขึ้นอยู่กับผู้ให้บริการที่คุณใช้ ราคาของผู้ให้บริการนั้น และปริมาณการใช้งาน อินพุตที่ยาวขึ้นหรือเงื่อนไขอื่นอาจมีราคาแตกต่างกัน
รองรับอินพุตและเอาต์พุตประเภทใดบ้าง
รองรับ text input, image input และ image output
สร้างข้อความในภาพได้ยาวแค่ไหน
สร้างข้อความได้สูงสุด2,000 characters per image และรองรับมากกว่า70 fonts รวมถึงหลายภาษา
ใช้ภาพอ้างอิงได้กี่ภาพ
ใช้ภาพอ้างอิงได้สูงสุด10 ภาพ เพื่อช่วยรักษาความสม่ำเสมอของบุคคล สินค้า และสถานที่
เหมาะกับงานประเภทใด
เหมาะกับโฆษณาสินค้า สื่อการตลาด โปสเตอร์ ใบปลิว กราฟิกโซเชียลมีเดีย แคตตาล็อก และโบรชัวร์
แตกต่างจากโมเดลในตระกูลเดียวกันอย่างไร
Kling Image4.0 เน้นการสร้างภาพระดับมืออาชีพด้วย Native8K ข้อความหลายภาษา และการคุมความสม่ำเสมอของภาพ ส่วน Kling4.0 เชื่อมโยงภาพกับการสร้างวิดีโอ และข้อมูลนี้ไม่มีรายละเอียดเพิ่มเติมเกี่ยวกับ Kling3.0