generor

เอกสาร Generor API

สร้างด้วยเครื่องมือสร้าง AI กว่า 93 รายการ — ข้อความ รูปภาพ วิดีโอ เสียง และอื่น ๆ

Base URL v1
https://generor.com/api/v1

REST API แบบรวมศูนย์สำหรับสร้าง เรียกดู และจัดการคอนเทนต์ AI ทุกคำขอใช้ JSON ยืนยันตัวตนด้วย Bearer token

การยืนยันตัวตน

ยืนยันตัวตนด้วย Bearer token ในส่วนหัว Authorization:

curl https://generor.com/api/v1/users/me \
  -H "Authorization: Bearer gnr_live_your_api_key_here"

คีย์ API เริ่มต้นด้วย gnr_live_ ตามด้วยอักขระเลขฐานสิบหก 40 ตัว สร้างคีย์ผ่าน เอนด์พอยต์คีย์ API หรือการตั้งค่าบัญชีของคุณ

บางเอนด์พอยต์ (การเรียกดูเครื่องมือสร้าง ผลงานสาธารณะ โมเดล) ทำงานได้โดยไม่ต้องยืนยันตัวตน เอนด์พอยต์ที่มีเครื่องหมาย AUTH จำเป็นต้องใช้คีย์ API ที่ถูกต้อง

ขอบเขต

คีย์ API สามารถกำหนดขอบเขตเพื่อจำกัดการเข้าถึงได้:

ขอบเขตอนุญาต
readคำขอ GET ไปยังทุกเอนด์พอยต์
writeการดำเนินการ POST, PATCH, DELETE (ความคิดเห็น การให้คะแนน การอัปเดตโปรไฟล์ ฯลฯ)
generateการสร้างเนื้อหา (มีค่าใช้เครดิต)

คีย์ที่ไม่ได้ระบุขอบเขตจะมีสิทธิ์เข้าถึงทั้งหมด

ขีดจำกัดอัตราการเรียกใช้

ขีดจำกัดคิดต่อ API key ทุกการตอบกลับมีส่วนหัวบอกขีดจำกัดอัตรา:

X-RateLimit-Limit: 30
X-RateLimit-Remaining: 28
X-RateLimit-Reset: 1708444860
X-RateLimit-Tier: free
ระดับต่อนาทีต่อชั่วโมงต่อวัน
free305005,000
basic602,00020,000
pro1205,00050,000
enterprise30020,000200,000

คำขอที่ไม่ได้ยืนยันตัวตนจำกัดที่ 15/นาทีต่อ IP เมื่อถูกจำกัดอัตรา คุณจะได้รับการตอบกลับ 429 พร้อมส่วนหัว Retry-After

รูปแบบการตอบกลับ

การตอบสนองทั้งหมดใช้รูปแบบ JSON envelope ที่สอดคล้องกัน:

สำเร็จ

{
  "success": true,
  "data": { ... },
  "meta": {
    "page": 1,
    "per_page": 20,
    "total": 142,
    "total_pages": 8,
    "has_next": true,
    "has_prev": false
  }
}

ข้อผิดพลาด

{
  "success": false,
  "error": {
    "code": "NOT_FOUND",
    "message": "Creation not found",
    "status": 404
  }
}

การแบ่งหน้า

เอนด์พอยต์รายการรองรับการแบ่งหน้าผ่านพารามิเตอร์ query:

พารามิเตอร์ค่าเริ่มต้นคำอธิบาย
page1หมายเลขหน้า (เริ่มจาก 1)
per_page20รายการต่อหน้า (สูงสุด 100)
sortnewestลำดับการเรียง: newest, oldest

เครื่องมือสร้าง

GET /generators

แสดงรายการเครื่องมือสร้างที่ใช้ได้ทั้งหมด

curl https://generor.com/api/v1/generators

พารามิเตอร์การสืบค้น: status (active, development, all)

การตอบกลับ: อาร์เรย์ของเครื่องสร้างพร้อม slug, title, description, icon และเครื่องสร้างที่คล้ายกัน

GET /generators/{slug}

รับข้อมูลโดยละเอียดเกี่ยวกับเครื่องมือสร้างที่ระบุ

curl https://generor.com/api/v1/generators/image

POST /generators/{slug}/estimate

ดูตัวอย่างค่าเครดิตและเวลาในการสร้างที่คาดไว้ ก่อน การเรียก /generate โครงสร้าง body เหมือนกับ /generate — แต่เป็นแบบอ่านอย่างเดียว: ไม่มีการหักเครดิต ไม่มีการบันทึกผลงาน นี่คือตัวเลขเดียวกันกับที่ UI แสดงข้าง ๆ ปุ่ม Generate

curl -X POST https://generor.com/api/v1/generators/horoscope/estimate \
  -H "Content-Type: application/json" \
  -d '{
    "model_id": 37,
    "count": 5,
    "parameters": {
      "zodiac-sign": "aries",
      "horoscope-length": "long"
    }
  }'

