Transforme suas ideias em imagens e vídeos impressionantes com nossos modelos de IA poderosos
Teste e explore a API de Geração de Imagem com múltiplos modelos e formatos de saída
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));Uma API REST unificada para gerar imagens com 15+ modelos de IA — texto para imagem e imagem para imagem com múltiplos formatos, via endpoint único com preços por créditos.
https://api.imagegpt.online/generate/text-imageTodas as requisições devem incluir sua chave API no cabeçalho. Mantenha-a em segredo.
x-api-key: YOUR_API_KEYChave API ausente ou inválida retorna resposta 401 Unauthorized .
Envie um corpo JSON com os seguintes campos:
| Parâmetro | Tipo | Padrão | Descrição |
|---|---|---|---|
model* | string | — | ID do modelo para geração. |
prompt* | string | — | Descrição textual da imagem a gerar. |
width | number | 512 | Largura da imagem em pixels. |
height | number | 512 | Altura da imagem em pixels. |
outputType | string | "binary" | Formato de entrega: "binary", "url" ou "base64". |
outputFormat | string | "png" | Formato do arquivo: "png" ou "jpg". |
image | string[] | — | Array de URLs de imagens (máx 3). Apenas para imagem para imagem. |
* Campos obrigatórios.
A forma da resposta depende do outputType escolhido:
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
}Requisição mínima de texto para imagem com 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));Para imagem para imagem, adicione um image array:
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'
})Créditos cobrados por imagem gerada:
Modelos rápidos e leves para rascunhos.
e.g. Flux Schnell, Z Image Turbo
Qualidade equilibrada para uso diário.
e.g. GPT Image 1.0, Seedream, Nova Canvas
Máxima fidelidade para produção.
e.g. Nano Banana Pro, Seedream 4.0, Ideogram
O ImageGPT proíbe conteúdo NSFW, sexualmente explícito, adulto, exploratório, enganoso ou prejudicial gerado por IA. A moderação de conteúdo é aplicada à geração de imagens e vídeos suportados.