Jimeng Image Generation
curl --request POST \
--url https://octopusx.ai/v1/images/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "<string>",
"prompt": "<string>",
"n": 123,
"size": "<string>",
"image": [
{}
],
"ratio": "<string>",
"resolution": "<string>"
}
'import requests
url = "https://octopusx.ai/v1/images/generations"
payload = {
"model": "<string>",
"prompt": "<string>",
"n": 123,
"size": "<string>",
"image": [{}],
"ratio": "<string>",
"resolution": "<string>"
}
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: '<string>',
prompt: '<string>',
n: 123,
size: '<string>',
image: [{}],
ratio: '<string>',
resolution: '<string>'
})
};
fetch('https://octopusx.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://octopusx.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' => '<string>',
'prompt' => '<string>',
'n' => 123,
'size' => '<string>',
'image' => [
[
]
],
'ratio' => '<string>',
'resolution' => '<string>'
]),
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://octopusx.ai/v1/images/generations"
payload := strings.NewReader("{\n \"model\": \"<string>\",\n \"prompt\": \"<string>\",\n \"n\": 123,\n \"size\": \"<string>\",\n \"image\": [\n {}\n ],\n \"ratio\": \"<string>\",\n \"resolution\": \"<string>\"\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://octopusx.ai/v1/images/generations")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"<string>\",\n \"prompt\": \"<string>\",\n \"n\": 123,\n \"size\": \"<string>\",\n \"image\": [\n {}\n ],\n \"ratio\": \"<string>\",\n \"resolution\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://octopusx.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\": \"<string>\",\n \"prompt\": \"<string>\",\n \"n\": 123,\n \"size\": \"<string>\",\n \"image\": [\n {}\n ],\n \"ratio\": \"<string>\",\n \"resolution\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"created": 1735689600,
"data": [
{
"url": "https://example.com/generated-image.png",
"revised_prompt": "A close-up depiction of a domestic cat in a relaxed state..."
}
]
}
Jimeng Image
Jimeng Image Generation
Use POST /v1/images/generations to call the Jimeng model for image generation.
POST
https://octopusx.ai
/
v1
/
images
/
generations
Jimeng Image Generation
curl --request POST \
--url https://octopusx.ai/v1/images/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "<string>",
"prompt": "<string>",
"n": 123,
"size": "<string>",
"image": [
{}
],
"ratio": "<string>",
"resolution": "<string>"
}
'import requests
url = "https://octopusx.ai/v1/images/generations"
payload = {
"model": "<string>",
"prompt": "<string>",
"n": 123,
"size": "<string>",
"image": [{}],
"ratio": "<string>",
"resolution": "<string>"
}
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: '<string>',
prompt: '<string>',
n: 123,
size: '<string>',
image: [{}],
ratio: '<string>',
resolution: '<string>'
})
};
fetch('https://octopusx.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://octopusx.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' => '<string>',
'prompt' => '<string>',
'n' => 123,
'size' => '<string>',
'image' => [
[
]
],
'ratio' => '<string>',
'resolution' => '<string>'
]),
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://octopusx.ai/v1/images/generations"
payload := strings.NewReader("{\n \"model\": \"<string>\",\n \"prompt\": \"<string>\",\n \"n\": 123,\n \"size\": \"<string>\",\n \"image\": [\n {}\n ],\n \"ratio\": \"<string>\",\n \"resolution\": \"<string>\"\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://octopusx.ai/v1/images/generations")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"<string>\",\n \"prompt\": \"<string>\",\n \"n\": 123,\n \"size\": \"<string>\",\n \"image\": [\n {}\n ],\n \"ratio\": \"<string>\",\n \"resolution\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://octopusx.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\": \"<string>\",\n \"prompt\": \"<string>\",\n \"n\": 123,\n \"size\": \"<string>\",\n \"image\": [\n {}\n ],\n \"ratio\": \"<string>\",\n \"resolution\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"created": 1735689600,
"data": [
{
"url": "https://example.com/generated-image.png",
"revised_prompt": "A close-up depiction of a domestic cat in a relaxed state..."
}
]
}
Jimeng Image Generation
An image generation API in OpenAI-compatible format, supporting the image generation capabilities of the Jimeng model.- The route entry is
POST /v1/images/generations. - Currently submitted using
application/json. - Supports Jimeng models (
jimeng-4.0,jimeng-4.5). - Supports image-to-image generation by passing a reference image through the
imagefield.
Supported Models
jimeng-4.0: Jimeng 4.0 modeljimeng-4.5: Jimeng 4.5 model
Method and Path
POST /v1/images/generations
Request Example
curl -X POST https://octopusx.ai/v1/images/generations \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{
"model": "jimeng-4.0",
"prompt": "A close-up depiction of a domestic cat in a relaxed state. The cat features vibrant orange fur, with striking white markings around its eyes that extend down to its soft, pink nose.",
"n": 1,
"size": "1024*1024"
}'
import requests
resp = requests.post(
"https://octopusx.ai/v1/images/generations",
headers={
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json",
"Accept": "application/json",
},
json={
"model": "jimeng-4.0",
"prompt": "A close-up depiction of a domestic cat in a relaxed state. The cat features vibrant orange fur, with striking white markings around its eyes that extend down to its soft, pink nose.",
"n": 1,
"size": "1024*1024",
},
timeout=60,
)
print(resp.json())
const response = await fetch("https://octopusx.ai/v1/images/generations", {
method: "POST",
headers: {
Authorization: "Bearer YOUR_API_KEY",
"Content-Type": "application/json",
Accept: "application/json",
},
body: JSON.stringify({
model: "jimeng-4.0",
prompt: "A close-up depiction of a domestic cat in a relaxed state. The cat features vibrant orange fur, with striking white markings around its eyes that extend down to its soft, pink nose.",
n: 1,
size: "1024*1024",
}),
});
console.log(await response.json());
Example with Reference Image
curl -X POST https://octopusx.ai/v1/images/generations \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{
"model": "jimeng-4.0",
"prompt": "Generate a photorealistic image based on the reference image",
"n": 1,
"image": ["https://example.com/reference.png"],
"ratio": "16:9",
"resolution": "2k"
}'
import requests
resp = requests.post(
"https://octopusx.ai/v1/images/generations",
headers={
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json",
"Accept": "application/json",
},
json={
"model": "jimeng-4.0",
"prompt": "Generate a photorealistic image based on the reference image",
"n": 1,
"image": ["https://example.com/reference.png"],
"ratio": "16:9",
"resolution": "2k",
},
timeout=60,
)
print(resp.json())
Response Example
{
"created": 1735689600,
"data": [
{
"url": "https://example.com/generated-image.png",
"revised_prompt": "A close-up depiction of a domestic cat in a relaxed state..."
}
]
}
Authentication
Authorization: Bearer YOUR_API_KEY
Body
Model name. Supports
jimeng-4.0 and jimeng-4.5.Prompt. The text description for image generation, supporting both Chinese and English.
Number of images. The number of images to generate.
Image size. Resolution settings, such as
1024*1024.Reference image. An array of reference image URLs, used for image-to-image scenarios.
Image ratio. For example,
1:1, 16:9, 9:16, 4:3, 3:4, and so on.Resolution. Available values:
1k, 2k, 4k.Response
Generation timestamp (Unix timestamp).
Array of generation results.
URL of the generated image.
Rewritten prompt (returned by some upstream services).
Related APIs
⌘I