การตอบกลับ:

{
  "success": true,
  "data": {
    "generator": "horoscope",
    "model_id": 37,
    "model_type": "text",
    "model_name": "Gemini 3.5 Flash",
    "credit_cost": {
      "total": 15,             // after bulk discount
      "per_item": 3,           // model base × length/quality multipliers
      "count": 5,
      "discount": 0,           // credits saved
      "discount_percent": 5    // % off applied (count% off, capped at 10%)
    },
    "time_estimate": {
      "seconds": 50,           // total wall-clock estimate
      "per_item": 10,
      "min_seconds": 8,
      "max_seconds": 14,
      "sample_count": 10,      // recent generations averaged
      "has_historical": true,
      "source": "historical"   // or "fallback" when sample_count < 3
    },
    "applied_parameters": {    // what the API actually used (schema-filtered)
      "zodiac-sign": "aries",
      "horoscope-length": "long",
      "model-text": "3",
      "horoscope-count": "5"
    }
  }
}

เปิดให้ผู้เรียกที่ไม่ได้ยืนยันตัวตน — ราคา/เวลาเป็นข้อมูลสาธารณะและตรงกับที่หน้าตัวสร้างสาธารณะแสดง

ระยะเวลาวิดีโอที่ปรับให้ลงตัว

หากคุณส่งค่า seconds ที่ไม่อยู่ใน supported_durations ของโมเดล API จะปรับไปยังค่าที่รองรับที่ใกล้ที่สุด (หากเท่ากันจะเลือกค่าที่ต่ำกว่า) และแสดงการเปลี่ยนแปลงในบล็อก adjustments ค่าใช้จ่ายเครดิตและการประมาณเวลาในการตอบกลับเดียวกันจะสะท้อนค่าที่ปรับแล้ว — สิ่งที่ /generate จะทำจริง — ไม่ใช่คำขอเดิม

{
  "success": true,
  "data": {
    "credit_cost": { "total": 30, ... },
    "time_estimate": { "seconds": 60, ... },
    "adjustments": {
      "seconds": {
        "requested": 3,
        "used": 5,
        "supported": [5, 6, 7, 8, 10, 12, 15],
        "reason": "snapped to nearest provider-supported duration"
      }
    }
  }
}

เมื่อใดควรใช้

  • ตรวจสอบค่าใช้จ่ายล่วงหน้า — ยืนยันว่าผู้ใช้มีเครดิตเพียงพอสำหรับการสร้างก่อนเรียกเก็บเงิน
  • UI ความคืบหน้า — ป้อน time_estimate.seconds เข้าสู่แถบโหลดของคุณเพื่อให้ผู้ใช้รู้ว่าต้องรอนานเท่าใด
  • การปรับแต่งพารามิเตอร์ — เรียกใช้เมื่อผู้ใช้เปลี่ยนเมนูดรอปดาวน์ ค่าใช้จ่ายจะอัปเดตโดยไม่ต้องยืนยันการสร้าง

ความสัมพันธ์กับ /generate — /estimate เป็นการเรียก แยกต่างหาก, ไม่บังคับ /generate จะคืนค่า credit_cost จริงที่เรียกเก็บ + credits_remaining หลังจากนั้นอยู่แล้ว ดังนั้นหากคุณยินดีจ่ายตามราคาจริงในขณะนั้น คุณสามารถข้าม /estimate ไปได้ทั้งหมด

พรอมต์การผสานรวม (วางลงในผู้ช่วย AI ของคุณเมื่อตั้งค่า Generor):
Use the Generor API at https://generor.com/api/v1.

Before calling POST /generators/{slug}/generate, call
POST /generators/{slug}/estimate with the same body to get back:
  - credit_cost.total (credits the next generate call will charge)
  - time_estimate.seconds (expected wall-clock duration)

Show both to the user, then call /generate when they confirm.
The /generate response includes the real credit_cost charged and
credits_remaining — use those to update the user's balance.

Discover each generator's tweakable fields with GET /generators/{slug}
and pass them under the `parameters` object on both /estimate and
/generate (keys match the dropdown IDs you see on the public page).

POST /generators/{slug}/generate AUTH

สร้างเนื้อหาด้วย AI นี่คือการเรียกแบบซิงโครนัส — ผลตอบกลับจะคืนมาเมื่อการสร้างเสร็จสมบูรณ์ มีค่าใช้จ่ายเป็นเครดิตตามโมเดลที่เลือก การสร้างข้อความมักใช้เวลา 5-30 วินาที การสร้างรูปภาพ 10-60 วินาที และการสร้างวิดีโออาจใช้เวลาหลายนาที

# Text generation (joke with GPT 5 Nano)
curl -X POST https://generor.com/api/v1/generators/joke/generate \
  -H "Authorization: Bearer gnr_live_..." \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "Tell me a joke about programming",
    "model_id": 37
  }'

