Skip to main content
POST
/
deployments
/
{deploymentId}
/
images
/
generations
Generates a batch of images from a text caption on a given DALLE model deployment
curl --request POST \
  --url https://api.hicap.ai/v1/deployments/{deploymentId}/images/generations \
  --header 'Content-Type: application/json' \
  --header 'api-key: <api-key>' \
  --data '
{
  "prompt": "a corgi in a field",
  "n": 1,
  "size": "1024x1024",
  "response_format": "url",
  "user": "user123456",
  "quality": "standard",
  "style": "vivid"
}
'
import requests

url = "https://api.hicap.ai/v1/deployments/{deploymentId}/images/generations"

payload = {
"prompt": "a corgi in a field",
"n": 1,
"size": "1024x1024",
"response_format": "url",
"user": "user123456",
"quality": "standard",
"style": "vivid"
}
headers = {
"api-key": "<api-key>",
"Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {'api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
prompt: 'a corgi in a field',
n: 1,
size: '1024x1024',
response_format: 'url',
user: 'user123456',
quality: 'standard',
style: 'vivid'
})
};

fetch('https://api.hicap.ai/v1/deployments/{deploymentId}/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.hicap.ai/v1/deployments/{deploymentId}/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([
'prompt' => 'a corgi in a field',
'n' => 1,
'size' => '1024x1024',
'response_format' => 'url',
'user' => 'user123456',
'quality' => 'standard',
'style' => 'vivid'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"api-key: <api-key>"
],
]);

$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.hicap.ai/v1/deployments/{deploymentId}/images/generations"

payload := strings.NewReader("{\n \"prompt\": \"a corgi in a field\",\n \"n\": 1,\n \"size\": \"1024x1024\",\n \"response_format\": \"url\",\n \"user\": \"user123456\",\n \"quality\": \"standard\",\n \"style\": \"vivid\"\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("api-key", "<api-key>")
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.hicap.ai/v1/deployments/{deploymentId}/images/generations")
.header("api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"prompt\": \"a corgi in a field\",\n \"n\": 1,\n \"size\": \"1024x1024\",\n \"response_format\": \"url\",\n \"user\": \"user123456\",\n \"quality\": \"standard\",\n \"style\": \"vivid\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.hicap.ai/v1/deployments/{deploymentId}/images/generations")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"prompt\": \"a corgi in a field\",\n \"n\": 1,\n \"size\": \"1024x1024\",\n \"response_format\": \"url\",\n \"user\": \"user123456\",\n \"quality\": \"standard\",\n \"style\": \"vivid\"\n}"

response = http.request(request)
puts response.read_body
{
  "created": "1676540381",
  "data": [
    {
      "url": "https://www.contoso.com",
      "b64_json": "<string>",
      "content_filter_results": {
        "sexual": {
          "filtered": true
        },
        "violence": {
          "filtered": true
        },
        "hate": {
          "filtered": true
        },
        "self_harm": {
          "filtered": true
        }
      },
      "revised_prompt": "<string>",
      "prompt_filter_results": {
        "sexual": {
          "filtered": true
        },
        "violence": {
          "filtered": true
        },
        "hate": {
          "filtered": true
        },
        "self_harm": {
          "filtered": true
        },
        "profanity": {
          "filtered": true,
          "detected": true
        },
        "jailbreak": {
          "filtered": true,
          "detected": true
        },
        "custom_blocklists": {
          "filtered": true,
          "details": [
            {
              "filtered": true,
              "id": "<string>"
            }
          ]
        }
      }
    }
  ]
}
{
"error": {
"code": "<string>",
"message": "<string>",
"param": "<string>",
"type": "<string>",
"inner_error": {
"code": "ResponsibleAIPolicyViolation",
"content_filter_results": {
"sexual": {
"filtered": true
},
"violence": {
"filtered": true
},
"hate": {
"filtered": true
},
"self_harm": {
"filtered": true
},
"profanity": {
"filtered": true,
"detected": true
},
"jailbreak": {
"filtered": true,
"detected": true
},
"custom_blocklists": {
"filtered": true,
"details": [
{
"filtered": true,
"id": "<string>"
}
]
}
},
"revised_prompt": "<string>"
}
}
}

Authorizations

api-key
string
header
required

Your Hicap API key.

Path Parameters

deploymentId
string
required

Deployment id of the dalle model which was deployed.

Example:

"dalle-deployment"

Query Parameters

api-version
string
required

api version

Example:

"2025-01-01-preview"

Body

application/json
prompt
string<string>
required

A text description of the desired image(s). The maximum length is 4000 characters.

Minimum string length: 1
Example:

"a corgi in a field"

n
integer
default:1

The number of images to generate.

Required range: 1 <= x <= 1
size
enum<string>
default:1024x1024

The size of the generated images.

Available options:
256x256,
512x512,
1792x1024,
1024x1792,
1024x1024
response_format
enum<string>
default:url

The format in which the generated images are returned.

Available options:
url,
b64_json
user
string<string>

A unique identifier representing your end-user, which can help to monitor and detect abuse.

Example:

"user123456"

quality
enum<string>
default:standard

The quality of the image that will be generated.

Available options:
standard,
hd
style
enum<string>
default:vivid

The style of the generated images.

Available options:
vivid,
natural

Response

Ok

created
integer<unixtime>
required

The unix timestamp when the operation was created.

Example:

"1676540381"

data
object[]
required

The result data of the operation, if successful