Tài liệu API

API tạo hình ảnh

Gọi các mô hình hình ảnh đang có, quản lý định dạng đầu ra và theo dõi chi phí tạo ảnh.

Tóm tắt hướng dẫn

Gọi các mô hình hình ảnh đang có, quản lý định dạng đầu ra và theo dõi chi phí tạo ảnh.

Gọi các mô hình hình ảnh đang có, quản lý định dạng đầu ra và theo dõi chi phí tạo ảnh.

Ví dụ mã

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)

Ví dụ mã 2

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
  }
}

Danh sách kiểm tra tích hợp

01

1

Tạo khóa API trong bảng điều khiển và chọn đúng nhóm mô hình.

02

2

Chạy ví dụ trong môi trường thử nghiệm rồi kiểm tra lỗi và bản ghi sử dụng.

03

3

Trước production, xác minh QPM, ngân sách và giá mô hình thực tế.

Bạn cần bảng giá hay tổng quan sản phẩm?

Xem trang giá cho thông tin thương mại mới nhất và trang chủ cho tổng quan sản phẩm.