API 指南 / Trellis 文生图(Qwen-Image)

API 指南 · Trellis 文生图(Qwen-Image)

文生图(T2I),用于角色定妆图 / 场景 / 首帧,按张计费(1K / 2K 分档)。

调用方式
同步:直接 POST 返回结果(建议超时 1200s);超时后请勿自动重试。
异步(推荐):POST 加请求头 X-Trellis-Async: 1 → 返回 202 {id, poll};轮询 GET /v1/jobs/{id}(间隔 5–10s)。

以 JSON 提交 prompt(可选 negative_prompt / size / num_inference_steps / true_cfg_scale / seed / response_format)。

`size` 建议 `1328x1328`:Qwen-Image 原生分辨率约 1328,用 1024 会明显面部/手部糊(加步数无效);num_inference_steps ≥40 即可。

返回 data[].url(或 b64_json)与 usage.image_count、usage.size;按 size 分档计费(1K ¥0.1 / 2K ¥0.2 每张)。

可加 qc:true 同步质检(返回 qc 指标,耗时 ≥25 分钟,不额外收费);否则可用独立质检接口。

调用示例:

cURL
curl https://api.trellis.hk/v1/images/generations \
  -H "Authorization: Bearer sk-xxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"model":"trellis-qwen-image","prompt":"女侠客,白裙,竹林,电影感","size":"1024x1024"}'
所有模型共用同一 API Key 与同一端点:https://api.trellis.hk/v1