# Image generation (Flux Schnell, square)
curl -X POST https://generor.com/api/v1/generators/image/generate \
  -H "Authorization: Bearer gnr_live_..." \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "A sunset over mountains",
    "model_id": 10003,
    "aspect_ratio": 1
  }'

# Image description (vision — Qwen VL Max, image-only input, prompt is optional)
curl -X POST https://generor.com/api/v1/generators/vision/generate \
  -H "Authorization: Bearer gnr_live_..." \
  -H "Content-Type: application/json" \
  -d '{
    "model_id": 34,
    "image_url": "https://example.com/photo.jpg",
    "preference": "detailed"
  }'

# Video generation (Happy Horse 1.0 R2V — multi-reference, 6s, wide)
curl -X POST https://generor.com/api/v1/generators/video/generate \
  -H "Authorization: Bearer gnr_live_..." \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "The character from [Image1] walks through the forest from [Image2]",
    "model_id": 20050,
    "aspect_ratio": "16:9",
    "seconds": 6,
    "reference_images": [
      "https://example.com/character.jpg",
      "https://example.com/forest.jpg"
    ]
  }'

# Video generation (Happy Horse Video Edit — natural-language edit of an existing clip)
curl -X POST https://generor.com/api/v1/generators/video/generate \
  -H "Authorization: Bearer gnr_live_..." \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "Replace the sky with a stormy sunset",
    "model_id": 20051,
    "video_url": "https://example.com/source.mp4",
    "seconds": 5
  }'

เนื้อหาคำขอ:

ฟิลด์ประเภทจำเป็นคำอธิบาย
promptstringใช่พรอมต์การสร้าง (สูงสุด 10,000 อักขระ)
model_idintegerใช่รหัสโมเดล AI ข้อความ: 1-9999, รูปภาพ: 10001-19999, วิดีโอ: 20001-29999 ดู โมเดล
privacy_modeintegerไม่0 = public (default), 1 = private, 2 = team, 3 = unlisted.
team_idintegerไม่สร้างภายใต้ทีม
countintegerไม่จำนวนรายการ (1-10, ค่าเริ่มต้น 1)
languagestringไม่รหัสภาษาสำหรับการสร้างข้อความ (เช่น "en-US", "nb-NO") ค่าเริ่มต้น: "auto"
temperaturefloatไม่ความสร้างสรรค์ของ LLM (เฉพาะโมเดลข้อความ, 0.0-2.0)
preferencestring/intไม่การตั้งค่าเฉพาะเครื่องมือสร้าง (เช่น ประเภทมุกตลก รูปแบบบทกวี)
preference_twostring/intไม่การตั้งค่ารองเฉพาะเครื่องมือสร้าง
aspect_ratioint or stringไม่รองรับ ID ที่เป็นตัวเลข หรือสตริงอัตราส่วน/ชื่อ ภาพ: 1 / "1:1" / "square", 2 / "3:4" / "vertical", 3 / "4:3" / "horizontal", 4 / "16:9" / "wide", 5 / "9:16" / "tall". วิดีโอ: 1 / "16:9" / "wide", 2 / "9:16" / "tall". เคล็ดลับ: ใช้สตริงอัตราส่วนเช่น "16:9" แล้ว API จะแมปไปยัง ID ที่ถูกต้องสำหรับประเภทโมเดล
image_urlstringไม่URL ภาพอ้างอิงสำหรับ image-to-image, การถ่ายโอนสไตล์ หรือ image-to-video (I2V)
secondsintegerไม่ระยะเวลาวิดีโอเป็นวินาที (เฉพาะโมเดลวิดีโอ) ผู้ให้บริการแต่ละรายรับเฉพาะชุดค่าที่กำหนดไว้เท่านั้น — สอบถาม GET /models/video/{id} เพื่อดู supported_durations หากคุณส่งค่าที่ไม่รองรับ API จะปรับให้เป็นค่าที่รองรับที่ใกล้ที่สุดและรายงานการปรับใน adjustments.seconds ในการตอบกลับ
generate_audiobooleanไม่สวิตช์เสียงเนทีฟสำหรับ Veo 3.1 และ Seedance 1.5 Pro (วิดีโอ) โมเดลวิดีโออื่นจะฝังพฤติกรรมเสียงไว้และเพิกเฉยต่อแฟล็กนี้
ending_frame_urlstringไม่เฟรมยึดสุดท้ายสำหรับโมเดลที่รองรับการควบคุมเฟรมเริ่มต้น+สิ้นสุด (Veo 3.1, Wan 2.6 I2V, Seedance Pro Lite, Kling v3) จับคู่กับ image_url เพื่อการเปลี่ยนฉากหรือการวนซ้ำแบบไร้รอยต่อ
reference_imagesarray<string>ไม่URL รูปภาพอ้างอิงได้สูงสุด 9 รายการ รองรับโดย: Veo 3.1 (สูงสุด 3), Seedance 2.0 (สูงสุด 9), Happy Horse R2V (สูงสุด 9), Happy Horse Video Edit (สูงสุด 5) ลำดับจะถูกรักษาไว้และแสดงต่อโมเดลเป็น [Image1] … [ImageN] เมื่อพรอมต์อ้างอิงถึง
reference_videosarray<string>ไม่URL วิดีโออ้างอิงได้สูงสุด 3 รายการ ใช้โดย Seedance 2.0 (Replicate) และ Dreamina Seedance 2.0 (BytePlus direct) เพื่อความสอดคล้องของการเคลื่อนไหว/สไตล์
reference_audiostringไม่URL เสียงอ้างอิงเพื่อความต่อเนื่องของเพลง/เสียง ปัจจุบันใช้โดย Dreamina Seedance 2.0 (model 20060-20062, BytePlus direct)
video_urlstringไม่URL วิดีโอต้นฉบับ — จำเป็นสำหรับ Happy Horse Video Edit (โมเดล 20051) และใช้โดย Dreamina Seedance 2.0 (20060-20062) สำหรับโหมดแก้ไขวิดีโอ / ต่อขยายวิดีโอ
parametersobjectไม่ฟิลด์เฉพาะเครื่องมือสร้าง — เป็นดรอปดาวน์เดียวกับที่ frontend แสดง โดยใช้ DOM ID เป็นคีย์ ดู พารามิเตอร์ของเครื่องมือสร้าง ด้านล่าง คีย์ที่ไม่รู้จัก / ไม่ถูกต้องจะถูกตัดทิ้งโดยไม่แจ้งเตือน

