Appearance
z-image-turbo
Request parameters and examples for z-image-turbo.
POST /v1/images/generations · POST /v1/async/images/generations
Send JSON with Authorization: Bearer <PIXAPI_KEY> and Content-Type: application/json.
Request fields
Send the common fields at the top level. Put the model-specific controls listed below inside providerOptions.
| Field | Type | Required | Description |
|---|---|---|---|
model | string | Yes | z-image-turbo. Case-sensitive model ID. |
prompt | string | Yes | Non-empty Chinese or English description; at most 800 characters, otherwise rejected. |
n | integer | No | Default 1; only integer 1 is supported. |
size | string | No | Use pixel dimensions WIDTHxHEIGHT, for example 1024x1024. Pixel area 512×512–2048×2048. Each edge 512–2048; default 1024x1536. No auto. |
providerOptions | object | No | Model-specific options; see the table below. |
providerOptions
All fields in this table are nested inside providerOptions, not alongside model.
| Field | Type | Description |
|---|---|---|
seed | integer | Random seed, 0–2147483647; omitted means random. The same seed does not guarantee identical output. |
prompt_extend | boolean | Prompt rewriting; default false. |
Input rules
Use JSON requests. Do not send quality, resolution, mask, or output_format for these Bailian models. Z-Image supports text-to-image only.
Example
bash
curl https://api.pixapi.ai/v1/images/generations \
-H "Authorization: Bearer $PIXAPI_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "z-image-turbo",
"prompt": "A poster for a coffee shop with the title Good Morning",
"n": 1,
"size": "1024x1024",
"providerOptions": {
"prompt_extend": false
}
}'py
import os
import requests
response = requests.post(
"https://api.pixapi.ai/v1/images/generations",
headers={"Authorization": f"Bearer {os.environ['PIXAPI_KEY']}"},
json={
"model": "z-image-turbo",
"prompt": "A poster for a coffee shop with the title Good Morning",
"n": 1,
"size": "1024x1024",
"providerOptions": {
"prompt_extend": False
}
},
)
response.raise_for_status()
print(response.json())js
const response = await fetch('https://api.pixapi.ai/v1/images/generations', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.PIXAPI_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"model": "z-image-turbo",
"prompt": "A poster for a coffee shop with the title Good Morning",
"n": 1,
"size": "1024x1024",
"providerOptions": {
"prompt_extend": false
}
}),
});
if (!response.ok) throw new Error(await response.text());
console.log(await response.json());go
package main
import (
"bytes"
"fmt"
"io"
"net/http"
"os"
)
func main() {
body := []byte(`{
"model": "z-image-turbo",
"prompt": "A poster for a coffee shop with the title Good Morning",
"n": 1,
"size": "1024x1024",
"providerOptions": {
"prompt_extend": false
}
}`)
req, err := http.NewRequest("POST", "https://api.pixapi.ai/v1/images/generations", bytes.NewBuffer(body))
if err != nil { panic(err) }
req.Header.Set("Authorization", "Bearer " + os.Getenv("PIXAPI_KEY"))
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
if err != nil { panic(err) }
defer resp.Body.Close()
result, err := io.ReadAll(resp.Body)
if err != nil { panic(err) }
if resp.StatusCode >= 400 { panic(string(result)) }
fmt.Println(string(result))
}For asynchronous requests, save the returned id and poll GET /v1/tasks/{id} until completed or failed. See task results and billing.
