API reference · zhipu
zhipu/glm-image
Integrate this model through SandBase's unified API, with production-ready schemas and examples.
Production endpoint
Send your first request
OpenAI-compatible endpoint with unified authentication and usage tracking.
POST
https://api.sandbase.ai/v1/runModel ID
zhipu/glm-image01
Input Schema
6 parameters · 1 required · 5 optional
| Parameter | Type | Required | Description |
|---|---|---|---|
prompt | string | Required | Text prompt for image generation. |
seed | integer | Optional | Random seed for reproducibility. The same seed with the same prompt will produce the same image. |
aspect_ratio | string | Optional | The 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_format | string | Optional | Output image format. · Options: jpeg, png · Default: "jpeg" jpegpng |
guidance_scale | number | Optional | Classifier-free guidance scale. Higher values make the model follow the prompt more closely. · Min: 1 · Max: 10 · Default: 1.5 |
num_inference_steps | integer | Optional | Number of diffusion denoising steps. More steps generally produce higher quality images. · Min: 10 · Max: 100 · Default: 30 |
02
Output Schema
| Field | Type | Description |
|---|---|---|
id | string | Unique identifier for the generation task |
status | string | Task status: pending, running, completed, failed, timeout |
model | string | Model used for the generation |
outputs | array | Array of output items |
outputs[].url | string | URL of the generated artifact |
outputs[].content_type | string | MIME type (e.g. image/png, video/mp4) |
error | object | null | Error details if failed, null on success |
error.type | string | Machine-readable error type code |
error.message | string | Human-readable error description |
Async Workflow
This model uses asynchronous execution. Submit a request and poll for the result.
- Submit — POST to /v1/run, receive an
id - Poll — GET /v1/run/{id} until status is
completed,failed, ortimeout - Retrieve — Read
outputsfrom 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"