พารามิเตอร์ของเครื่องมือสร้าง

ชุดฟิลด์ที่ปรับแต่งได้ทั้งหมดของแต่ละเครื่องสร้างอยู่ใน สคีมา เฉพาะของแต่ละเครื่องสร้าง (แหล่งเดียวกับที่ดรอปดาวน์บนเว็บไซต์และการเติมค่าผ่าน URL ใช้) ส่งฟิลด์ใดก็ได้เหล่านั้นในออบเจ็กต์ parameters ในคำขอสร้างเพื่อควบคุมแบบโปรแกรม

รับ schema ของเครื่องมือสร้างใด ๆ ที่ GET /generators/{slug} — อาร์เรย์ parameters ในการตอบกลับจะแสดงแต่ละฟิลด์พร้อม id, type (enum, number หรือ model), options (หรือ min/max), default และ cost_multipliers

# 1) Discover the parameters for the horoscope generator
curl https://generor.com/api/v1/generators/horoscope

# 2) Pass them on the generate call
curl -X POST https://generor.com/api/v1/generators/horoscope/generate \
  -H "Authorization: Bearer gnr_live_..." \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "Aries weekly reading",
    "model_id": 37,
    "parameters": {
      "zodiac-sign": "aries",
      "horoscope-timeframe": "weekly",
      "horoscope-tone": "mystical",
      "horoscope-length": "long",
      "horoscope-focus": "career"
    }
  }'

# Image example — every dropdown in the UI is a key here
curl -X POST https://generor.com/api/v1/generators/wallart/generate \
  -H "Authorization: Bearer gnr_live_..." \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "Calm mountain lake at dawn",
    "model_id": 10003,
    "parameters": {
      "wallart-type": "framed-print",
      "wallart-orientation": "landscape",
      "image-aspect-ratio": "4"
    }
  }'
ทำไมต้องมี discovery endpoint? แพลตฟอร์มมีเครื่องสร้างมากกว่า 100 ตัว แต่ละตัวมีการตั้งค่าของตัวเอง แทนที่จะตรึงไว้ในข้อกำหนด API คุณจะดึงสคีมาแบบสดสำหรับเครื่องสร้างที่คุณกำลังพัฒนา และ API จะสะท้อนเมนูแบบเลื่อนลงที่คุณเห็นบนหน้าสาธารณะอย่างแม่นยำ

ช่องการสร้างข้อความเพิ่มเติม

สำหรับเครื่องมือสร้างข้อความ (model_id 1-9999) ฟิลด์ระดับบนสุดเหล่านี้จะถูกส่งต่อไปยังปลายทาง LLM เมื่อเกี่ยวข้อง:

