GPTNB Docs
Docs
Docs
  1. SDXL
  • 发出请求
  • OpenAI接口
    • Realtime文档
    • 聊天接口(Chat)
      • gpts
      • 聊天补全
    • 自动补全接口(Completions)
      • 内容补全接口
    • 图像接口(Images)
      • DALL·E 3
      • gpt-4-all(生成图片)
    • 向量生成接口(Embeddings)
      • 创建嵌入
    • 音频接口(Audio)
      • 创建转录
      • 创建翻译
      • TTS文本转语音
  • 图片接口
    • Midjourney
      • 补充 - 其他参数以及回调
      • 换脸任务提交
        • 提交swap_face任务
      • 任务提交
        • 绘图变化(UPSCALE; VARIATION; REROLL)
        • 执行动作(所有的关联按钮动作UPSCALE; VARIATION; REROLL; ZOOM等)
        • 绘图变化-simple(UPSCALE; VARIATION; REROLL)
        • 提交Blend任务(图生图)
        • 提交Describe任务(图生文)
        • 提交Imagine任务(文生图、文图生图)
        • 提交Modal(提交局部重绘、ZOOM)
        • 提交Shorten任务(prompt分析)
      • 任务查询
        • 根据ID列表查询任务
        • 指定ID获取任务
        • 获取任务图片的seed
    • Stable Diffusion(官方格式)
      • SD3
        • Stable Image Ultra
        • Stable Image Core
        • Stable Diffusion 3
      • SDXL
        • Text-to-image
          POST
    • Flux
      • 官方格式
        • 生成图像(image)
        • 查询任务(get_result)
      • OpenAI格式
        • Flux
    • Ideogram(官方格式)
      • Generate(文生图)
      • Remix(混合图)
      • Upscale(放大高清)
      • Describe(描述)
    • 其他图像API1(开发中)
      • 创建抠图任务
      • 获取图片压缩结果
      • 获取抠图结果
      • 创建图片变清晰任务
      • 获取图片变清晰结果
      • 创建图像修复任务
      • 获取图像修复结果
      • 创建背景生成任务
      • 获取背景生成结果
      • 创建证件照制作任务
      • 获取证件照制作结果
      • 创建图像上色任务
      • 获取黑白图像上色结果
      • 创建图片压缩任务
      • 创建OCR任务
      • 获取OCR结果
      • 创建图片智能切边任务
      • 获取图片智能切边结果
    • 其他图像API2(开发中)
      • 开放API接口
        • 生成图片融合(图片融合)
        • 生成图片(AI艺术二维码)
        • 生成创意文字(AI艺术字(艺术、光影、隐藏文字))
        • 回调演示
        • 查询详情
        • 获取模板列表
        • 获取模型列表
      • 示例
        • 生成图片融合示例
        • 1.自定义调用- 普通示例(艺术二维码调用示例)
        • 2.自定义调用 - 不同版本(艺术二维码调用示例)
        • 3.自定义调用 -二维码强度(艺术二维码调用示例)
        • 4.模版调用 - 普通示例(艺术二维码调用示例)
        • 5.模版调用 - 二维码强度(艺术二维码调用示例)
        • 6.自定义调用 - 上传图片(艺术二维码调用示例)
        • 7.不同码眼调用(艺术二维码调用示例)
        • 8.不同版本(艺术二维码调用示例)
        • 1.光影文字 - 使用模版(AI艺术字调用示例)
        • 2.光影文字 - 自定义prompt调用(AI艺术字调用示例)
        • 3.艺术字调用 - 使用模版(AI艺术字调用示例)
        • 基础调用(MX绘画-生成类接口-Cute-生成示例(必看))
        • 基础调用 - 自定义尺寸(MX绘画-生成类接口-Cute-生成示例(必看))
        • 基础调用-开启审核(MX绘画-生成类接口-Cute-生成示例(必看))
        • 融合模型调用(MX绘画-生成类接口-Cute-生成示例(必看))
        • 反词 - 替换默认反词(MX绘画-生成类接口-Cute-生成示例(必看))
        • 反词 - 追加反词(MX绘画-生成类接口-Cute-生成示例(必看))
  • 音乐接口
    • Suno
      • 官方格式(v2)
        • 所有接口
          • 音乐链接转成suno(upload)
          • 音乐生成(generations)
          • 查询任务(feed)
          • 获取完整音乐(concat)
        • 场景1 生成自定义音乐(带歌词)
          • 音乐生成(generations)
          • 查询任务(feed)
        • 场景 2 通过提示词直接生成音乐(带歌词)
          • 音乐生成(generations)
          • 查询任务(feed)
        • 场景 4 通过提示词直接生成音乐(纯音乐)
          • 音乐生成(generations)
          • 查询任务(feed)
        • 场景 3 生成自定义音乐(纯音乐)
          • 音乐生成(generations)
          • 查询任务(feed)
        • 场景 5 上传自定义音频并续写
          • 音乐链接转成suno(upload)
          • 音乐生成(generations)
          • 查询任务(feed)
        • 场景 6 续写音乐并获取完整音乐
          • 步骤 1 音乐生成
          • 步骤 3 扩展音乐
          • 步骤 2 查询任务
          • 步骤 4 查询拓展的任务
          • 步骤 6 查询完整音乐的任务
          • 步骤 5 获取完整音乐
        • 场景 7 Cover音乐(音乐翻版,修改风格)
          • 步骤 1 音乐生成
          • 步骤 2 查询任务
          • 步骤 3 Cover 音乐
          • 步骤 4 查询拓展的任务
  • 视频接口
    • Luma
      • GoAmzAI格式
        • 付费版
          • 生成视频
          • 获取视频
        • 免费版
          • 生成视频
          • 获取视频
      • 官方格式(v2)
        • 提交生成视频任务
        • 查询单个任务
        • 扩展视频
        • 获取视频无水印链接
    • CogVideoX(官方格式)
      • 生成(generations)
      • 查询(async-result)
    • Vidu(官方格式)
      • 普通
        • 创建视频(tasks)
        • 高清视频(tasks)
        • 视频状态(state)
        • 视频查询(tasks-get)
    • Pika
      • feed
      • generate(文本)
      • generate(参考图片)
      • generate(参考视频/扩展视频)
    • Runway
      • v1格式
        • feed
        • generate(文本)
        • generate(参考图片)
      • 官方格式(v2)
        • 生成视频(tasks)
        • 查询任务
    • Pixverse
      • @回调说明
      • @接口说明
      • generate(文本)
      • feed
      • generate(参考图片)
    • 可灵(官方格式)
      • 图像生成
      • 文生视频
      • 图生视频
      • 查询任务
    • Viggle(开发中)
      • Mix上传视频并生成视频
      • 查询视频任务
      • Multi模板列表
      • Mix官方模板列表
      • Mix上传视频素材库
      • Mix上传图片素材库
      • 剩余积分查询
      • Multi上传视频并生成视频
      • Move上传视频并生成视频
  • PPT接口
    • 文多多(官方格式)
      • 创建接口token
      • 查询API信息
      • 分页查询 PPT 模板
      • 更换 PPT 模板
      • 修改大纲
      • 接口鉴权
      • 解析文件内容
      • 生成大纲
      • 生成大纲内容
      • 随机 PPT 模板
      • 直接生成PPT
      • 获取 PPT 列表
      • 加载 PPT 数据
      • 下载 PPT
      • 更新 PPT 属性
      • 保存 PPT
      • 删除PPT
      • 生成大纲内容同时异步生成PPT
      • 查询异步生成PPT信息
      • ppt转json
      • json转ppt
  • 帮助中心
    • 常见问题及解决办法
  1. SDXL

