图像生成指南

了解如何使用我们强大的图像生成工具来创建、修改和放大图像。

查看 API 参考

由 SDNext 和 vLLM-Omni 提供支持

Arli AI 图像生成运行在 SDNext 和 vLLM-Omni 上。SDNext 模型提供 Stable Diffusion API 的广泛子集(采样器、调度器、细节器、IP-Adapter、ControlNet 和放大)。vLLM-Omni 模型提供固定的采样器/调度器流水线,支持 size、steps、guidance、flow shift 以及模型特定的额外参数等 OpenAI Images 参数。

https://github.com/vladmandic/sdnexthttps://github.com/vllm-project/vllm-omni

身份验证与使用

所有图像生成 API 端点都需要通过 Authorization 标头进行 Bearer Token 或 Basic 身份验证。请将示例中的 {ARLIAI_API_KEY} 替换为您的实际 API 密钥。对于 Basic 认证,请将您的 API 密钥用作密码并进行 Base64 编码(例如 Authorization: Basic Base64Encode(ARLIAI_API_KEY))。

API 请求会根据模型要求和可用性路由到适当的后端服务器。请确保您的账户已通过相关端点(`/sd-models`、`/upscalers`)获得使用特定图像生成模型或放大器模型的权限。

图像生成和放大请求受账户套餐对应的速率限制和并发限制约束。超出限制可能导致账户被临时限制。请查看账户仪表板了解您的限制详情。

API 密钥参数覆盖(在账户设置中设置)将与请求正文中发送的参数合并,并对兼容参数优先应用。

成功的 POST 请求(txt2img、img2img、extra-single-image)通常返回一个 JSON 对象,其中 images 字段(放大时为 image)包含 base64 编码的图像列表,info 字段包含生成参数。成功的 GET 请求返回各自章节中描述的 JSON 数据。

vLLM-Omni 模型与 OpenAI Images API

Some image models on Arli AI run on vLLM-Omni instead of SD.Next. The SDNext-compatible /v1/txt2img, /v1/img2img, /sdapi/v1/txt2img, and /sdapi/v1/img2img endpoints still work for both engines, and vLLM-Omni models also expose the OpenAI Images API.

  • SDNext-compatible text-to-image and img2img requests are translated automatically: width/height become size, steps becomes num_inference_steps, cfg_scale becomes guidance_scale, batch_size becomes n, and denoising_strength becomes strength. flow_shift and the SLG extra_params keys are forwarded for vLLM-Omni text-to-image.
  • vLLM-Omni models use a fixed sampler and scheduler. sampler_name, most scheduler fields, detailer, IP-Adapter, and ControlNet fields are not applied; schedulers_shift is used as a fallback for flow_shift on text-to-image. ControlNet generation and preprocessing are SD.Next-only.
  • Per-model limits are enforced by the API: maxSteps (default 40), maxBatchSize, maxCfgScale (default 30), and sizeMultiple. MOSS-Image requires dimensions in multiples of 16; MiniMax-H3-Image uses a 32-pixel grid. Read the exact values from GET /v1/img-models.
  • SDNext-style img2img requires supportsImg2Img, and sending a mask requires supportsInpaint. OpenAI edits require supportsImg2Img. MOSS-Image-SFT is text-to-image only.
  • OpenAI image edits use multipart form data and are supported by edit-capable vLLM-Omni models such as MiniMax-H3-Image. flow_shift and extra_params are text-to-image only and are not applied to edits.

OpenAI Images 端点

  • POST /v1/images/generations requires model and a healthy vLLM-Omni server. It accepts prompt, negative_prompt, size (or width/height), n, seed, num_inference_steps, guidance_scale, true_cfg_scale, flow_shift, extra_params (SLG keys only), output_format, output_compression, generator_device, layers, resolution, strength, sigmas, num_frames, bot_task, system_prompt, use_system_prompt, and return_stage_metrics. response_format is accepted but images are always returned in data[].b64_json. n must be 1-10 and cannot exceed the model maxBatchSize.
  • POST /v1/images/edits requires model and supportsImg2Img. Send multipart image/image[] plus optional mask_image or reference_image, or JSON base64 image, images, init_images, mask, or mask_image. Edits accept prompt, negative_prompt, size (defaults to the input image or auto), n, num_inference_steps, guidance_scale, true_cfg_scale, strength, seed, generator_device, layers, resolution, output_format, output_compression, bot_task, system_prompt, and return_stage_metrics. flow_shift and extra_params are not applied to edits.
  • GET /v1/images/models lists only models with a healthy vLLM-Omni server in OpenAI model-list format. GET /v1/img-models returns the full catalog with engine, per-model limits, capability flags, and curated defaults. vLLM-Omni models can also be used through /sdapi/v1/txt2img, /v1/txt2img, /sdapi/v1/img2img, and /v1/img2img when their capability flags allow it.

文生图生成

文生图页面允许您根据文本描述(“提示词”)创建图像。您描述想要看到的内容,AI 将为您生成。