ฟิลด์ประเภทคำอธิบาย
user_textstringข้อความเสริมแบบอิสระ (เช่น เนื้อหาต้นฉบับที่จะสรุป / แปลง)
user_text_twostringข้อความเสริมรอง (ใช้โดยเครื่องมือสร้างที่มีช่องป้อนข้อความสองช่อง)
avoid_duplicatesbooleanเอนเอียงโมเดลไปทางผลลัพธ์ที่แปลกใหม่ตลอดทั้งชุด
thinking_modestringสำหรับโมเดลที่รองรับการให้เหตุผล: off, on, หรือ high
story_contextstringเรื่องราวต้นฉบับที่ส่งไปยัง story, story-part และ storyboard เพื่อเขียนฉากให้สอดคล้องกับแบรนด์
character_context / character_name / character_idstring / intความต่อเนื่องของตัวละครสำหรับสตอรีบอร์ด ส่วนของเรื่อง และผลงานต่อเนื่อง
support_forintegerID ผลงานต้นทาง — เชื่อมโยงการสร้างนี้เป็นผลงานลูก / ผลงานคู่
modestringสลับโหมดเฉพาะเครื่องมือสร้าง (เช่น เฟสของเกม)
model_speechintegerโมเดลเสียงพูดที่จะจับคู่กับข้อความที่สร้างขึ้น (ใช้สำหรับดูดวงแบบบรรยาย พอดแคสต์ ฯลฯ)
item_index / total_countintegerคำแนะนำการสร้างแบบเรียงลำดับ (ใช้เมื่อสร้างรายการตามลำดับ เช่น ขั้นตอนการแก้ปัญหา)
translation_of / source_languageinteger / stringแปลผลงานที่มีอยู่แทนการสร้างใหม่ตั้งแต่ต้น

การตอบกลับ (201 Created) — ตัวอย่างเครื่องมือสร้างข้อความ:

{
  "success": true,
  "data": {
    "generator": "joke",
    "model_id": 37,
    "model_type": "text",
    "model_name": "Gemini 3.5 Flash",
    "creations": [
      {
        "creation_id": 6144,
        "text": "Why do programmers prefer dark mode? Because light attracts bugs!",
        "illustration_desc": "a minimalist bug icon on a dark background"
      }
    ],
    "credit_cost": 1,
    "credit_cost_estimated": 1,
    "credits_remaining": 36024,
    "time_taken_seconds": 4.18
  }
}

การตอบกลับ (201 Created) — ตัวอย่างเครื่องมือสร้างรูปภาพ:

{
  "success": true,
  "data": {
    "generator": "image",
    "model_id": 10003,
    "model_type": "image",
    "model_name": "black-forest-labs/flux-schnell",
    "creations": [
      {
        "creation_id": 6147,
        "image_url": "https://generor.com/users/2/img/image-6147.webp"
      }
    ],
    "credit_cost": 24,
    "credit_cost_estimated": 6,
    "credits_remaining": 35998,
    "time_taken_seconds": 23.7
  }
}

ระยะเวลาวิดีโอที่ปรับให้ลงตัว — หาก seconds ของผู้เรียกไม่อยู่ใน supported_durations ของโมเดล API จะปรับไปยังค่าที่รองรับใกล้เคียงที่สุดก่อนเรียกผู้ให้บริการ และเพิ่มบล็อก adjustments.seconds ในการตอบกลับซึ่งมีรูปแบบเหมือนกับที่อยู่บน /estimate วิธีนี้ป้องกันไม่ให้ผู้ให้บริการตั้งค่าเริ่มต้นแทนค่าที่ไม่รองรับโดยเงียบ ๆ

ช่องค่าใช้จ่ายทำงานอย่างไร

  • credit_cost — จำนวน จริง ที่ถูกหัก คำนวณเป็น balance_before − balance_after นี่คือแหล่งข้อมูลที่เชื่อถือได้: ใช้สำหรับการบันทึก การเรียกเก็บเงิน และการอัปเดตยอดคงเหลือของผู้ใช้
  • credit_cost_estimated — ค่าประมาณจากแคตตาล็อกล่วงหน้า (ตัวเลขเดียวกับที่ /estimate คาดการณ์ไว้) รวมไว้เพื่อความโปร่งใสและการตรวจสอบความคลาดเคลื่อน มักแตกต่างจาก credit_cost สำหรับวิดีโอ / ต่อวินาที / ต่ออักขระ ที่ค่าใช้จ่ายจริงคำนวณภายในการเรียกผู้ให้บริการ
  • time_taken_seconds — ระยะเวลาตามนาฬิกาจริง เปรียบเทียบกับ time_estimate.seconds จาก /estimate เพื่อตรวจสอบการคาดการณ์เวลาในอดีต
หมายเหตุ: ผลงานข้อความจะส่งคืนฟิลด์เฉพาะของเครื่องสร้าง (เช่น text, illustration_desc สำหรับมุกตลก; dish_name, ingredients สำหรับสูตรอาหาร) ใช้ GET /creations/{id} เพื่อดึงข้อมูลผลงานฉบับเต็มในภายหลัง

ผลงาน

GET /creations AUTH

แสดงรายการผลงานของคุณเอง

curl https://generor.com/api/v1/creations \
  -H "Authorization: Bearer gnr_live_..."

พารามิเตอร์การสืบค้น: generator (กรองตาม slug), page, per_page, sort

GET /creations/{id}

รับผลงานชิ้นเดียวพร้อมรายละเอียดเต็ม ภาพ และข้อมูลเฉพาะเครื่องมือสร้าง

curl https://generor.com/api/v1/creations/12345

ต้องยืนยันตัวตนในฐานะเจ้าของผลงาน หรือเป็นสมาชิกของทีมที่แชร์ผลงานนี้ด้วย

