API Nano Banana: $0.01$0.04(ลด 75%)
เมนู
ImageGPT AI API

เอกสาร API

แปลงความคิดของคุณให้เป็นภาพและวิดีโอที่น่าทึ่งด้วยโมเดล AI อันทรงพลังของเรา

Image Generation API Playground โดยตรง

ทดสอบและสำรวจ Image Generation API ด้วยโมเดลและรูปแบบเอาต์พุตที่หลากหลาย

เลือกโมเดล

Endpoint

POSThttps://api.imagegpt.online/generate/text-image

Headers

Request Body

ตัวอย่างโค้ด

fetch('https://api.imagegpt.online/generate/text-image', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'x-api-key': 'YOUR_API_KEY'
  },
  body: JSON.stringify({
  "prompt": "Photorealistic portrait of the same person (keep his real face unchanged). A man with medium curly brown hair, light skin, and soft features sits relaxed, forearms on a light blue table, holding a small white puppy with a red collar. He wears a cozy color-block knitted sweater (beige, tan, light blue, black) with ribbed neck and cuffs, a silver watch, and a turquoise-beaded bracelet. Soft diffused lighting, smooth steel-blue background, slightly elevated front angle warm, intimate, digital photo",
  "width": 512,
  "height": 512,
  "model": "FLUX-SCHNELL",
  "outputType": "binary",
  "outputFormat": "png"
})
})
  .then(response => response.blob())
  .then(blob => {
    const imageUrl = URL.createObjectURL(blob);
    console.log('Image URL:', imageUrl);
    // Display in img tag: document.getElementById('myImg').src = imageUrl;
  })
  .catch(error => console.error('Error:', error));
เอกสาร API

API สร้างภาพ

REST API แบบรวมสำหรับสร้างภาพด้วย 15+ โมเดล AI — ข้อความเป็นภาพและภาพเป็นภาพ หลายรูปแบบ ระบบเครดิต

POSThttps://api.imagegpt.online/generate/text-image

คำขอทั้งหมดต้องมีคีย์ API ในส่วนหัว เก็บเป็นความลับ

http header
x-api-key: YOUR_API_KEY

คีย์ API ที่ขาดหายหรือไม่ถูกต้องส่งคืน 401 Unauthorized .

ส่ง JSON ด้วยฟิลด์:

พารามิเตอร์ประเภทค่าเริ่มต้นคำอธิบาย
model*
string—ID โมเดลสำหรับการสร้าง
prompt*
string—คำอธิบายภาพที่ต้องการสร้าง
width
number512ความกว้างภาพ (พิกเซล)
height
number512ความสูงภาพ (พิกเซล)
outputType
string"binary"รูปแบบ: "binary", "url" หรือ "base64"
outputFormat
string"png"ฟอร์แมตไฟล์: "png" หรือ "jpg"
image
string[]—อาร์เรย์ URL ภาพ (สูงสุด 3) สำหรับภาพเป็นภาพเท่านั้น

* ฟิลด์ที่จำเป็น

รูปร่างการตอบกลับขึ้นอยู่กับ outputType ที่เลือก:

binary

outputType: "binary"

js
const blob = await response.blob();
const url = URL.createObjectURL(blob);
url

outputType: "url"

json
{
  "success": true,
  "taskId": "imagegpt_img-...",
  "url": "https://...",
  "creditsDeducted": 3
}
base64

outputType: "base64"

json
{
  "success": true,
  "taskId": "imagegpt_img-...",
  "base64": "/9j/4QWm...",
  "creditsDeducted": 3
}

คำขอขั้นต่ำข้อความเป็นภาพผ่าน fetch API:

javascript
fetch('https://api.imagegpt.online/generate/text-image', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'x-api-key': 'YOUR_API_KEY'
  },
  body: JSON.stringify({
    model: 'FLUX-SCHNELL',
    prompt: 'A futuristic city at sunset, photorealistic',
    width: 512,
    height: 512,
    outputType: 'url',
    outputFormat: 'png'
  })
})
  .then(res => res.json())
  .then(data => console.log('Image URL:', data.url));

สำหรับภาพเป็นภาพ เพิ่ม image อาร์เรย์:

javascript
body: JSON.stringify({
  model: 'FLUX-KONTEXT',
  prompt: 'Same person, wearing a red jacket',
  image: ['https://example.com/input.jpg'],
  width: 512,
  height: 512,
  outputType: 'url',
  outputFormat: 'png'
})

เครดิตคิดต่อภาพที่สร้าง:

ประหยัด
3 เครดิต / ภาพ

โมเดลเบาๆ สำหรับร่าง

e.g. Flux Schnell, Z Image Turbo

มาตรฐาน
10–30 เครดิต / ภาพ

คุณภาพสมดุลสำหรับการใช้งานประจำวัน

e.g. GPT Image 1.0, Seedream, Nova Canvas

พรีเมียม
35–100 เครดิต / ภาพ

คุณภาพสูงสุดสำหรับงานผลิต

e.g. Nano Banana Pro, Seedream 4.0, Ideogram

ImageGPT ห้ามเนื้อหาที่สร้างโดย AI ที่ไม่เหมาะสมทางเพศ เนื้อหาสำหรับผู้ใหญ่ เนื้อหาที่ล่อลวง หลอกลวง หรือเป็นอันตราย การกลั่นกรองเนื้อหาจะถูกนำไปใช้กับรูปภาพและวิดีโอที่รองรับ