Novita.ai
  1. 基础 API V3
Novita.ai
  • Novita.ai
  • 账户接口
    • 配置s3配置
      POST
    • 查询s3配置
      GET
    • 删除 s3 配置
      DELETE
    • 用户信息
      GET
  • 基本 API
    • 文字转图像
      POST
    • 图像到图像
      POST
    • 进步
      GET
    • 广告商
      POST
  • 基础 API V3
    • 使用 lcm 将文本转为图像
      POST
    • 使用 lcm 进行图像到图像
      POST
    • 获取异步任务结果
      GET
    • 文字转图像
      POST
    • 图像到图像
      POST
  • 模型 API
    • 同步 civitai 模型
      POST
    • 查询 civitai 模型
      GET
    • 查询模型
      GET
  • 案例 API
    • Upscale
      POST
    • 清除
      POST
    • 外画
      POST
    • 删除背景
      POST
    • 删除文字
      POST
    • 重新想象
      POST
    • 涂鸦
      POST
    • 混合姿势
      POST
    • 替换背景
      POST
    • 替换天空
      POST
    • 恢复面容
      POST
    • 创建图块
      POST
    • 去除水印
      POST
    • 合并面
      POST
    • 替换对象
      POST
    • 图片提示
      POST
    • 制作照片
      POST
    • 要遮罩的图像
      POST
  • 培训 API
    • 获取图片网址
    • 接受学科培训
    • 创建学科培训
    • 创建风格训练
    • 接受风格培训
    • 列出训练任务
  • 视频 API
    • 图像转视频 API
    • 图像到视频运动 API
    • 文本转视频 API
  1. 基础 API V3

图像到图像

开发环境
http://dev-cn.your-api-server.com
开发环境
http://dev-cn.your-api-server.com
POST
/v3/async/img2img
图像到图像端点,只会返回一个task_id。您应该使用task_id调用https://docs.novita.ai/task-api/get-async-task-result端点来检索图像生成结果。
请求示例请求示例
Shell
JavaScript
Java
Swift
curl --location --request POST 'http://dev-cn.your-api-server.com/v3/async/img2img' \
--header 'Authorization;' \
--header 'Content-Type: application/json' \
--data-raw '{
  "extra": {
    "response_image_type": "jpeg",
    "enable_nsfw_detection": false,
    "custom_storage": {
      "aws_s3": {
        "region": "us-east-2",
        "bucket": "test_bucket",
        "path": "/"
      }
    },
    "enterprise_plan": {
      "enabled": true
    }
  },
  "request": {
    "model_name": "chilloutmix_NiPrunedFp32Fix.safetensors",
    "image_base64": "{{Base64 encode image}}",
    "prompt": "a cute dog",
    "negative_prompt": "",
    "sd_vae": "",
    "controlnet": [
      [
        {
          "model_name": "control_v11f1e_sd15_tile",
          "image_base64": "{{Base64 encode image}}",
          "strength": 1,
          "preprocessor": "openpose",
          "guidance_start": null,
          "guidance_end": null
        }
      ]
    ],
    "loras": [
      {
        "model_name": "MS_Real_AssSpread",
        "strength": 0.7
      },
      {
        "model_name": "MS_Real_Cameltoe_Lite",
        "strength": 0.9
      }
    ],
    "embeddings": [
      {
        "model_name": "pureerosface_v1_5162.pt"
      }
    ],
    "width": 384,
    "height": 512,
    "image_num": 1,
    "steps": 20,
    "seed": 123,
    "clip_skip": 1,
    "guidance_scale": 7.5,
    "sampler_name": "Euler a"
  }
}'
响应示例响应示例
{
  "task_id": "b49df8dc-4a72-474b-a863-d1e11b007109"
}

请求参数

Header 参数
Authorization
string 
必需
Content-Type
string 
必需
示例值:
application/json
Body 参数application/json
extra
object 
必需
response_image_type
string 
必需
enable_nsfw_detection
boolean 
必需
custom_storage
object 
必需
enterprise_plan
object 
必需
request
object 
必需
model_name
string 
必需
检查点的名称,您可以调用 /v2/models 端点来检索 sd_name 字段作为 model_name。
image_base64
string 
必需
原始图像的base64,最大分辨率为16兆像素,最大文件大小为10 Mb。
prompt
string 
必需
肯定提示词,用“,”分隔。
negative_prompt
string 
必需
否定提示词,用“,”分隔
sd_vae
string 
可选
VAE(Variational Auto Encoder),sd_vae 可以在 api /v2/models 中通过查询参数 type=vae 访问,如 'sd_name': 'customVAE.safetensors'
controlnet
array [array] 
控制网信息
可选
loras
array [object {2}] 
可选
Lora选项,目前最多支持5个Lora
embeddings
array [object {1}] 
可选
文本反转选项,当前支持最多 5 个嵌入
width
integer 
图像的宽度。
必需
height
integer 
图像的高度。
必需
image_num
integer 
必需
一代人生成的图像数量。
steps
integer 
必需
将步骤视为图像创建过程的迭代。
seed
integer 
必需
种子是稳定扩散产生噪声的数字。
clip_skip
integer 
必需
剪辑跳过,必须大于 0。
guidance_scale
number 
必需
此设置表示稳定扩散将听取您的提示的程度。
sampler_name
string 
必需
这个去噪过程称为采样,因为稳定扩散在每个步骤中都会生成一个新的样本图像。
示例

返回响应

🟢200成功
application/json
Body
task_id
string 
必需
上一页
文字转图像
下一页
同步 civitai 模型
Built with