HY Image Lite API 接口、参数 & 代码示例

tencent/hy-image-lite

HY Image Lite(混元 Image Lite)是腾讯(Tencent)**推出的一款专注于**高效文生图(Text-to-Image)的轻量化 AI 图像生成模型。HY Image Lite 采用超高压缩编解码器,实现图像生成快速响应与高品质输出。

模型 ID
tencent/hy-image-lite
模型系列
Hunyuan
更新日期
模型能力
图片生成
模型价格(每张)
¥ 0.12

HY Image Lite 模型介绍:

HY Image Lite(混元 Image Lite)是腾讯(Tencent)推出的一款专注于高效文生图(Text-to-Image)的轻量化 AI 图像生成模型。

核心特性与技术亮点

  • 轻量化与极速推理:作为混元图像生成模型的 Lite 版本,它通过模型蒸馏与推理优化,大幅降低了显卡资源占用与出图延迟,极大提升了并发处理能力与生成速度。
  • 原生中文语义理解:针对中文提示词(Prompt)进行了深度优化,对中国传统文化元素(如古风建筑、诗词意境、成语典故、民俗服饰等)以及复杂的中文修饰语拥有极高的理解与还原度。
  • 文字渲染能力:具备良好的图像内文字生成能力,可以在生成的画作或设计图中直接渲染清晰、准确的中英文文本,适合设计海报或电商配图。
  • 高性价比调用:相比 Pro 版模型,HY Image Lite 的 API 调用成本更低、响应更迅速。

典型应用场景

场景类型 适用表现
自媒体与内容创作 快速批量生成文章插图、封面图,秒级出图。
电商与营销设计 快速生成商品展示背景、广告 Banner 营销素材。
移动端与实时交互 适合集成至小程序、APP 或实时绘画交互工具中。
概念草图探索 在创意初期用于快速验证视觉构图与色彩方案。

API 接口地址:

https://wcode.net/api/gpt/v1/images/generations

此 API 接口兼容 OpenAI 的 Images 接口规范,可直接使用 OpenAI 的 SDK 来调用。仅需替换以下配置即可:

  1. base_url 替换为 https://wcode.net/api/gpt/v1
  2. api_key 替换为从 https://platform.wcode.net 获取到的 API Key

具体可参考下方的各编程语言代码示例中的 OpenAI SDK 调用示例。

请求方法:

POST

各编程语言代码示例:

# TODO: 以下代码中的 API_KEY 需要替换,获取 API Key 入口:https://platform.wcode.net
curl --request POST 'https://wcode.net/api/gpt/v1/images/generations' \
  --header 'Content-Type: application/json' \
  --header 'Authorization: Bearer API_KEY' \
  --data '{
    "model": "tencent/hy-image-lite",
    "prompt": "一只可爱的小猫咪,坐在阳光明媚的窗台上,背景是蓝天白云"
  }'
import Foundation

let headers = [
  "Authorization": "Bearer API_KEY",  // TODO: 这里的 API_KEY 需要替换,获取 API Key 入口:https://platform.wcode.net
  "Content-Type": "application/json"
]
let parameters = [
  "model": "tencent/hy-image-lite",
  "prompt": "一只可爱的小猫咪,坐在阳光明媚的窗台上,背景是蓝天白云"
] as [String : Any]

let postData = try! JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "https://wcode.net/api/gpt/v1/images/generations")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 60.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if let data = data {
    print(String(data: data, encoding: .utf8) ?? "")
  }
})
dataTask.resume()
import 'dart:convert';
import 'package:http/http.dart' as http;

Future<void> main() async {
  final response = await http.post(
    Uri.parse('https://wcode.net/api/gpt/v1/images/generations'),
    headers: {
      'Authorization': 'Bearer API_KEY',  // TODO: 这里的 API_KEY 需要替换,获取 API Key 入口:https://platform.wcode.net
      'Content-Type': 'application/json',
    },
    body: jsonEncode({
      'model': 'tencent/hy-image-lite',
      'prompt': '一只可爱的小猫咪,坐在阳光明媚的窗台上,背景是蓝天白云',
    }),
  );

  print(response.body);
}
require 'uri'
require 'json'
require 'net/http'

url = URI("https://wcode.net/api/gpt/v1/images/generations")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer API_KEY'  # TODO: 这里的 API_KEY 需要替换,获取 API Key 入口:https://platform.wcode.net
request["Content-Type"] = 'application/json'
request.body = {
  model: 'tencent/hy-image-lite',
  prompt: '一只可爱的小猫咪,坐在阳光明媚的窗台上,背景是蓝天白云'
}.to_json

