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",
"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",
"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',
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',
'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\",\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\",\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\",\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": 123,
"model": "<string>",
"size": "<string>",
"data": [
{
"index": 123,
"b64_json": "<string>",
"url": "<string>",
"revised_prompt": "<string>"
}
],
"usage": {
"prompt_tokens": 123,
"prompt_tokens_details": {
"cached_tokens": 123,
"cached_read_tokens": 123,
"image_tokens": 123
},
"completion_tokens": 123,
"completion_tokens_details": {
"reasoning_tokens": 123,
"image_tokens": 123
},
"total_tokens": 123,
"cost": {
"total_cost": 0.000135
}
}
}{
"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",
"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",
"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',
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',
'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\",\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\",\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\",\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": 123,
"model": "<string>",
"size": "<string>",
"data": [
{
"index": 123,
"b64_json": "<string>",
"url": "<string>",
"revised_prompt": "<string>"
}
],
"usage": {
"prompt_tokens": 123,
"prompt_tokens_details": {
"cached_tokens": 123,
"cached_read_tokens": 123,
"image_tokens": 123
},
"completion_tokens": 123,
"completion_tokens_details": {
"reasoning_tokens": 123,
"image_tokens": 123
},
"total_tokens": 123,
"cost": {
"total_cost": 0.000135
}
}
}{
"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
Your Deepshi API key, sent as Authorization: Bearer <key>.
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.
The image model id to use. See GET /v1/models.
"nano-banana-pro"
Text description of the image to generate.
"a serene canal in Venice at sunset"
Number of images to generate (1–4).
1 <= x <= 4How images are returned. url returns an inline base64 data: URI, not a hosted link.
b64_json, url Encoding of the returned image. Not all models honor every format.
png, jpeg, webp Stream the result as Server-Sent Events. Use it for slow, high-resolution generations that would otherwise time out.
Seed for reproducible output. Omit for a random seed.
Model-specific. Output width in pixels, for pixel-dimension models (e.g. flux-2-pro).
Model-specific. Output height in pixels, for pixel-dimension models.
Model-specific. Aspect ratio for aspect-ratio and resolution-tier models.
"16:9"
Model-specific. Resolution tier for resolution-tier models (e.g. nano-banana-2, nano-banana-pro, grok-imagine-quality). Determines the billed price for those models.
"2K"
Model-specific. Quality tier for the GPT Image models (gpt-image-1.5, gpt-image-2). Higher tiers cost more, and the price depends on the image size and quality you pick. Omit to use the model's default tier.
low, medium, high Model-specific. Named output size for preset-size models (e.g. seedream-4.5).
"auto_2K"
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).
Unix timestamp when the request was created.
The image model id you requested.
The actual output dimensions, as WIDTHxHEIGHT.
The generated image(s).
Show child attributes
Show child attributes
Token usage and the billed cost for the request.
Show child attributes
Show child attributes
Was this page helpful?