Text-to-image

POST
/sd/v1/generation/{engine_id}/text-to-image
SDXL & SD1.6
Generate an image from a text prompt.

Using SDXL 1.0#

Use stable-diffusion-xl-1024-v1-0 as the engine_id of your request and pass in height & width as one of the following combinations:
1024x1024
1152x896
896x1152
1216x832
1344x768
768x1344
1536x640
640x1536.

Using SD 1.6#

Pass in stable-diffusion-v1-6 as the engine_id of your request and ensure the height & width you pass in adhere to the following restrictions:
No dimension can be less than 320 pixels
No dimension can be greater than 1536 pixels

Using SD Beta#

Pass in stable-diffusion-xl-beta-v2-2-2 as the engine_id of your request and ensure the height & width you pass in adhere to the following restrictions:
dimensions must be between 128x128 and 512x896 (or 896x512)
only one dimension can be greater than 512, but not both
NOTE: Only Version 1 engines will work with this endpoint.

请求参数

Path 参数
engine_id
string 
必需
示例值:
stable-diffusion-v1-6
Header 参数
Accept
enum<string> 
可选
The format of the response. Leave blank for JSON, or set to 'image/png' for a PNG image.
枚举值:
application/jsonimage/png
默认值:
application/json
Organization
string 
可选
Allows for requests to be scoped to an organization other than the user's default. If not provided, the user's default organization will be used.
示例值:
org-123456
Stability-Client-ID
string 
可选
Used to identify the source of requests, such as the client application or sub-organization. Optional, but recommended for organizational clarity.
示例值:
my-great-plugin
Stability-Client-Version
string 
可选
Used to identify the version of the application or service making the requests. Optional, but recommended for organizational clarity.
示例值:
1.2.1
Body 参数application/json
Represents the optional parameters that can be passed to any generation request.
height
integer 
DiffuseImageHeight
可选
Height of the image to generate, in pixels, in an increment divisible by 64.
>= 128
默认值:
512
示例值:
512
倍数:
64
width
integer 
DiffuseImageWidth
可选
Width of the image to generate, in pixels, in an increment divisible by 64.
>= 128
默认值:
512
示例值:
512
倍数:
64
text_prompts
array[object (TextPrompt) {2}] 
TextPrompts
必需
An array of text prompts to use for generation.
Given a text prompt with the text A lighthouse on a cliff and a weight of 0.5, it would be represented as:
"text_prompts": [
  {
    "text": "A lighthouse on a cliff",
    "weight": 0.5
  }
]
>= 1 items
text
string 
必需
The prompt itself
<= 2000 字符
示例值:
A lighthouse on a cliff
weight
number <float>
可选
Weight of the prompt (use negative numbers for negative prompts)
示例值:
0.8167237
cfg_scale
number 
CfgScale
可选
How strictly the diffusion process adheres to the prompt text (higher values keep your image closer to your prompt)
>= 0<= 35
默认值:
7
示例值:
7
clip_guidance_preset
enum<string> 
ClipGuidancePreset
可选
枚举值:
FAST_BLUEFAST_GREENNONESIMPLESLOWSLOWERSLOWEST
默认值:
NONE
示例值:
FAST_BLUE
sampler
enum<string> 
Sampler
可选
Which sampler to use for the diffusion process. If this value is omitted we'll automatically select an appropriate sampler for you.
枚举值:
DDIMDDPMK_DPMPP_2MK_DPMPP_2S_ANCESTRALK_DPM_2K_DPM_2_ANCESTRALK_EULERK_EULER_ANCESTRALK_HEUNK_LMS
示例值:
K_DPM_2_ANCESTRAL
samples
integer 
Samples
可选
Number of images to generate
>= 1<= 10
默认值:
1
示例值:
1
seed
integer 
Seed
可选
Random noise seed (omit this option or use 0 for a random seed)
>= 0<= 4294967295
默认值:
0
示例值:
0
steps
integer 
Steps
可选
Number of diffusion steps to run.
>= 10<= 50
默认值:
30
示例值:
50
style_preset
enum<string> 
StylePreset
可选
Pass in a style preset to guide the image model towards a particular style.
This list of style presets is subject to change.
枚举值:
3d-modelanalog-filmanimecinematiccomic-bookdigital-artenhancefantasy-artisometricline-artlow-polymodeling-compoundneon-punkorigamiphotographicpixel-arttile-texture
extras
object 
Extras
可选
Extra parameters passed to the engine.
These parameters are used for in-development or experimental features and may change
without warning, so please use with caution.
示例
{
  "cfg_scale": 7,
  "height": 512,
  "width": 512,
  "sampler": "K_DPM_2_ANCESTRAL",
  "samples": 1,
  "steps": 30,
  "text_prompts": [
    {
      "text": "A lighthouse on a cliff",
      "weight": 1
    }
  ]
}

