cURL
curl --request POST \ --url https://api.electronhub.ai/v1/images/generations \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "model": "dall-e-3", "prompt": "<string>", "n": 1, "quality": "standard", "size": "1024x1024", "response_format": "url", "public": false }'
{ "created": 123, "data": [ { "url": "<string>", "b64_json": "<string>", "revised_prompt": "<string>" } ] }
Generate images using AI models
POST /images/generations
const response = await fetch('https://api.electronhub.ai/v1/images/generations', { method: 'POST', headers: { 'Authorization': 'Bearer YOUR_API_KEY', 'Content-Type': 'application/json' }, body: JSON.stringify({ prompt: 'A futuristic cityscape at sunset', model: 'dall-e-3', n: 1, size: '1024x1024', quality: 'hd' }) }); const data = await response.json(); console.log(data);
Enter your API key (starts with 'ek-')
Success
The response is of type object.
object