การตอบกลับประกอบด้วย:

{
  "success": true,
  "data": {
    "creation_id": 12345,
    "generator": "image",
    "user_id": 42,
    "username": "johndoe",
    "prompt": "A sunset over mountains",
    "created_at": "2026-02-20 12:00:00",
    "privacy_mode": 1,
    "type": "img",
    "license": 1,
    "images": [
      {
        "url": "/users/42/img/image-12345.png",
        "width": 1024,
        "height": 1024
      }
    ],
    "generator_data": { ... }
  }
}

GET /creations/{id}/status AUTH

ตรวจสอบสถานะการสร้างของผลงาน (มีประโยชน์หากคุณกำลังติดตามบันทึกการสร้าง)

curl https://generor.com/api/v1/creations/12345/status \
  -H "Authorization: Bearer gnr_live_..."

ค่าสถานะ: pending, generating, completed, failed, cancelled

PATCH /creations/{id} AUTH

อัปเดตผลงานที่คุณเป็นเจ้าของ

curl -X PATCH https://generor.com/api/v1/creations/12345 \
  -H "Authorization: Bearer gnr_live_..." \
  -H "Content-Type: application/json" \
  -d '{"privacy_mode": 1, "license": 2}'
ฟิลด์ค่านิยม
privacy_mode0 (public), 1 (private), 3 (unlisted)
licenseเลิกใช้งานแล้ว — ยังคงรับค่านี้เพื่อความเข้ากันได้แบบย้อนหลังแต่จะถูกละเว้น ผู้สร้างสรรค์ยังคงไว้ซึ่งสิทธิ์ทั้งหมดในผลงานของตน ดูที่ /license

DELETE /creations/{id} AUTH

ลบผลงานที่คุณเป็นเจ้าของ (ลบแบบนุ่มนวล)

curl -X DELETE https://generor.com/api/v1/creations/12345 \
  -H "Authorization: Bearer gnr_live_..."

โมเดล

GET /models

แสดงรายการโมเดล AI ที่ใช้ได้ทั้งหมดโดยจัดกลุ่มตามประเภท

curl https://generor.com/api/v1/models

GET /models/{type}

แสดงรายการโมเดลสำหรับประเภทที่ระบุ

curl https://generor.com/api/v1/models/image

ประเภทที่ถูกต้อง: text, image, video, speech, music, soundeffect, upscale, vector, backgroundremoval

การตอบกลับต่อโมเดล:

{
  "id": 10001,
  "name": "Flux 1.1 Pro",
  "type": "image",
  "provider": "replicate",
  "description": "High-quality image generation...",
  "credit_cost": 80,
  "supports_img2img": true,
  "supports_aspect_ratio": true
}

โมเดลวิดีโอ รวมโครงสร้างความสามารถของผู้ให้บริการแบบเต็มเพิ่มเติม:

{
  "id": 20061,
  "name": "Dreamina Seedance 2.0 (720p)",
  "type": "video",
  "provider": "byteplus",
  "credit_cost": 6,

  // Duration constraints
  "supported_durations": [5, 6, 7, 8, 10, 12, 15],
  "default_duration": 8,

  // Audio toggle
  "supports_audio": true,
  "audio_cost_multiplier": 1,

  // End-frame anchoring (pass `ending_frame_url` on /generate)
  "supports_end_frame": true,

  // Resolution variants — same model at different qualities lives at
  // different model_ids. Switch quality by picking the matching id.
  "quality": "720p",
  "default_quality": "720p",
  "qualities": { "480p": 20060, "720p": 20061, "1080p": 20062 },
  "group_slug": "dreamina-seedance-2-direct",
  "group_name": "Dreamina Seedance 2.0",

  // Aspect ratios accepted on /generate
  "supports_aspect_ratio": true,
  "aspect_ratios": [
    { "id": 1, "ratio": "16:9", "label": "Wide" },
    { "id": 2, "ratio": "9:16", "label": "Tall" }
  ]
}

โมเดลภาพ ที่แตกต่างกันตามอัตราส่วนภาพจะมีอาร์เรย์ aspect_ratios ที่เทียบเท่า (ฝั่งรูปภาพมี 6 รายการ: สี่เหลี่ยมจัตุรัส, แนวตั้ง, แนวนอน, กว้าง, สูง, รวมถึง match_input_image สำหรับโหมด img2img)