示例代码

Python
JavaScript
Go
Shell
Java
Swift
PHP
HTTP
C
C#
Objective-C
Ruby
OCaml
Dart
R
请求示例请求示例
Python
JavaScript
Go
Shell
curl --location --request POST 'https://goapi.gptnb.ai/sd/v1/generation/stable-diffusion-v1-6/text-to-image' \
--header 'Content-Type: application/json' \
--data-raw '{
    "cfg_scale": 7,
    "height": 512,
    "width": 512,
    "sampler": "K_DPM_2_ANCESTRAL",
    "samples": 1,
    "steps": 30,
    "text_prompts": [
        {
            "text": "A lighthouse on a cliff",
            "weight": 1
        }
    ]
}'

返回响应

🟢200Generation successful.
application/json
Body
An array of results from the generation request, where each image is a base64 encoded PNG.
artifacts
array[object (Image) {3}] 
可选
base64
string 
可选
Image encoded in base64
finishReason
enum<string> 
可选
枚举值:
CONTENT_FILTEREDERRORSUCCESS
示例值:
CONTENT_FILTERED
seed
number 
可选
The seed associated with this image
示例值:
1229191277
示例
{
  "artifacts": [
    [
      {
        "base64": "...very long string...",
        "finishReason": "SUCCESS",
        "seed": 1050625087
      },
      {
        "base64": "...very long string...",
        "finishReason": "CONTENT_FILTERED",
        "seed": 1229191277
      }
    ]
  ]
}
🟠400bad_request: one or more parameters were invalid.
🟠401unauthorized: API key missing or invalid
🟠403permission_denied: You lack the necessary permissions to perform this action
🟠404not_found: The requested resource/engine was not found
🔴500server_error: Some unexpected server error occurred
上一页
Stable Diffusion 3
下一页
生成图像(image)
Built with