強力なAIモデルでアイデアを素晴らしい画像や動画に変換
複数のモデルと出力フォーマットで画像生成APIをテスト・探索
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));15以上のAIモデルを使用して画像を生成する統合REST API — テキストから画像、画像から画像の生成を複数の出力形式でサポート、クレジットベースの料金体系で単一エンドポイントから利用可能。
https://api.imagegpt.online/generate/text-imageすべてのリクエストにはAPIキーをリクエストヘッダーに含める必要があります。APIキーは秘密にし、本番環境のクライアントサイドコードに公開しないでください。
x-api-key: YOUR_API_KEYAPIキーが欠落または無効な場合、 401 Unauthorized レスポンスが返されます。
以下のフィールドを含むJSONボディを送信してください:
| パラメータ | 型 | デフォルト | 説明 |
|---|---|---|---|
model* | string | — | 生成に使用するモデルID。利用可能な全IDについては上記のモデルリストを参照。 |
prompt* | string | — | 生成したい画像のテキスト説明。 |
width | number | 512 | 出力画像の幅(ピクセル)。 |
height | number | 512 | 出力画像の高さ(ピクセル)。 |
outputType | string | "binary" | 出力配信形式。"binary"(画像blob)、"url"(ホストされたリンク)、"base64"(エンコード文字列)のいずれか。 |
outputFormat | string | "png" | 画像ファイル形式。"png"または"jpg"。 |
image | string[] | — | 入力画像URLの配列(最大3)。画像から画像生成の場合のみ必須。 |
* 必須フィールド。
レスポンスの形状は選択した outputType に依存します:
outputType: "binary"
const blob = await response.blob();
const url = URL.createObjectURL(blob);outputType: "url"
{
"success": true,
"taskId": "imagegpt_img-...",
"url": "https://...",
"creditsDeducted": 3
}outputType: "base64"
{
"success": true,
"taskId": "imagegpt_img-...",
"base64": "/9j/4QWm...",
"creditsDeducted": 3
}fetch APIを使用した最小限のテキストから画像リクエスト:
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 配列を追加:
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'
})クレジットは生成された画像ごとに課金されます。各モデルの横のバッジはクレジットコストを示しています:
下書きやプロトタイプに最適な高速軽量モデル。
e.g. Flux Schnell、Z Image Turbo
日常の生成タスクにバランスの取れた品質。
e.g. GPT Image 1.0、Seedream、Nova Canvas
本番品質の出力に最高の忠実度。
e.g. Nano Banana Pro、Seedream 4.0、Ideogram
ImageGPTはNSFW、性的に露骨なコンテンツ、成人向けコンテンツ、搾取的・欺瞞的・有害なAI生成コンテンツを禁止しています。対応する画像・動画生成にはコンテンツモデレーションが適用されます。