使用方法

  1. 选择符合您所需风格的 Model Checkpoint。
  2. 编写详细的 Prompt,描述您想要创建的图像。
  3. (可选)使用 Negative Prompt 列出您想要避免的内容。
  4. 选择 Sampler 并设置 Steps(20-30 是一个不错的起点)。
  5. 调整 CFG Scale 以控制 AI 遵循提示词的紧密程度(6 是一个不错的默认值)。
  6. 设置所需的 Resolution 和 Batch Size。
  7. 点击“Generate Image”。

核心功能

  • Prompt & Negative Prompt:在提示词中描述您想要的图像。使用负面提示词指定要避免的内容(例如“low quality, blurry”)。
  • Model Checkpoint:这是最重要的设置。每个模型都有独特的艺术风格。有些模型更适合写实,另一些更适合动漫或奇幻。多尝试以找到您最喜欢的。
  • Loading Defaults:每个模型可能有推荐的提示词和采样器设置。使用 Prompt 和 Sampler 部分旁边的“Load Defaults”按钮来应用这些优化设置。这是开始使用新模型的好方法。
  • Sampler & Steps:采样器决定 AI 如何从噪声生成图像。不同的采样器会产生不同的结果。更多步数可以增加细节,但生成时间更长。一个不错的起点是 20-30 步。
  • CFG Scale:“Classifier-Free Guidance”控制 AI 遵循提示词的严格程度。较低的值(例如 4-6)给 AI 更多创作自由。较高的值(例如 7-10)使其更贴近您的描述。
  • Resolution:设置图像的宽度和高度。使用常见宽高比的预设,或通过滑块设置自定义尺寸。
  • Batch Size:一次生成多张图像。这对于探索提示词的不同变化很有用。
  • Seed:决定初始噪声模式的数字。使用相同的种子和相同的设置将生成几乎相同的图像。使用 -1 表示随机种子,这是默认值。

高级功能

  • Detailer Pass:这是在主图像生成后运行的可选第二通道。它旨在修复和改善小细节,尤其是可能变形的脸部和手部。您可以选择特定模型(例如用于脸部的 `face-yolo8n`),甚至为此通道提供单独的更详细的提示词。“Detailer Strength”控制细节修复器对原始生成结果的改变程度。
  • Upscaling:启用后,可在同一过程中自动将生成的图像放大到更高分辨率。选择放大器模型和缩放系数。这是一步获得高质量最终图像的便捷方法。
  • History:右侧面板会保留详细的生成历史。点击任何项目都会加载其精确设置,包括提示词、模型、种子和所有其他参数,让您可以完美重现或迭代之前的图像。
Text-to-Image Settings 1Text-to-Image Settings 2Text-to-Image Settings 3

图生图

此工具会根据您的文本提示词转换现有图像。

使用方法(Img2Img)

  1. 上传起始 Input Image。
  2. 编写 Prompt,描述您希望如何转换图像。
  3. 设置 Denoising Strength。这是关键:较低的值会产生细微变化,较高的值会根据提示词创建新图像。
  4. 根据需要调整 Sampler、Steps 和 CFG Scale 等其他设置。
  5. 点击“Generate Image”。

使用方法(Inpaint)

  1. 上传起始 Input Image。
  2. 选择 Inpaint 选项卡。
  3. 使用画笔在要更改的区域上绘制蒙版。
  4. 编写 Prompt,描述您希望在蒙版区域看到的内容。
  5. 调整 Denoising Strength 和其他设置。
  6. 点击“Generate Image”。

模式

  • Img2Img:标准模式,整个输入图像会根据您的提示词和设置进行转换。
  • Inpaint:此模式允许您“遮罩”图像的特定区域。只有被遮罩(绘制)的区域会由 AI 重新生成,非常适合有针对性的编辑,例如更改对象、添加元素或修复错误。

关键设置

  • Input Image:上传您想要转换的图像。
  • Denoising Strength:这是 Img2Img 最重要的设置。它控制原始图像被改变的程度。较低的值(例如 0.2-0.4)会进行尊重原始构图的细微更改。较高的值(例如 0.7-0.9)会创建受提示词影响更大的、截然不同的图像。

局部重绘功能

  • Brush/Eraser:使用画笔在要更改的区域上绘制蒙版。您可以切换到橡皮擦来细化蒙版边缘。
  • Mask Blur:模糊蒙版边缘。这有助于在原始图像和新生成部分之间创建更平滑、更无缝的过渡。
  • Inpaint Full Res:选中后,局部重绘将在图像的完整原始分辨率上执行,从而提供最高质量的结果。未选中时,图像会被缩小以进行重绘处理,速度更快但细节可能略少。未选中时,主分辨率滑块将被禁用,并自动匹配输入图像尺寸。
Image-to-Image Settings 1Image-to-Image Settings 2Image-to-Image Settings 3

图像放大

在增加细节的同时提高图像分辨率。

使用方法

  1. 上传您想要放大的图像。
  2. 选择 Upscaler 模型。
  3. 选择 Upscale Factor(例如 2x、4x)。
  4. 点击“Upscale Image”。
Image Upscaling