VMAN API Docs
  1. SDXL
VMAN API Docs
  • 模型接口
    • 聊天接口(Chat)
      • 聊天接口
      • gpts
      • gemini-pro
      • gpt-4-all(分析图片)
      • gpt-4-vision-preview
    • 自动补全接口(Completions)
      • 内容补全接口
    • 图像接口(Images)
      • DALL·E 3
      • Stable-Diffusion
      • gpt-4-all(生成图片)
    • 向量生成接口(Embeddings)
      • 创建嵌入
    • 音频接口(Audio)
      • 创建转录
      • 创建翻译
      • TTS文本转语音
    • Midjourney
      • 补充 - 其他参数以及回调
      • InsightFace任务提交
        • 提交swap_face任务
      • 任务提交
        • 执行动作
        • 提交Blend任务
        • 提交Describe任务
        • 提交Imagine任务
        • 提交Modal
        • 提交Shorten任务
      • 任务查询
        • 查询所有任务
        • 根据ID列表查询任务
        • 分页查询任务
        • 查询任务队列
        • 取消任务
        • 指定ID获取任务
        • 获取任务图片的seed(需设置mj或niji的私信ID)
    • Suno音乐(逆向)
      • v3.0
        • 生成音乐
        • 获取音乐
        • 合并音乐
      • v3.5
        • 生成音乐
        • 获取音乐
    • Flux图像(官方格式)
      • flux-pro-1.1
      • flux-pro
      • flux-dev
      • flux-查询
    • Recraft图像(官方格式)
      • styles
        • 创建样式
      • images
        • 生成图像
        • 图像矢量化
        • 移除背景
        • 清晰度提升
        • 生成式放大
    • Stability AI图像(官方格式)
      • SD3
        • Stable Image Ultra
        • Stable Image Core
        • Stable Diffusion 3
      • SDXL
        • Text-to-image
          POST
    • Ideogram图像(官方格式)
      • Generate(文生图)
      • Remix(混合图)
      • Upscale(放大高清)
      • Describe(描述)
    • Ideogram图像(逆向)
      • 图片描述
      • 文生图
      • 合成图
      • 放大图片
      • ideogram任务查询
    • Kling视频(官方格式)
      • 图像生成
      • 文生视频
      • 图生视频
      • 查询任务
    • Luma视频(逆向)
      • 付费版
        • 生成视频
        • 获取视频
    • Runway视频(官方格式)
      • 图生视频
      • 任务查询
    • CogVideoX视频(官方格式)
      • CogVideoX视频生成
      • CogVideoX视频查询
    • Viggle舞蹈(逆向)
      • Mix上传视频并生成视频
      • Mix官方模板列表
      • Mix上传视频素材库
      • Mix上传图片素材库
      • Multi上传视频并生成视频
      • Multi模板列表
      • Move上传视频并生成视频
      • 查询视频任务
      • 剩余积分查询
    • Midjourney视频
      • 视频提交
      • 查询任务
      • Fast视频提交
      • Relax视频提交
    • Veo视频
      • 提交视频生成任务
      • 查询视频生成状态
  • 帮助中心
    • 常见问题及解决办法
  1. SDXL

Text-to-image

POST
https://api.mjdjourney.cnhttps://api.mjdjourney.cn/sd/v1/generation/stable-diffusion-xl-1024-v1-0/text-to-image
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.

请求参数

Header 参数

Body 参数application/json

示例
{
    "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://api.mjdjourney.cn/sd/v1/generation/stable-diffusion-xl-1024-v1-0/text-to-image' \
--header 'Accept;' \
--header 'Organization: org-123456' \
--header 'Stability-Client-ID: my-great-plugin' \
--header 'Stability-Client-Version: 1.2.1' \
--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

示例
{
    "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
修改于 2024-09-21 14:49:34
上一页
Stable Diffusion 3
下一页
Generate(文生图)
Built with