วิธีใช้ช่องเหล่านี้

  • supported_durations — ส่งค่าใดก็ได้ที่นี่ผ่าน seconds ค่าที่ไม่รองรับจะถูกปรับฝั่งเซิร์ฟเวอร์และรายงานภายใต้ adjustments.seconds
  • qualities — หากต้องการเปลี่ยนความละเอียด ให้ค้นหา model_id สำหรับความละเอียดที่คุณต้องการแล้วส่งค่านั้นเป็น model_id ของคุณ (ความละเอียดเป็นโมเดลในกลุ่มเดียวกัน ไม่ใช่พารามิเตอร์ขณะรันไทม์)
  • supports_audio — เมื่อ true คุณสามารถส่ง "generate_audio": true ตอน /generate ได้ เมื่อ false แฟล็กนี้จะถูกละเว้น
  • supports_end_frame — เมื่อ true คุณสามารถจับคู่ image_url (เฟรมเริ่มต้น) กับ ending_frame_url เพื่อการเปลี่ยนผ่านหรือลูปที่ราบรื่นได้
  • aspect_ratios — ส่ง id (จำนวนเต็ม) หรือ ratio (สตริง) ภายใต้ฟิลด์ aspect_ratio บน /generate ใช้ได้ทั้งสองรูปแบบ
ช่วง Model ID: ข้อความ (1-9999), รูปภาพ (10001-19999), วิดีโอ (20001-29999), เสียงพูด (30001-39999), เพลง (40001-49999), เสียงประกอบ (50001-59999)

GET /models/{type}/{id}

รับรายละเอียดและราคาของโมเดลที่ระบุ

curl https://generor.com/api/v1/models/image/10001

ผู้ใช้

GET /users/me AUTH

รับโปรไฟล์ ยอดเครดิตคงเหลือ และสถิติของคุณ

curl https://generor.com/api/v1/users/me \
  -H "Authorization: Bearer gnr_live_..."

การตอบกลับ:

{
  "success": true,
  "data": {
    "user_id": 42,
    "username": "johndoe",
    "email": "[email protected]",
    "avatar": null,
    "bio": "I make things with AI",
    "website": "https://example.com",
    "joined": "2025-01-15 10:30:00",
    "credits": {
      "total": 1250,
      "paid": 1000,
      "free": 200,
      "earned": 50,
      "max": 250
    },
    "creation_count": 347,
    "follower_count": 12,
    "following_count": 5,
    "teams": [...]
  }
}

PATCH /users/me AUTH

อัปเดตโปรไฟล์ของคุณ

curl -X PATCH https://generor.com/api/v1/users/me \
  -H "Authorization: Bearer gnr_live_..." \
  -H "Content-Type: application/json" \
  -d '{"bio": "Updated bio", "website": "https://example.com"}'

GET /users/{username}

รับโปรไฟล์สาธารณะของผู้ใช้

curl https://generor.com/api/v1/users/johndoe

GET /users/{username}/followers

แสดงรายชื่อผู้ติดตามของผู้ใช้ รองรับการแบ่งหน้า

GET /users/{username}/following

แสดงรายชื่อผู้ที่ผู้ใช้ติดตาม รองรับการแบ่งหน้า

POST /users/{username}/follow AUTH

ติดตามผู้ใช้

curl -X POST https://generor.com/api/v1/users/johndoe/follow \
  -H "Authorization: Bearer gnr_live_..."

DELETE /users/{username}/follow AUTH

เลิกติดตามผู้ใช้

GET /users/{username}/follow AUTH

ตรวจสอบว่าคุณติดตามผู้ใช้หรือไม่ ส่งคืน {"following": true/false}

ทีม

เอนด์พอยต์ของทีมทั้งหมดต้องมีการยืนยันตัวตน

GET /teams AUTH

แสดงรายการทีมของคุณ

POST /teams AUTH

สร้างทีมใหม่

curl -X POST https://generor.com/api/v1/teams \
  -H "Authorization: Bearer gnr_live_..." \
  -H "Content-Type: application/json" \
  -d '{"name": "My Creative Team"}'

GET /teams/{id} AUTH

รับรายละเอียดทีมพร้อมรายชื่อสมาชิก

DELETE /teams/{id} AUTH

ออกจากทีม

POST /teams/{id}/members AUTH

เพิ่มสมาชิกด้วยชื่อผู้ใช้: {"username": "janedoe"}

DELETE /teams/{id}/members/{user_id} AUTH

ลบสมาชิกทีม (เฉพาะเจ้าของ)

POST /teams/join/{invite_code} AUTH

เข้าร่วมทีมด้วยรหัสเชิญ

POST /teams/{id}/invite AUTH

สร้างรหัสเชิญใหม่ (เฉพาะเจ้าของ)

GET /teams/{id}/creations AUTH

แสดงรายการผลงานของทีม รองรับการแบ่งหน้า

ความคิดเห็น

GET /creations/{id}/comments

แสดงรายการความคิดเห็นบนผลงาน รองรับการแบ่งหน้า

curl https://generor.com/api/v1/creations/12345/comments

POST /creations/{id}/comments AUTH

เพิ่มความคิดเห็น

curl -X POST https://generor.com/api/v1/creations/12345/comments \
  -H "Authorization: Bearer gnr_live_..." \
  -H "Content-Type: application/json" \
  -d '{"text": "Great creation!", "parent_id": null}'

DELETE /comments/{id} AUTH

ลบความคิดเห็นของคุณเอง

POST /comments/{id}/vote AUTH

โหวตความคิดเห็น: {"vote": "up"} หรือ {"vote": "down"}

