Jimeng Official Format Image Generation
curl --request POST \
--url https://www.token-nova.com/jm \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"req_key": "<string>",
"model": "<string>",
"prompt": "<string>",
"resolution": "<string>",
"size": 123,
"force_single": true,
"image_urls": [
{}
],
"width": 123,
"height": 123
}
'import requests
url = "https://www.token-nova.com/jm"
payload = {
"req_key": "<string>",
"model": "<string>",
"prompt": "<string>",
"resolution": "<string>",
"size": 123,
"force_single": True,
"image_urls": [{}],
"width": 123,
"height": 123
}
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({
req_key: '<string>',
model: '<string>',
prompt: '<string>',
resolution: '<string>',
size: 123,
force_single: true,
image_urls: [{}],
width: 123,
height: 123
})
};
fetch('https://www.token-nova.com/jm', 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://www.token-nova.com/jm",
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([
'req_key' => '<string>',
'model' => '<string>',
'prompt' => '<string>',
'resolution' => '<string>',
'size' => 123,
'force_single' => true,
'image_urls' => [
[
]
],
'width' => 123,
'height' => 123
]),
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://www.token-nova.com/jm"
payload := strings.NewReader("{\n \"req_key\": \"<string>\",\n \"model\": \"<string>\",\n \"prompt\": \"<string>\",\n \"resolution\": \"<string>\",\n \"size\": 123,\n \"force_single\": true,\n \"image_urls\": [\n {}\n ],\n \"width\": 123,\n \"height\": 123\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://www.token-nova.com/jm")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"req_key\": \"<string>\",\n \"model\": \"<string>\",\n \"prompt\": \"<string>\",\n \"resolution\": \"<string>\",\n \"size\": 123,\n \"force_single\": true,\n \"image_urls\": [\n {}\n ],\n \"width\": 123,\n \"height\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://www.token-nova.com/jm")
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 \"req_key\": \"<string>\",\n \"model\": \"<string>\",\n \"prompt\": \"<string>\",\n \"resolution\": \"<string>\",\n \"size\": 123,\n \"force_single\": true,\n \"image_urls\": [\n {}\n ],\n \"width\": 123,\n \"height\": 123\n}"
response = http.request(request)
puts response.read_body{
"code": 10000,
"data": {
"task_id": "67fb9e82-126e-4c71-bb16-a3bb3789e3b7",
"status": "submitted"
},
"message": "Success",
"request_id": "67fb9e82-126e-4c71-bb16-a3bb3789e3b7",
"status": 10000,
"time_elapsed": "35.381µs"
}
Jimeng Image
Jimeng Official Format Image Generation
Generate images using the official Jimeng format interface via POST /jm.
POST
https://www.token-nova.com
/
jm
Jimeng Official Format Image Generation
curl --request POST \
--url https://www.token-nova.com/jm \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"req_key": "<string>",
"model": "<string>",
"prompt": "<string>",
"resolution": "<string>",
"size": 123,
"force_single": true,
"image_urls": [
{}
],
"width": 123,
"height": 123
}
'import requests
url = "https://www.token-nova.com/jm"
payload = {
"req_key": "<string>",
"model": "<string>",
"prompt": "<string>",
"resolution": "<string>",
"size": 123,
"force_single": True,
"image_urls": [{}],
"width": 123,
"height": 123
}
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({
req_key: '<string>',
model: '<string>',
prompt: '<string>',
resolution: '<string>',
size: 123,
force_single: true,
image_urls: [{}],
width: 123,
height: 123
})
};
fetch('https://www.token-nova.com/jm', 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://www.token-nova.com/jm",
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([
'req_key' => '<string>',
'model' => '<string>',
'prompt' => '<string>',
'resolution' => '<string>',
'size' => 123,
'force_single' => true,
'image_urls' => [
[
]
],
'width' => 123,
'height' => 123
]),
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://www.token-nova.com/jm"
payload := strings.NewReader("{\n \"req_key\": \"<string>\",\n \"model\": \"<string>\",\n \"prompt\": \"<string>\",\n \"resolution\": \"<string>\",\n \"size\": 123,\n \"force_single\": true,\n \"image_urls\": [\n {}\n ],\n \"width\": 123,\n \"height\": 123\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://www.token-nova.com/jm")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"req_key\": \"<string>\",\n \"model\": \"<string>\",\n \"prompt\": \"<string>\",\n \"resolution\": \"<string>\",\n \"size\": 123,\n \"force_single\": true,\n \"image_urls\": [\n {}\n ],\n \"width\": 123,\n \"height\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://www.token-nova.com/jm")
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 \"req_key\": \"<string>\",\n \"model\": \"<string>\",\n \"prompt\": \"<string>\",\n \"resolution\": \"<string>\",\n \"size\": 123,\n \"force_single\": true,\n \"image_urls\": [\n {}\n ],\n \"width\": 123,\n \"height\": 123\n}"
response = http.request(request)
puts response.read_body{
"code": 10000,
"data": {
"task_id": "67fb9e82-126e-4c71-bb16-a3bb3789e3b7",
"status": "submitted"
},
"message": "Success",
"request_id": "67fb9e82-126e-4c71-bb16-a3bb3789e3b7",
"status": 10000,
"time_elapsed": "35.381µs"
}
Jimeng Official Format Image Generation
An image generation API in Jimeng’s official format, submitted in JSON and requiring query parameters.- The routing entry is
POST /jm. - The
ActionandVersionquery parameters must be included in the URL. - Currently submitted using
application/json. - Supports text-to-image, image-to-image, and other scenarios.
- After successful submission, a task
task_idis returned. Use Query Task to fetch the result later.
Supported Models
jimeng-4.0: Jimeng 4.0 model
Method and Path
POST /jm?Action=CVSync2AsyncSubmitTask&Version=2022-08-31
Request Example
curl -X POST "https://www.token-nova.com/jm?Action=CVSync2AsyncSubmitTask&Version=2022-08-31" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{
"req_key": "jimeng_t2i_v40",
"model": "jimeng-4.0",
"prompt": "The sunset glow illuminates the lake, with delicate oil painting texture",
"force_single": true,
"image_urls": [],
"width": 1024,
"height": 1024
}'
import requests
resp = requests.post(
"https://www.token-nova.com/jm",
headers={
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json",
"Accept": "application/json",
},
params={
"Action": "CVSync2AsyncSubmitTask",
"Version": "2022-08-31",
},
json={
"req_key": "jimeng_t2i_v40",
"model": "jimeng-4.0",
"prompt": "The sunset glow illuminates the lake, with delicate oil painting texture",
"force_single": True,
"image_urls": [],
"width": 1024,
"height": 1024,
},
timeout=60,
)
print(resp.json())
Example with Reference Images
curl -X POST "https://www.token-nova.com/jm?Action=CVSync2AsyncSubmitTask&Version=2022-08-31" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{
"req_key": "jimeng_t2i_v40",
"model": "jimeng-4.0",
"prompt": "Generate an artistic style based on the reference images",
"force_single": true,
"image_urls": [
"https://example.com/reference1.png",
"https://example.com/reference2.png"
],
"resolution": "2k"
}'
import requests
resp = requests.post(
"https://www.token-nova.com/jm",
headers={
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json",
"Accept": "application/json",
},
params={
"Action": "CVSync2AsyncSubmitTask",
"Version": "2022-08-31",
},
json={
"req_key": "jimeng_t2i_v40",
"model": "jimeng-4.0",
"prompt": "Generate an artistic style based on the reference images",
"force_single": True,
"image_urls": [
"https://example.com/reference1.png",
"https://example.com/reference2.png",
],
"resolution": "2k",
},
timeout=60,
)
print(resp.json())
Response Example
{
"code": 10000,
"data": {
"task_id": "67fb9e82-126e-4c71-bb16-a3bb3789e3b7",
"status": "submitted"
},
"message": "Success",
"request_id": "67fb9e82-126e-4c71-bb16-a3bb3789e3b7",
"status": 10000,
"time_elapsed": "35.381µs"
}
Authentication
Authorization: Bearer YOUR_API_KEY
Query Parameters
Body
The prompt used to generate the image. Both Chinese and English are supported. It is recommended to keep it within 800 characters at most; overly long prompts may cause generation anomalies or fail to take effect. You can directly specify the image generation ratio in the prompt.
The image area to generate (deprecated). Default: 4194304, which is 20482048, generating a 2K resolution image. Range: [10241024, 4096*4096], capable of generating 1K to 4K resolution images.
Response
Recommended Sizes
1K Resolution
| Width x Height | Ratio |
|---|---|
| 1024x1024 | 1:1 |
2K Resolution
| Width x Height | Ratio |
|---|---|
| 2048x2048 | 1:1 |
| 2304x1728 | 4:3 |
| 2496x1664 | 3:2 |
| 2560x1440 | 16:9 |
| 3024x1296 | 21:9 |
4K Resolution
| Width x Height | Ratio |
|---|---|
| 4096x4096 | 1:1 |
| 4694x3520 | 4:3 |
| 4992x3328 | 3:2 |
| 5404x3040 | 16:9 |
| 6198x2656 | 21:9 |
