Getting Started

Image Generation API

Use one OpenAI-compatible endpoint for GPT Image and Wan image models. This page covers authentication, text-to-image requests, Wan-specific parameters, temporary image URLs, billing, and operational limits.

Endpoint and Authentication

Image generation uses the same LingCoreX API key format as other OpenAI-compatible requests.

Endpoint: POST https://api.lingcorex.ai/v1/images/generations
Authentication: Authorization: Bearer YOUR_API_KEY
Content type: application/json
The API key's model group must include the requested image model and provider.
You do not need to call an Alibaba-specific endpoint or send a DashScope request shape. LingCoreX converts the OpenAI-compatible request for Wan models and returns a normalized Images API response.

Supported Image Models

The same endpoint accepts different model IDs, while model capabilities and billing modes remain model-specific.

ModelBest fitOutput and billing
gpt-image-2OpenAI-compatible image generation and GPT Image workflows.Supports the provider's GPT Image options. Usage is settled using the configured image-token prices.
wan2.7-imageFaster Wan text-to-image generation up to 2K.Returns signed image URLs. Supports 1 to 4 images and is billed per successfully returned image.
wan2.7-image-proHigher-quality Wan generation, including 4K text-to-image output.Returns signed image URLs. Supports 1 to 4 images and is billed per successfully returned image.
Model availability depends on the groups assigned to your API key. Use the exact model ID displayed in the dashboard.

Wan Request Parameters

Wan models use a compact OpenAI-compatible request. Omitted optional fields use the defaults shown below.

FieldRequiredDescription
modelYeswan2.7-image or wan2.7-image-pro.
promptYesText description of the image to generate. Chinese and English prompts are supported.
nNoNumber of images. Range: 1 to 4. Default: 1. Billing increases with the number of successful images.
sizeNo1K or 2K for both Wan models; 4K is available only for wan2.7-image-pro text-to-image. Pixel sizes such as 1024x1024 are also accepted. Default: 2K.
response_formatNoWan currently supports url only. Omit this field or set it to url.
watermarkNoBoolean. Adds the provider's AI-generated watermark when true. Default: false.
thinking_modeNoBoolean. Enables enhanced inference for text-to-image. Default: true.
seedNoInteger from 0 to 2147483647. Similar seeds can produce similar results, but output is not deterministic.
color_paletteNoOptional Wan color palette array. Use 3 to 10 HEX colors whose ratios total 100.00%.

Request Examples

These examples all call the same public LingCoreX endpoint.

curl — wan2.7-image
curl https://api.lingcorex.ai/v1/images/generations \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "wan2.7-image",
    "prompt": "A quiet mountain lake at sunrise, cinematic photography, no text",
    "n": 1,
    "size": "1K"
  }'
Python — wan2.7-image-pro
import requests

response = requests.post(
    "https://api.lingcorex.ai/v1/images/generations",
    headers={
        "Authorization": "Bearer YOUR_API_KEY",
        "Content-Type": "application/json",
    },
    json={
        "model": "wan2.7-image-pro",
        "prompt": "A premium studio photograph of a blue glass perfume bottle",
        "n": 1,
        "size": "2K",
        "watermark": False,
    },
    timeout=600,
)
response.raise_for_status()

payload = response.json()
print(payload["data"][0]["url"])
JavaScript — fetch
const response = await fetch(
  "https://api.lingcorex.ai/v1/images/generations",
  {
    method: "POST",
    headers: {
      Authorization: "Bearer YOUR_API_KEY",
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      model: "wan2.7-image",
      prompt: "An isometric illustration of a small green energy laboratory",
      n: 1,
      size: "1024x1024",
    }),
  },
)

if (!response.ok) {
  throw new Error(await response.text())
}

const result = await response.json()
console.log(result.data[0].url)
Image generation can take longer than chat requests. Configure an HTTP timeout of up to 600 seconds for production clients.

Response Format

Wan responses are normalized to the OpenAI Images API shape and include the successful image count.

Successful Wan response
{
  "created": 1784962566,
  "data": [
    {
      "url": "https://example-oss.aliyuncs.com/generated-image.png?SIGNED_QUERY"
    }
  ],
  "usage": {
    "image_count": 1
  }
}
Wan image URLs are signed temporary URLs and remain valid for 24 hours. Download or copy the generated files to your own durable storage promptly, and avoid writing the full signed query string to application logs.

Billing and Settlement

Wan billing is based on successfully returned images rather than token counts.

The gateway estimates the pre-authorization amount from n and the configured per-image price.
Final settlement uses the number of successful image entries returned in data.
If fewer images succeed than requested, only the successful images are settled.
Your account level, model discount, or fixed discount can change the final sell price shown in usage records.
GPT Image models can use image-token billing instead; check the pricing page for the active model configuration.
A failed upstream request is refunded. A successful response records image usage in the dashboard after asynchronous settlement completes.

Common Errors

Use the HTTP status and OpenAI-style error body together when troubleshooting.

StatusMeaningWhat to check
400Invalid or unsupported request parameter.Check model, prompt, n, size, response_format, stream, and partial_images.
401Missing or invalid API key.Check the Authorization header and whether the key is active.
402Insufficient balance for pre-authorization.Recharge the account or review the active spending limits.
403The key cannot use this model/provider.Add the image model to the API key's assigned model group.
429QPM or other rate limit exceeded.Retry with backoff or adjust the key's QPM limit.
502The upstream image provider failed or returned no successful images.Inspect the error message and retry only when appropriate.

Current Wan Compatibility

Need current pricing or the product overview?

Use pricing for the public commercial view, or return to the landing page for the high-level product story.