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/txt2img
文本到图像端点,只会返回一个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/txt2img' \
--header 'Authorization;' \
--header 'Content-Type: application/json' \
--data-raw '{
  "extra": {
    "response_image_type": "jpeg",
    "enable_nsfw_detection": true,
    "custom_storage": {
      "aws_s3": {
        "region": "us-east-2",
        "bucket": "test_bucket",
        "path": "/"
      }
    },
    "enterprise_plan": {
      "enabled": true
    }
  },
  "request": {
    "model_name": "anyhentai_20_31826.safetensors",
    "prompt": "nsfw, 1girl, (solo:1.1), small breasts, topless, nipples, thongs, thigh, slicked back short hair, half body in pool, outdoor, pool side, very sexy, wet body, modern villa, southern france, soft light, realistic, intricate details, (light freckles:0.5), lightly tanned, professional photography, depth of field, amazing eyes, (smooth hands:1.1), photoshoot, detailed background, professional model, ultra 4k, photorealist, lace panties",
    "negative_prompt": "(badhandv4:1.2),(worst quality:2),(low quality:2),(normal quality:2),lowres,bad anatomy,bad hands,((monochrome)),((grayscale)) watermark,moles, easynegative ng_deepnegative_v1_75t, (oversized head:2), (big head:2), (deformed face:1.5),( blurry face:2), bad eyes, irregular eyes, asymmetric eyes, ugly, teeth, (navel:0.9), artefact, jpg artefact, blurry face, blurry, blurred, pixelated, bad eyes, crossed eyes, blurry eyes, nipple",
    "sd_vae": "",
    "loras": [
      {
        "model_name": "",
        "strength": null
      }
    ],
    "embeddings": [
      {
        "model_name": ""
      }
    ],
    "hires_fix": {
      "target_width": null,
      "target_height": null,
      "strength": null
    },
    "refiner": {
      "switch_at": null
    },
    "width": 512,
    "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 
必需
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。
prompt
string 
必需
肯定提示词,用“,”分隔。
negative_prompt
string 
必需
否定提示词,用“,”分隔
sd_vae
string 
可选
VAE(Variational Auto Encoder),sd_vae 可以在 api /v2/models 中通过查询参数 type=vae 访问,如 'sd_name': 'customVAE.safetensors'
loras
array [object {2}] 
可选
Lora选项,目前最多支持5个Lora
embeddings
array [object {1}] 
可选
文本反转选项,当前支持最多 5 个嵌入
hires_fix
object 
可选
refiner
object 
SD精炼机。
可选
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 
必需
上一页
获取异步任务结果
下一页
图像到图像
Built with