API reference · zhipu

zhipu/glm-image

Integrate this model through SandBase's unified API, with production-ready schemas and examples.

IMAGEAsyncOpen model
Production endpoint

Send your first request

OpenAI-compatible endpoint with unified authentication and usage tracking.

POSThttps://api.sandbase.ai/v1/run
Model IDzhipu/glm-image
01

Input Schema

6 parameters · 1 required · 5 optional

ParameterTypeRequiredDescription
promptstringRequiredText prompt for image generation.
seedintegerOptionalRandom seed for reproducibility. The same seed with the same prompt will produce the same image.
aspect_ratiostringOptionalThe aspect ratio of the generated image. · Options: 21:9, 16:9, 3:2, 4:3, 5:4, 1:1, 4:5, 3:4, 2:3, 9:16
21:916:93:24:35:41:14:53:42:39:16
output_formatstringOptionalOutput image format. · Options: jpeg, png · Default: "jpeg"
jpegpng
guidance_scalenumberOptionalClassifier-free guidance scale. Higher values make the model follow the prompt more closely. · Min: 1 · Max: 10 · Default: 1.5
num_inference_stepsintegerOptionalNumber of diffusion denoising steps. More steps generally produce higher quality images. · Min: 10 · Max: 100 · Default: 30
02

Output Schema

FieldTypeDescription
idstringUnique identifier for the generation task
statusstringTask status: pending, running, completed, failed, timeout
modelstringModel used for the generation
outputsarrayArray of output items
outputs[].urlstringURL of the generated artifact
outputs[].content_typestringMIME type (e.g. image/png, video/mp4)
errorobject | nullError details if failed, null on success
error.typestringMachine-readable error type code
error.messagestringHuman-readable error description

Async Workflow

This model uses asynchronous execution. Submit a request and poll for the result.

  1. Submit — POST to /v1/run, receive an id
  2. Poll — GET /v1/run/{id} until status is completed, failed, or timeout
  3. Retrieve — Read outputs from the completed response
03

Code Examples

Ready-to-run snippets

# Step 1: Submit
curl -X POST https://api.sandbase.ai/v1/run \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
  "model": "zhipu/glm-image",
  "prompt": "An elegant close-up photograph of hands holding a beautifully illustrated watercolor menu card. The hands have natural sun-kissed skin with a delicate gold ring, gripping the menu gently and refined.\n\nThe menu is a work of art—hand-painted watercolor illustration on textured cream watercolor paper with soft deckled edges:\n\n- Top: \"AZURE\" painted in flowing navy blue watercolor calligraphy with organic brushstroke texture and slight color bleeding\n- Watercolor illustration border: delicate tropical elements painted in soft washes—translucent turquoise waves flowing along the edges, loose coral and pink hibiscus flowers in the corners, gentle green palm leaf strokes, and small golden paint splatters suggesting sunlight\n- Center menu items in elegant hand-lettered watercolor script with slight variations in ink density:\n\n  \"Tuna Tartare — 24\"\n  \"Sea Bass — 32\"\n  \"Mango Pavlova — 14\"\n\n- Bottom: \"Koh Samui\" in small watercolor lettering with a tiny painted wave\n\nThe watercolor has beautiful organic qualities—soft color gradients, natural paper texture visible through transparent washes, slight bleeding at edges of brushstrokes, layered translucent blues and greens creating depth. The paint has a luminous, fresh quality with white paper showing through in places.\n\nBackground: dreamy out-of-focus turquoise ocean with sparkling bokeh lights reflecting off water, creating soft circular light spots in aqua and gold tones. The blurred background complements the watercolor aesthetic perfectly.\n\nLighting: warm natural golden hour sunlight from upper left, illuminating the watercolor pigments and making them glow. The light catches the textured watercolor paper beautifully, showing subtle shadows in the paint layers and paper grain.\n\nPhotography style: shot on 85mm f/1.4, shallow depth of field with only the menu in sharp focus. High-end editorial aesthetic that celebrates the handmade, artistic quality of the watercolor. Color palette: cream paper, translucent turquoise and teal watercolors, soft coral pink, navy blue, gentle greens, golden accents, warm skin tones.\n\nThe overall mood is artistic, luxurious, handcrafted—like a boutique resort that values artistry and craftsmanship. The watercolor style feels fresh, organic, and elevated.",
  "output_format": "jpeg",
  "guidance_scale": 1.5,
  "num_inference_steps": 30
}'

# Step 2: Poll result (replace <id>)
curl https://api.sandbase.ai/v1/run/<id> \
  -H "Authorization: Bearer YOUR_API_KEY"