From kie-ai
Execution skill สำหรับ Kie.ai API (Grok Imagine ผ่าน kie.ai proxy) — รับ prompt จาก /art-tech-engineer แล้ว gen ภาพ/วีดีโอผ่าน Kie.ai REST API รองรับ text-to-image, image-to-image, image-to-video, และ upscale ใช้เมื่อถูกระบุให้ใช้ Kie.ai โดยตรง หรือเมื่อ orchestrator delegate มา
How this skill is triggered — by the user, by Claude, or both
Slash command
/kie-ai:kie-aiclaude-sonnet-4-20250514The summary Claude sees in its skill listing — used to decide when to auto-load this skill
Gen image/video ผ่าน Kie.ai REST API — proxy สำหรับ Grok Imagine models
Gen image/video ผ่าน Kie.ai REST API — proxy สำหรับ Grok Imagine models
ENV = D:/.env.shared # KIE_API_KEY อยู่ที่นี่
OUT = /mnt/d/ClaudeMediaGen/output-fal # ใช้ร่วมกับ fal output
BASE = https://api.kie.ai/api/v1/jobs
| Var | ที่อยู่ | วิธีอ่าน |
|---|---|---|
KIE_API_KEY | D:/.env.shared | อ่าน line ที่ขึ้นต้นด้วย KIE_API_KEY= แล้ว strip quotes |
| Model ID | Type | Best For | Output |
|---|---|---|---|
grok-imagine/text-to-image | text2img | Aesthetic/cinematic images, Thai prompt ได้ดี | 3 รูป/request |
grok-imagine/image-to-image | img2img | แก้ไข/ปรับ style จากรูปต้นแบบ | TBD |
grok-imagine/image-to-video | img2vid | สร้างวีดีโอจากรูปนิ่ง | TBD |
grok-imagine/upscale | upscale | เพิ่ม resolution วีดีโอ | TBD |
veo3_fast | video | Video fast, รองรับ i2v (REFERENCE_2_VIDEO) | video + audio |
veo3_quality | video | Video quality สูงสุด | video + audio |
veo3_lite | video | Video ประหยัดสุด | video + audio |
หมายเหตุ: text-to-image + veo3_fast ทดสอบแล้ว ใช้งานได้จริง / model อื่นๆ มีใน docs แต่ยังไม่ได้ทดสอบ Veo3 ใช้คนละ endpoint — ดู section "Veo3 Video Generation" และ "API Endpoints Summary" ด้านล่าง
| Value | ใช้เมื่อ |
|---|---|
2:3 | Portrait (default สำหรับรูปคน) |
3:2 | Landscape |
1:1 | Square |
16:9 | Wide cinematic |
9:16 | Story/Reels format |
POST {BASE}/createTask
Authorization: Bearer <KIE_API_KEY>
Content-Type: application/json
Body:
{
"model": "grok-imagine/text-to-image",
"input": {
"prompt": "...",
"aspect_ratio": "2:3"
}
}
Response: { "code": 200, "data": { "taskId": "..." } }
code == 200 ก่อน ถ้าไม่ใช่ = errortaskId ไว้ pollGET {BASE}/recordInfo?taskId=<taskId>
Authorization: Bearer <KIE_API_KEY>
Task States:
| State | ความหมาย | Action |
|---|---|---|
waiting | อยู่ในคิว | รอต่อ |
queuing | อยู่ในคิว | รอต่อ |
generating | กำลัง gen | รอต่อ |
success | เสร็จแล้ว | ดึง URL |
fail | ล้มเหลว | อ่าน failMsg + failCode |
Poll strategy: ทุก 5 วินาที, timeout 5 นาที (60 รอบ)
เมื่อ success:
data.resultJson เป็น JSON string → ต้อง parse อีกรอบresultUrls: [url1, url2, url3] — ได้ 3 รูปต่อ 1 requestสำคัญ: URL ต้องใส่ headers พิเศษ ไม่งั้นจะโดน block
Headers สำหรับ download:
User-Agent: Mozilla/5.0
Referer: https://kie.ai/
Naming convention:
kie_grok_{taskId_last8}_{index}.jpg
Output directory: D:/ClaudeMediaGen/output-fal/
| Rule | Detail |
|---|---|
| Hybrid prompt | English เป็นหลัก + Thai keywords สำหรับ identity/สถานที่ |
| ห้ามบอก body size | Grok จะ cartoon — ใช้ชุด + มุมกล้องแทน |
| Subject สั้น Scene ยาว | Face desc 1-2 ประโยค, scene/lighting 3-5 ประโยค |
| Negative makeup | "no blush, no foundation, bare skin" ใน prompt |
| Negative หน้าฝรั่ง | ไม่ต้องใส่ negative prompt (API ไม่รองรับ) — ใช้ Thai keywords anchor แทน |
| ห้าม flushed/หน้าแดง | ห้ามใช้ flushed, pink cheeks, burning red |
| Max prompt length | ยาวได้เต็มที่ ไม่มี limit ที่ทดสอบเจอ |
D:/.env.shared → หา line KIE_API_KEY= → strip quotes/createTask → เก็บ taskId/recordInfo?taskId= → วน loop ทุก 5s จนได้ success หรือ faildata.resultJson เป็น string → json.loads() → resultUrlsUser-Agent + Referer headers → save เป็น .jpgrun_in_background: true สำหรับ parallel gen ใน Claude Codecode != 200 จาก createTask → แสดง error ทั้ง responsestate == "fail" → อ่าน data.failMsg + data.failCodeใช้ upload ไฟล์ (เช่น รูปสำหรับ image-to-video) ก่อนส่ง gen
POST https://kieai.redpandaai.co/api/file-stream-upload
Authorization: Bearer <KIE_API_KEY>
Content-Type: multipart/form-data
Parameters:
file: (binary)
uploadPath: (string)
fileName: (string)
Response:
{
"success": true,
"data": {
"downloadUrl": "https://tempfile.redpandaai.co/..."
}
}
หมายเหตุ:
Veo3 ใช้คนละ endpoint กับ Market API (Grok Imagine) — ทั้ง generate และ poll
POST https://api.kie.ai/api/v1/veo/generate
Authorization: Bearer <KIE_API_KEY>
Content-Type: application/json
Body:
{
"prompt": "...",
"imageUrls": ["https://uploaded-url"],
"model": "veo3_fast",
"generationType": "REFERENCE_2_VIDEO",
"aspect_ratio": "9:16"
}
| Parameter | ค่า | หมายเหตุ |
|---|---|---|
model | veo3_fast, veo3_quality, veo3_lite | fast รองรับ i2v |
generationType | TEXT_2_VIDEO, REFERENCE_2_VIDEO | REFERENCE_2_VIDEO ใช้ได้เฉพาะ veo3_fast |
aspect_ratio | 16:9, 9:16, Auto | — |
imageUrls | array of URLs | ต้อง upload ก่อนผ่าน file-stream-upload |
Optional: enableTranslation, enableFallback, watermark, callBackUrl, seeds
GET https://api.kie.ai/api/v1/veo/record-info?taskId=<taskId>
Authorization: Bearer <KIE_API_KEY>
| Field | ค่า | ความหมาย |
|---|---|---|
successFlag | 0 | กำลัง generate |
successFlag | 1 | สำเร็จ |
successFlag | 2 | ล้มเหลว |
successFlag | 3 | ล้มเหลว |
data.response.resultUrls[]hasAudioList: [true])1. Upload image → POST file-stream-upload → ได้ downloadUrl
2. Generate → POST /veo/generate (ใส่ downloadUrl ใน imageUrls) → ได้ taskId
3. Poll → GET /veo/record-info?taskId= → วน loop จน successFlag != 0
4. Download → ดึง video จาก resultUrls[]
| Feature | Market API (Grok Imagine) | Veo3 API |
|---|---|---|
| Create task | POST /api/v1/jobs/createTask | POST /api/v1/veo/generate |
| Poll status | GET /api/v1/jobs/recordInfo | GET /api/v1/veo/record-info |
| File upload | POST kieai.redpandaai.co/api/file-stream-upload | (same) |
| Base URL | https://api.kie.ai | https://api.kie.ai |
npx claudepluginhub thepexcel/thepexcel-claude-plugins --plugin kie-aiProvides fal.ai image-to-video endpoints, motion keywords, prompts, and TypeScript/Python examples for Kling 2.5/2.6 Pro, MiniMax Hailuo, Luma Dream Machine, SVD. For portrait/product animation workflows.
Generates AI videos from text descriptions or images using Google Veo 3.1 (default) or OpenAI Sora. Supports dialogue/audio, reference images, image-to-video animation, and interactive requirement gathering.
Generates videos from text prompts or images, animates still images, and creates talking avatars from photos with audio using Kling AI models (VIDEO 3.0, Avatar 2.0, etc.). Handles multi-shot storyboards, character consistency, and prompt engineering.