คะแนน

GET /creations/{id}/rating

รับคะแนนเฉลี่ยของผลงาน

// Response:
{"success": true, "data": {"creation_id": 12345, "average": 4.2, "count": 15}}

POST /creations/{id}/rating AUTH

ให้คะแนนผลงาน (1-5) จะอัปเดตคะแนนเดิมหากเคยให้คะแนนแล้ว

curl -X POST https://generor.com/api/v1/creations/12345/rating \
  -H "Authorization: Bearer gnr_live_..." \
  -H "Content-Type: application/json" \
  -d '{"score": 5}'

เครดิต

เครดิตคือระบบการชำระเงินที่ใช้สำหรับการสร้างด้วย AI กำหนดมูลค่าเป็น USD

GET /credits/balance AUTH

รับยอดเครดิตคงเหลือปัจจุบันของคุณ

curl https://generor.com/api/v1/credits/balance \
  -H "Authorization: Bearer gnr_live_..."
// Response:
{
  "success": true,
  "data": {
    "total": 1250,
    "paid": 1000,
    "free": 200,
    "earned": 50,
    "max": 250
  }
}

GET /credits/transactions AUTH

รับประวัติธุรกรรมเครดิต

curl "https://generor.com/api/v1/credits/transactions?type=spend&page=1" \
  -H "Authorization: Bearer gnr_live_..."

พารามิเตอร์การสืบค้น: type (spend, purchase, daily_bonus, weekly_bonus, signup_bonus, refund, gift_sent, gift_received), page, per_page

คีย์ API

จัดการคีย์ API ของคุณเองผ่านโปรแกรม ทุกเอ็นด์พอยต์ต้องมีการยืนยันตัวตน

GET /api-keys AUTH

แสดงรายการ API key ของคุณ (แสดงคำนำหน้า ไม่ใช่คีย์เต็ม)

POST /api-keys AUTH

สร้าง API key ใหม่ คีย์แบบเต็มจะแสดง เพียงครั้งเดียว ในการตอบกลับ

curl -X POST https://generor.com/api/v1/api-keys \
  -H "Authorization: Bearer gnr_live_..." \
  -H "Content-Type: application/json" \
  -d '{"name": "My App", "scopes": ["read", "generate"]}'
// Response (201):
{
  "success": true,
  "data": {
    "key_id": 1,
    "api_key": "gnr_live_a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6q7r8s9t0",
    "prefix": "gnr_live_a1b2c3d4",
    "name": "My App",
    "scopes": ["read", "generate"],
    "message": "Save this API key now. It will not be shown again."
  }
}

สูงสุด 10 คีย์ที่ใช้งานอยู่ต่อบัญชี

DELETE /api-keys/{id} AUTH

เพิกถอน API key (ปิดการใช้งานทันที)

รหัสข้อผิดพลาด

โค้ดสถานะ HTTPคำอธิบาย
UNAUTHORIZED401ไม่พบหรือ API key ไม่ถูกต้อง
FORBIDDEN403คีย์ถูกต้องแต่สิทธิ์หรือสโคปไม่เพียงพอ
NOT_FOUND404ไม่พบทรัพยากร
METHOD_NOT_ALLOWED405ไม่รองรับเมธอด HTTP สำหรับเอนด์พอยต์นี้
VALIDATION_ERROR400พารามิเตอร์ที่ป้อนไม่ถูกต้อง
INSUFFICIENT_CREDITS402เครดิตไม่เพียงพอสำหรับการสร้าง
RATE_LIMIT_EXCEEDED429คำขอมากเกินไป ตรวจสอบส่วนหัว Retry-After
SERVER_ERROR500เกิดข้อผิดพลาดภายในเซิร์ฟเวอร์

MCP setup

Connect an AI assistant to Generor with the local PHP MCP server. It supports generator discovery, models, cost estimates, generation, credit balance, and your creations.

Install the MCP package dependencies with Composer in the mcp directory. Requires PHP 8.2 or newer with the cURL and fileinfo extensions.

cd mcp
composer install --no-dev

Add Generor to your MCP client configuration. Replace the path with the location of your local checkout and use your own API key from account settings.

{
  "mcpServers": {
    "generor": {
      "command": "php",
      "args": ["/absolute/path/to/generor/mcp/server.php"],
      "env": {
        "GENEROR_API_KEY": "YOUR_GENEROR_API_KEY"
      }
    }
  }
}

Connect by URL

For MCP clients that support API-key headers, connect to the URL below and send your key in the Authorization header. Keep the trailing slash in the URL.

https://generor.com/mcp/
Authorization: Bearer YOUR_GENEROR_API_KEY

Hosted access uses API keys. Browser OAuth sign-in is not available yet. Keep your API key private; generation requires the generate scope and spends your account credits.

Estimate costs before generating. Long generations may take up to 16 minutes; configure your client timeout accordingly. After a timeout, check your creations before retrying because the generation may still complete and spend credits.