Skip to main content
No. LaoZhang API image generation and editing endpoints are synchronous: the connection stays open and the image comes back in the response when it’s ready. There’s no task ID and no endpoint to fetch results later. If you need asynchronous behavior, wrap the call in a job queue in your own backend.

Why there’s no task ID

  • Image endpoints keep the same synchronous behavior as the upstream APIs, with no queue in between that would add latency or change behavior.
  • LaoZhang API doesn’t store prompts or generated images by default, so there’s nothing to fetch by ID afterward. See how LaoZhang API handles data and logs.
  • With a long enough timeout and an open connection, nearly all image requests finish within a single call.

What to do instead

1

Set the timeout high enough

Give your client and any proxy 360 seconds, or 600 seconds for 4K output or many reference images. See API request timeouts for setup and troubleshooting.
2

Turn off SDK retries

An automatic retry after a timeout generates and bills the image again. Set max_retries to 0 in the OpenAI SDK and let your code decide when to retry.
3

Record every job in your backend

Give each request your own job ID and store the prompt, parameters, result, or error in your database. If the frontend disconnects, the backend still has the full record.

Add an async queue in your backend

If your frontend can’t wait on a long request, split the flow:
  1. The frontend submits a job; the backend saves it and returns a job ID.
  2. A backend worker calls LaoZhang API synchronously and writes the result back.
  3. The frontend polls your backend with the job ID, or receives the result over a WebSocket.
Here’s a minimal version that uses a thread pool from the Python standard library in place of a real job queue. In production, swap in Celery, RQ, or a cloud queue:
Install the SDK with pip install openai and set LAOZHANG_API_KEY first. save_image handles both Base64 and URL responses; each model’s guide lists the format it returns. You create and store the job ID; LaoZhang API only handles the synchronous generation step.

FAQ

Can I recover an image after my client times out?

No. The result exists only in that response, so it’s gone once the connection drops, and the provider still bills the finished generation. Before you retry, check the earlier request’s status in call logs.

Is video generation synchronous too?

No. Video models such as Wan 2.7 and Seedance run as asynchronous tasks: you submit a request, get a task ID, poll its status, and download the result. Each video model’s guide has the steps.

How long do image models take?

It varies a lot: some return in seconds, while 4K, high-quality settings, or many reference images can take minutes, and peak times are slower. If you’re unsure, use 360 seconds. Model-specific notes are in Image generation APIs: models and pricing.