response = http.request(request)
puts response.read_body
#[tokio::main]
pub async fn main() {
  let client = reqwest::Client::new();
  let response = client.post("https://wcode.net/api/gpt/v1/images/generations")
    .header("Authorization", "Bearer API_KEY")  // TODO: 这里的 API_KEY 需要替换,获取 API Key 入口:https://platform.wcode.net
    .header("Content-Type", "application/json")
    .json(&serde_json::json!({
      "model": "tencent/hy-image-lite",
      "prompt": "一只可爱的小猫咪,坐在阳光明媚的窗台上,背景是蓝天白云"
    }))
    .send()
    .await
    .unwrap();

  println!("{}", response.text().await.unwrap());
}
CURL *hnd = curl_easy_init();

curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "https://wcode.net/api/gpt/v1/images/generations");

struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "Content-Type: application/json");
headers = curl_slist_append(headers, "Authorization: Bearer API_KEY");  // TODO: 这里的 API_KEY 需要替换,获取 API Key 入口:https://platform.wcode.net
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);

const char *data = "{\"model\":\"tencent/hy-image-lite\",\"prompt\":\"一只可爱的小猫咪,坐在阳光明媚的窗台上,背景是蓝天白云\"}";
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, data);

CURLcode ret = curl_easy_perform(hnd);
package main

import (
  "bytes"
  "fmt"
  "io"
  "net/http"
)

func main() {
  url := "https://wcode.net/api/gpt/v1/images/generations"
  payload := []byte(`{"model":"tencent/hy-image-lite","prompt":"一只可爱的小猫咪,坐在阳光明媚的窗台上,背景是蓝天白云"}`)

  req, _ := http.NewRequest("POST", url, bytes.NewBuffer(payload))
  req.Header.Add("Authorization", "Bearer API_KEY")  // TODO: 这里的 API_KEY 需要替换,获取 API Key 入口:https://platform.wcode.net
  req.Header.Set("Content-Type", "application/json")

  res, _ := http.DefaultClient.Do(req)
  defer res.Body.Close()
  respBody, _ := io.ReadAll(res.Body)

  fmt.Println(string(respBody))
}
using System.Net.Http.Json;

var client = new HttpClient();
client.DefaultRequestHeaders.Add("Authorization", "Bearer API_KEY");  // TODO: 这里的 API_KEY 需要替换,获取 API Key 入口:https://platform.wcode.net

var payload = new {
  model = "tencent/hy-image-lite",
  prompt = "一只可爱的小猫咪,坐在阳光明媚的窗台上,背景是蓝天白云"
};

var response = await client.PostAsJsonAsync("https://wcode.net/api/gpt/v1/images/generations", payload);
Console.WriteLine(await response.Content.ReadAsStringAsync());
var client = new RestClient("https://wcode.net/api/gpt/v1/images/generations");

var request = new RestRequest("", Method.Post);
request.AddHeader("Authorization", "Bearer API_KEY");  // TODO: 这里的 API_KEY 需要替换,获取 API Key 入口:https://platform.wcode.net
request.AddHeader("Content-Type", "application/json");
request.AddJsonBody(new {
  model = "tencent/hy-image-lite",
  prompt = "一只可爱的小猫咪,坐在阳光明媚的窗台上,背景是蓝天白云"
});

var response = client.Execute(request);
Console.WriteLine(response.Content);
const axios = require('axios');

let config = {
  method: 'post',
  maxBodyLength: Infinity,
  url: 'https://wcode.net/api/gpt/v1/images/generations',
  headers: {
    'Authorization': 'Bearer API_KEY',  // TODO: 这里的 API_KEY 需要替换,获取 API Key 入口:https://platform.wcode.net
    'Content-Type': 'application/json'
  },
  data: {
    model: 'tencent/hy-image-lite',
    prompt: '一只可爱的小猫咪,坐在阳光明媚的窗台上,背景是蓝天白云'
  }
};

axios.request(config).then((response) => {
  console.log(JSON.stringify(response.data));
}).catch((error) => {
  console.log(error);
});
OkHttpClient client = new OkHttpClient();

MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"model\":\"tencent/hy-image-lite\",\"prompt\":\"一只可爱的小猫咪,坐在阳光明媚的窗台上,背景是蓝天白云\"}");

Request request = new Request.Builder()
  .url("https://wcode.net/api/gpt/v1/images/generations")
  .post(body)
  .addHeader("Authorization", "Bearer API_KEY")  // TODO: 这里的 API_KEY 需要替换,获取 API Key 入口:https://platform.wcode.net
  .addHeader("Content-Type", "application/json")
  .build();

Response response = client.newCall(request).execute();
$client = new \GuzzleHttp\Client();

$response = $client->post('https://wcode.net/api/gpt/v1/images/generations', [
  'headers' => [
    'Authorization' => 'Bearer API_KEY',  // TODO: 这里的 API_KEY 需要替换,获取 API Key 入口:https://platform.wcode.net
  ],
  'json' => [
    'model' => 'tencent/hy-image-lite',
    'prompt' => '一只可爱的小猫咪,坐在阳光明媚的窗台上,背景是蓝天白云',
  ],
]);

