AI Agent Hub
Back to skills
Smart Image Generation icon

Smart Image Generation

Design & Media Updated 2026.08.30

Paste the following prompt into your AI chat to install this skill:

Please install @ixhlink/ixhlink-skills-image-gen using https://skillhub.cn/install/skillhub.md.

About this skill

What Problem It Solves

When an agent needs image generation, calling upstream models directly often creates practical issues: image_generation is usually a slow task, so results cannot be returned synchronously; fields such as prompt, size, n, and quality can vary by upstream model; reference-image generation may require b64 or url; and some calls hit a 402 payment gate. ixhlink-skills-image-gen consolidates this API behavior behind one skill entry point, so callers focus on business parameters, task state, and image output.

How It Works

The main workflow is asynchronous. You can first check that the model is enabled via GET /api/v1/llm/models, then submit POST /api/v1/llm/invoke. The request body includes prompt and optional size, n, quality, response_format, and images. After success, read data.task.id and poll GET /api/v1/llm/tasks/{task_id} at 2-5 second intervals until status = succeeded. Image URLs appear in data.result.data[].url. If the first call returns 402, retry with the same JSON body and include WeixinPay-Required and X-Payment-Id. You can also create an async task directly, keeping the same request body.

Boundaries

It fits text-to-image, reference-image generation, and per-call billing. Do not modify business fields in payload during payment retries; pass order parameters via headers or the payment object. An unenabled model may return 404, an unavailable upstream site may return 503, and failed tasks should be inspected via data.error_message. Set timeouts according to your workload, for example 3-5 minutes.

Use Cases

  • Generate a 1024x1024 illustration and return accessible image URLs.
  • Keep brand style with reference images in agent asset generation.
  • Check model status, 402 payment flow, and task failures.
  • Show 0.3 yuan per call, collect payment, and retry unchanged.

Best For

  • Agent workflow engineers wiring image tasks and polling result URLs.
  • Billing engineers handling 402 responses and payment retries.
  • Design engineers generating brand assets with reference images.
  • Platform architects checking model status, errors, and timeouts.