跳转到主要内容
Use this endpoint to generate images from natural language descriptions. Qhaigc supports multiple image generation models at different quality tiers, and the request format is fully compatible with the OpenAI Images API. Endpoint: POST https://api.qhaigc.net/v1/images/generations

Supported Models

qh-draw-x2-preview

Qhaigc’s proprietary professional-grade image model. Strong across diverse styles and scenarios.

qh-draw-x1-pro

Based on open-source SD architecture with natural language understanding. Stable quality output.

dall-e-3

OpenAI’s third-generation model. Up to 8K resolution with rich detail and prompt adherence.

即梦4.0

High-quality Chinese-origin image generation model. Excellent for artistic and stylistic prompts.

Request Parameters

model
string
必填
The image generation model to use. Examples: qh-draw-x2-preview, dall-e-3, 即梦4.0.
prompt
string
必填
A text description of the image you want to generate. More detailed prompts generally produce better results.
size
string
必填
The output image dimensions in widthxheight format. Common values:
ValueAspect RatioUse Case
1024x10241:1Avatars, icons, thumbnails
720x12809:16Social media stories, posters
1280x72016:9Banners, landscape covers
1024x17929:16 (HD)High-resolution portrait
1792x102416:9 (HD)High-resolution landscape
n
integer
Number of images to generate. Defaults to 1. Some models only support n=1.
response_format
string
Format of the returned image. Use "url" (default) to receive a hosted URL, or "b64_json" for a base64-encoded string.

Response Fields

created
integer
Unix timestamp of when the image was generated.
data
array
Array of generated image objects. Each contains a url field with the hosted image URL.

Code Examples

from openai import OpenAI

client = OpenAI(
    api_key="sk-your-api-key-here",
    base_url="https://api.qhaigc.net/v1"
)

response = client.images.generate(
    model="qh-draw-x2-preview",
    prompt="A futuristic city skyline at dusk, cyberpunk style, neon lights reflecting on rain-slicked streets, cinematic quality",
    size="1280x720",
    n=1
)

image_url = response.data[0].url
print(f"Generated image: {image_url}")

Example Response

{
  "created": 1742515200,
  "data": [
    {
      "url": "https://images.qhaigc.net/img/generated_abc123.webp"
    }
  ]
}

Prompt Writing Tips

A well-structured prompt improves output quality significantly. A good prompt typically follows this pattern:
[subject description] + [style] + [quality keywords] + [detail description]
Add these to push for higher-fidelity output: high quality, ultra detailed, 8K resolution, 4K resolution, cinematic, professional photography, exquisite illustration.
Specify an art style: oil painting, watercolor, sketch, anime style, cyberpunk, steampunk, photorealistic, Japanese style, Chinese ink painting.
Control the mood with lighting descriptors: soft lighting, dramatic shadows, backlit, golden hour, blue hour, neon glow.
Generation typically takes 5–15 seconds for standard models and 15–30 seconds for higher-quality models or larger resolutions. Build this latency into your UX.