echo $response->getBody();
$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://wcode.net/api/gpt/v1/images/generations",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 5,
  CURLOPT_TIMEOUT => 300,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => json_encode([
    'model' => 'tencent/hy-image-lite',
    'prompt' => '一只可爱的小猫咪,坐在阳光明媚的窗台上,背景是蓝天白云',
  ]),
  CURLOPT_HTTPHEADER => [
    "Authorization: Bearer API_KEY",  // TODO: 这里的 API_KEY 需要替换,获取 API Key 入口:https://platform.wcode.net
    "Content-Type: application/json",
  ],
]);

$response = curl_exec($curl);
$error = curl_error($curl);

curl_close($curl);

if ($error) {
  echo "cURL Error #:" . $error;
} else {
  echo $response;
}
import requests
import json

url = "https://wcode.net/api/gpt/v1/images/generations"

headers = {
  "Authorization": "Bearer API_KEY",  # TODO: 这里的 API_KEY 需要替换,获取 API Key 入口:https://platform.wcode.net
  "Content-Type": "application/json",
}

payload = {
  "model": "tencent/hy-image-lite",
  "prompt": "一只可爱的小猫咪,坐在阳光明媚的窗台上,背景是蓝天白云"
}

response = requests.post(url, headers=headers, json=payload)

print(json.dumps(response.json(), indent=4, ensure_ascii=False))
from openai import OpenAI

client = OpenAI(
  base_url="https://wcode.net/api/gpt/v1",
  api_key="API_KEY"  # TODO: 这里的 API_KEY 需要替换,获取 API Key 入口:https://platform.wcode.net
)

response = client.images.generate(
  model="tencent/hy-image-lite",
  prompt="一只可爱的小猫咪,坐在阳光明媚的窗台上,背景是蓝天白云",
)

print(response.data[0].url)

请求参数:

重要提示:由于模型架构不同,部分参数可能仅适用于特定的模型。

model(模型 ID)

  • 参数:model

  • 必选string

图像生成模型 ID。调用时使用模型详情页的模型 ID。

prompt(提示词)

  • 参数:prompt

  • 必选string

描述所需生成图像内容的文本提示。

negative_prompt(反向提示词)

  • 参数:negative_prompt

  • 可选,string,≤ 256 字符

描述不希望在图像中出现的内容,用于限制画面。

推荐使用中文,最多可传 256 个 utf-8 字符。

size(图片尺寸)

  • 参数:size

  • 可选,string

  • 取值范围:768x768 | 768x1024 | 1024x768 | 1024x1024 | 720x1280 | 1280x720 | 768x1280 | 1280x768 | 1080x1920 | 1920x1080

  • 默认:768x768

生成图像的尺寸。

格式为 宽x高,默认 768x768

response_format(图像的返回格式)

  • 参数:response_format

  • 可选,string

  • 取值范围:url | b64_json

  • 默认:url

指定生成图像的返回格式。

支持以下两种返回方式:

  • url:返回图片下载链接;链接在图片生成后 2 小时内有效,请及时下载图片。
  • b64_json:以 Base64 编码字符串的 JSON 格式返回图像数据。

以上文档为标准版 API 接口文档,可直接用于项目开发和系统调用。如果标准版 API 接口无法满足您的需求,需要定制开发 API 接口,请联系我们的 IT 技术支持工程师:

(沟通需求✅ → 确认技术方案✅ → 沟通费用与工期✅ → 开发&测试✅ → 验收交付✅ → 维护升级✅)

最受关注模型

DeepSeek V4 Pro

文本生成、深度思考

DeepSeek V4 Flash

文本生成、深度思考

Qwen3.7 Max

文本生成、深度思考

Tencent Hunyuan Hy3

文本生成、深度思考、Agent增强

Qwen3.7 Plus

文本生成、深度思考、视觉理解

最新发布模型

HY Image Lite

图片生成

Qwen Image 3.0

图片生成、长指令支持

Qwen3.8 Max

深度思考、视觉理解、文本生成

DeepSeek V4 Flash

文本生成、深度思考

DeepSeek V4 Pro

文本生成、深度思考

向量化模型

Qwen3.7 Text Embedding

文本向量化

GLM Embedding 3

文本向量化

Qwen3 Embedding 8B

文本嵌入、文本向量化

Doubao Embedding Large Text 250515

文本向量化

Qwen Text Embedding V4

文本向量化

语音识别模型

MiMo V2.5 ASR

音频识别

Fun ASR Flash

语音识别、方言识别

Qwen3 ASR Flash

语音识别

GLM ASR 2512

语音识别

语音合成模型

Qwen Audio 3.0 TTS Plus

语音合成

Qwen Audio 3.0 TTS Flash

语音合成

CosyVoice V3 Plus

语音合成

CosyVoice V3 Flash

语音合成

GLM TTS

语音合成