Generate Images
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
}
'import requests
url = "https://api.electronhub.ai/v1/images/generations"
payload = {
"model": "dall-e-3",
"prompt": "<string>",
"n": 1,
"quality": "standard",
"size": "1024x1024",
"response_format": "url",
"public": False
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: 'dall-e-3',
prompt: '<string>',
n: 1,
quality: 'standard',
size: '1024x1024',
response_format: 'url',
public: false
})
};
fetch('https://api.electronhub.ai/v1/images/generations', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.electronhub.ai/v1/images/generations",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'model' => 'dall-e-3',
'prompt' => '<string>',
'n' => 1,
'quality' => 'standard',
'size' => '1024x1024',
'response_format' => 'url',
'public' => false
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.electronhub.ai/v1/images/generations"
payload := strings.NewReader("{\n \"model\": \"dall-e-3\",\n \"prompt\": \"<string>\",\n \"n\": 1,\n \"quality\": \"standard\",\n \"size\": \"1024x1024\",\n \"response_format\": \"url\",\n \"public\": false\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.electronhub.ai/v1/images/generations")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"dall-e-3\",\n \"prompt\": \"<string>\",\n \"n\": 1,\n \"quality\": \"standard\",\n \"size\": \"1024x1024\",\n \"response_format\": \"url\",\n \"public\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.electronhub.ai/v1/images/generations")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"dall-e-3\",\n \"prompt\": \"<string>\",\n \"n\": 1,\n \"quality\": \"standard\",\n \"size\": \"1024x1024\",\n \"response_format\": \"url\",\n \"public\": false\n}"
response = http.request(request)
puts response.read_body{
"created": 123,
"data": [
{
"url": "<string>",
"b64_json": "<string>",
"revised_prompt": "<string>"
}
]
}Images
Image Generations
Generate images using AI models
POST
/
images
/
generations
Generate Images
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
}
'import requests
url = "https://api.electronhub.ai/v1/images/generations"
payload = {
"model": "dall-e-3",
"prompt": "<string>",
"n": 1,
"quality": "standard",
"size": "1024x1024",
"response_format": "url",
"public": False
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: 'dall-e-3',
prompt: '<string>',
n: 1,
quality: 'standard',
size: '1024x1024',
response_format: 'url',
public: false
})
};
fetch('https://api.electronhub.ai/v1/images/generations', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.electronhub.ai/v1/images/generations",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'model' => 'dall-e-3',
'prompt' => '<string>',
'n' => 1,
'quality' => 'standard',
'size' => '1024x1024',
'response_format' => 'url',
'public' => false
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.electronhub.ai/v1/images/generations"
payload := strings.NewReader("{\n \"model\": \"dall-e-3\",\n \"prompt\": \"<string>\",\n \"n\": 1,\n \"quality\": \"standard\",\n \"size\": \"1024x1024\",\n \"response_format\": \"url\",\n \"public\": false\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.electronhub.ai/v1/images/generations")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"dall-e-3\",\n \"prompt\": \"<string>\",\n \"n\": 1,\n \"quality\": \"standard\",\n \"size\": \"1024x1024\",\n \"response_format\": \"url\",\n \"public\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.electronhub.ai/v1/images/generations")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"dall-e-3\",\n \"prompt\": \"<string>\",\n \"n\": 1,\n \"quality\": \"standard\",\n \"size\": \"1024x1024\",\n \"response_format\": \"url\",\n \"public\": false\n}"
response = http.request(request)
puts response.read_body{
"created": 123,
"data": [
{
"url": "<string>",
"b64_json": "<string>",
"revised_prompt": "<string>"
}
]
}Create original images using AI models like DALL-E.
Generate Images
POST /images/generations
Generate images from text descriptions.
Request Body
string
required
A text description of the desired image(s)
string
The model to use for image generation (e.g., “dall-e-3”, “dall-e-2”)
integer
Number of images to generate (1-10 for dall-e-2, 1 for dall-e-3)
string
Size of the generated images (“256x256”, “512x512”, “1024x1024”, “1792x1024”, “1024x1792”)
string
Quality of the image (“standard” or “hd”)
string
Style of the generated images (“vivid” or “natural”)
string
Format of the generated images (“url” or “b64_json”)
Response
Returns an array of image objects with URLs or base64-encoded images.Example
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);
import requests
response = requests.post(
'https://api.electronhub.ai/v1/images/generations',
headers={
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
json={
'prompt': 'A futuristic cityscape at sunset',
'model': 'dall-e-3',
'n': 1,
'size': '1024x1024',
'quality': 'hd'
}
)
print(response.json())
curl -X POST "https://api.electronhub.ai/v1/images/generations" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "A futuristic cityscape at sunset",
"model": "dall-e-3",
"n": 1,
"size": "1024x1024",
"quality": "hd"
}'
Authorizations
Enter your API key (starts with 'ek-')
Body
application/json
Example:
"dall-e-3"
Text description of the desired image
Number of images to generate
Required range:
1 <= x <= 10Available options:
standard, hd Available options:
256x256, 512x512, 1024x1024, 1792x1024, 1024x1792 Available options:
url, b64_json Whether to make the image publicly accessible
