Skip to main content
POST
curl
Makes one to four pictures from a prompt with one of the picture models. Each picture comes back as a base64-encoded PNG in data[].b64_json. Send generation fields as JSON or multipart form data. To get a job id and poll for the pictures, send Prefer: respond-async or set async to true. See Image jobs. With janus-pro-1b, each picture is a separate job. If you request several and a later job fails, the API returns HTTP 200 with the pictures already made. Check data.length to see how many you received. If the first job fails, you get its HTTP error.

Sizes

Any other size is refused with 400, and the message lists the sizes the model takes.

Seeds

seed is not part of OpenAI’s API. With z-image-turbo and flux2-klein, the first picture uses seed and each further one uses the next number. Leave it out for a random seed. Each picture’s seed comes back in data[].seed. janus-pro-1b does not take a seed. With the OpenAI Python SDK, send it with extra_body={"seed": 42}.

Price

Each picture costs its model’s price at its size, so n pictures cost n times as much. See Credits and pricing.

Differences from OpenAI

  • response_format: only b64_json. url is refused.
  • size: square sizes only, from the table above.
  • Ignored: quality, style, background, output_format, moderation, user.
  • revised_prompt is always null.
  • For edits, upload a picture and mask to Edit an image. Image variations are unsupported.

Authorizations

Authorization
string
header
required

An API token from the account panel on sharemy.ai. Tokens start with smai_.

Headers

Prefer
string

Send respond-async to receive a job id and poll for the result.

Body

Top-level null fields are treated as omitted.

prompt
string
required

What to draw, 1 to 2,000 characters.

Required string length: 1 - 2000
model
enum<string> | null
default:z-image-turbo
Available options:
z-image-turbo,
flux2-klein,
janus-pro-1b,
null
n
integer | null
default:1

Number of pictures requested. Janus returns completed pictures if a later job fails.

Required range: 1 <= x <= 4
size
enum<string> | null

z-image-turbo and flux2-klein take 256x256, 512x512 (their default) or 1024x1024. janus-pro-1b takes only 384x384, its default.

Available options:
256x256,
512x512,
1024x1024,
384x384,
null
response_format
enum<string> | null
default:b64_json

Only b64_json. There are no image URLs.

Available options:
b64_json,
null
seed
integer | null

Not part of OpenAI's API. The seed for the first picture; each further picture uses the next number. Random when left out. janus-pro-1b does not use it.

async

A boolean true or the string "true" requests an async job. You can also send Prefer: respond-async.

Response

Generated pictures. A Janus request may return fewer than n if a later picture fails. The cost header totals completed pictures.

created
integer
required

Unix time in seconds.

data
object[]
required