curl --request POST \
--url https://api.deepshi.ai/v1/images/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "deepshi-banana-pro-2",
"prompt": "a red fox in a snowy forest, cinematic lighting",
"width": 1024,
"height": 1024,
"response_format": "url"
}
'import requests
url = "https://api.deepshi.ai/v1/images/generations"
payload = {
"model": "deepshi-banana-pro-2",
"prompt": "a red fox in a snowy forest, cinematic lighting",
"width": 1024,
"height": 1024,
"response_format": "url"
}
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: 'deepshi-banana-pro-2',
prompt: 'a red fox in a snowy forest, cinematic lighting',
width: 1024,
height: 1024,
response_format: 'url'
})
};
fetch('https://api.deepshi.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.deepshi.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' => 'deepshi-banana-pro-2',
'prompt' => 'a red fox in a snowy forest, cinematic lighting',
'width' => 1024,
'height' => 1024,
'response_format' => 'url'
]),
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.deepshi.ai/v1/images/generations"
payload := strings.NewReader("{\n \"model\": \"deepshi-banana-pro-2\",\n \"prompt\": \"a red fox in a snowy forest, cinematic lighting\",\n \"width\": 1024,\n \"height\": 1024,\n \"response_format\": \"url\"\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.deepshi.ai/v1/images/generations")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"deepshi-banana-pro-2\",\n \"prompt\": \"a red fox in a snowy forest, cinematic lighting\",\n \"width\": 1024,\n \"height\": 1024,\n \"response_format\": \"url\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.deepshi.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\": \"deepshi-banana-pro-2\",\n \"prompt\": \"a red fox in a snowy forest, cinematic lighting\",\n \"width\": 1024,\n \"height\": 1024,\n \"response_format\": \"url\"\n}"
response = http.request(request)
puts response.read_body{
"created": 1783695957,
"data": [
{
"url": "https://media.cdn-deepshi.com/images/019f4c8f-....png",
"index": 0
}
],
"usage": {
"cost": {
"total_cost": 0.02
}
}
}{
"error": {
"message": "The model does not exist or you do not have access to it.",
"type": "invalid_request_error",
"code": "model_not_found",
"param": null
}
}{
"error": {
"message": "Incorrect API key provided.",
"type": "invalid_request_error",
"code": "invalid_api_key",
"param": null
}
}{
"error": {
"message": "You have insufficient credits to complete this request.",
"type": "insufficient_quota",
"code": "insufficient_quota",
"param": null
}
}{
"error": {
"message": "The model does not exist or you do not have access to it.",
"type": "invalid_request_error",
"code": "model_not_found",
"param": null
}
}{
"error": {
"message": "Rate limit reached. Please retry after a short delay.",
"type": "rate_limit_error",
"code": "rate_limit_exceeded",
"param": null
}
}{
"error": {
"message": "The server had an error while processing your request. Please retry.",
"type": "api_error",
"code": null,
"param": null
}
}Generate an image
Generate one or more images from a text prompt. Beyond the standard fields, each model accepts its own model-specific sizing and quality parameters such as resolution, aspect_ratio, width/height, and quality. Send the ones your chosen model supports. Call GET /v1/models to see each model’s supported parameters; pricing is shown on deepshi.ai and every response returns the actual usage.cost. Set stream: true for Server-Sent Events on slow, high-resolution generations.
curl --request POST \
--url https://api.deepshi.ai/v1/images/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "deepshi-banana-pro-2",
"prompt": "a red fox in a snowy forest, cinematic lighting",
"width": 1024,
"height": 1024,
"response_format": "url"
}
'import requests
url = "https://api.deepshi.ai/v1/images/generations"
payload = {
"model": "deepshi-banana-pro-2",
"prompt": "a red fox in a snowy forest, cinematic lighting",
"width": 1024,
"height": 1024,
"response_format": "url"
}
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: 'deepshi-banana-pro-2',
prompt: 'a red fox in a snowy forest, cinematic lighting',
width: 1024,
height: 1024,
response_format: 'url'
})
};
fetch('https://api.deepshi.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.deepshi.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' => 'deepshi-banana-pro-2',
'prompt' => 'a red fox in a snowy forest, cinematic lighting',
'width' => 1024,
'height' => 1024,
'response_format' => 'url'
]),
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.deepshi.ai/v1/images/generations"
payload := strings.NewReader("{\n \"model\": \"deepshi-banana-pro-2\",\n \"prompt\": \"a red fox in a snowy forest, cinematic lighting\",\n \"width\": 1024,\n \"height\": 1024,\n \"response_format\": \"url\"\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.deepshi.ai/v1/images/generations")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"deepshi-banana-pro-2\",\n \"prompt\": \"a red fox in a snowy forest, cinematic lighting\",\n \"width\": 1024,\n \"height\": 1024,\n \"response_format\": \"url\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.deepshi.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\": \"deepshi-banana-pro-2\",\n \"prompt\": \"a red fox in a snowy forest, cinematic lighting\",\n \"width\": 1024,\n \"height\": 1024,\n \"response_format\": \"url\"\n}"
response = http.request(request)
puts response.read_body{
"created": 1783695957,
"data": [
{
"url": "https://media.cdn-deepshi.com/images/019f4c8f-....png",
"index": 0
}
],
"usage": {
"cost": {
"total_cost": 0.02
}
}
}{
"error": {
"message": "The model does not exist or you do not have access to it.",
"type": "invalid_request_error",
"code": "model_not_found",
"param": null
}
}{
"error": {
"message": "Incorrect API key provided.",
"type": "invalid_request_error",
"code": "invalid_api_key",
"param": null
}
}{
"error": {
"message": "You have insufficient credits to complete this request.",
"type": "insufficient_quota",
"code": "insufficient_quota",
"param": null
}
}{
"error": {
"message": "The model does not exist or you do not have access to it.",
"type": "invalid_request_error",
"code": "model_not_found",
"param": null
}
}{
"error": {
"message": "Rate limit reached. Please retry after a short delay.",
"type": "rate_limit_error",
"code": "rate_limit_exceeded",
"param": null
}
}{
"error": {
"message": "The server had an error while processing your request. Please retry.",
"type": "api_error",
"code": null,
"param": null
}
}Authorizations
Body
Image generation request. model and prompt are required. The remaining fields are optional; a model safely ignores any field it does not support. Model-specific sizing/quality fields (width/height, aspect_ratio, resolution, quality, image_size) apply only to the models that declare them — see GET /v1/models. Additional model-specific parameters not listed here may also be sent and are forwarded to the model.
Response
The generated image(s). When stream: true, the response is a Server-Sent Events stream (text/event-stream): periodic keepalive comments followed by a terminal image_generation.completed event carrying the final image (see the ImageStreamEvent schema).
Was this page helpful?