Skip to content

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.

FieldTypeRequiredDescription
modelstringYesz-image-turbo. Case-sensitive model ID.
promptstringYesNon-empty Chinese or English description; at most 800 characters, otherwise rejected.
nintegerNoDefault 1; only integer 1 is supported.
sizestringNoUse pixel dimensions WIDTHxHEIGHT, for example 1024x1024. Pixel area 512×512–2048×2048. Each edge 512–2048; default 1024x1536. No auto.
providerOptionsobjectNoModel-specific options; see the table below.

providerOptions ​

All fields in this table are nested inside providerOptions, not alongside model.

FieldTypeDescription
seedintegerRandom seed, 0–2147483647; omitted means random. The same seed does not guarantee identical output.
prompt_extendbooleanPrompt 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.