{
  "openapi": "3.1.0",
  "info": {
    "title": "图片 API 文档",
    "version": "1.3.0",
    "description": "本站公开接口。GET /v1/models 仅返回模型广场当前展示且当前 API Key 有权限调用的公开 ID。视频、文本、图片按分类独立说明。使用本站域名和本站 Key。"
  },
  "servers": [
    {
      "url": "https://www.v6k.top",
      "description": "本站域名，不含 /v1；下列 paths 已包含 /v1。自部署时替换域名。"
    }
  ],
  "security": [
    {
      "BearerAuth": []
    }
  ],
  "tags": [
    {
      "name": "Images",
      "description": "图片生成和编辑"
    },
    {
      "name": "Models",
      "description": "模型广场公开模型 ID"
    }
  ],
  "paths": {
    "/v1/models": {
      "get": {
        "tags": [
          "Models"
        ],
        "operationId": "listModels",
        "summary": "查询当前令牌可用模型",
        "responses": {
          "200": {
            "description": "模型列表",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "type": "string"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "object": {
                            "type": "string"
                          },
                          "owned_by": {
                            "type": "string"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "参数错误、配置问题、额度不足或任务未完成",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "密钥无效",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "请求错误，检查HTTP状态与错误体",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "无权限",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "任务或路由不存在",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "请求错误，检查HTTP状态与错误体",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "请求限流",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "请求错误，检查HTTP状态与错误体",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "服务暂不可用",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "服务繁忙",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "504": {
            "description": "请求超时",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/images/generations": {
      "post": {
        "summary": "图片生成接口",
        "description": "使用本站 API Key 和本站公开模型 ID。结果在当前 HTTP 响应的 data 中返回，不使用视频任务查询接口。按后台配置的本站售价和计费单位结算。图片按实际生成张数计费，n 默认 1；按请求数量预扣，按有效结果张数结算。同图 URL 与 Base64 双表示不重复计数。所有尺寸、质量、张数和可选参数以所选模型为准。",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "model",
                  "prompt"
                ],
                "properties": {
                  "model": {
                    "type": "string",
                    "description": "本站公开模型 ID；从 GET /v1/models 原样复制，不填写渠道名或上游 ID。"
                  },
                  "prompt": {
                    "type": "string",
                    "description": "图片生成或编辑提示词。"
                  },
                  "n": {
                    "type": "integer",
                    "minimum": 1,
                    "default": 1,
                    "description": "请求生成张数，默认 1，上限以所选模型为准。当前图片接口接受 1–10 的整数，所选模型还需支持对应数量。"
                  },
                  "size": {
                    "type": "string",
                    "description": "图片尺寸，填写所选模型支持的值；不能套用视频的 resolution 参数。"
                  },
                  "quality": {
                    "type": "string",
                    "description": "质量档位，以所选模型能力为准。"
                  },
                  "response_format": {
                    "type": "string",
                    "enum": [
                      "url",
                      "b64_json"
                    ],
                    "description": "仅在模型支持时选择 url 或 b64_json；按实际响应读取结果。"
                  },
                  "background": {
                    "type": "string",
                    "description": "背景选项，仅在模型支持时填写。"
                  },
                  "output_format": {
                    "type": "string",
                    "description": "输出图片格式，仅在模型支持时填写。"
                  },
                  "output_compression": {
                    "type": "integer",
                    "description": "输出压缩设置，仅在模型支持时填写。"
                  },
                  "input_fidelity": {
                    "type": "string",
                    "description": "参考图片保真度，仅在模型支持时填写。"
                  },
                  "style": {
                    "type": "string",
                    "description": "图片风格，仅在模型支持时填写。"
                  },
                  "user": {
                    "type": "string",
                    "description": "可选下游用户标识。"
                  },
                  "moderation": {
                    "type": "string",
                    "description": "内容审核选项，仅在模型支持时填写。"
                  }
                }
              },
              "examples": {
                "basic": {
                  "summary": "文生图；替换为本站已上架的公开图片模型 ID",
                  "value": {
                    "model": "YOUR_IMAGE_MODEL_ID",
                    "prompt": "一只在草地上奔跑的柯基",
                    "n": 1
                  }
                },
                "urlResult": {
                  "summary": "仅在模型支持时请求 URL 结果",
                  "value": {
                    "model": "YOUR_IMAGE_MODEL_ID",
                    "prompt": "白色背景上的蓝色圆形",
                    "n": 1,
                    "response_format": "url"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "图片结果已返回。读取 data[].url 下载图片，或将 data[].b64_json 解码为图片字节；JSON 本身不是图片文件。图片不使用视频任务轮询或视频 content 下载接口。请及时保存图片；仅请求本站鉴权地址时携带本站 API Key。",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "created": {
                      "type": "integer",
                      "description": "Unix 秒级时间戳。"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "url": {
                            "type": "string",
                            "description": "实际图片地址，请及时保存。"
                          },
                          "b64_json": {
                            "type": "string",
                            "description": "Base64 编码的图片字节。"
                          },
                          "revised_prompt": {
                            "type": "string"
                          }
                        }
                      }
                    }
                  }
                },
                "examples": {
                  "url": {
                    "summary": "URL 结果示例",
                    "value": {
                      "created": 1795622400,
                      "data": [
                        {
                          "url": "https://example.com/generated-image.png"
                        }
                      ]
                    }
                  },
                  "base64": {
                    "summary": "Base64 结果示例；示意字符串不是完整图片",
                    "value": {
                      "created": 1795622400,
                      "data": [
                        {
                          "b64_json": "BASE64_IMAGE_BYTES"
                        }
                      ]
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "参数错误"
          },
          "401": {
            "description": "鉴权失败"
          },
          "403": {
            "description": "权限不足或额度不足"
          },
          "502": {
            "description": "处理失败"
          }
        },
        "tags": [
          "Images"
        ]
      }
    },
    "/v1/images/edits": {
      "post": {
        "tags": [
          "Images"
        ],
        "summary": "编辑图片（需模型支持）",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "model",
                  "prompt"
                ],
                "anyOf": [
                  {
                    "required": [
                      "image"
                    ]
                  },
                  {
                    "required": [
                      "images"
                    ]
                  },
                  {
                    "required": [
                      "image_urls"
                    ]
                  },
                  {
                    "required": [
                      "reference_images"
                    ]
                  }
                ],
                "properties": {
                  "model": {
                    "type": "string",
                    "description": "本站公开模型 ID；从 GET /v1/models 原样复制，不填写渠道名或上游 ID。"
                  },
                  "prompt": {
                    "type": "string",
                    "description": "图片生成或编辑提示词。"
                  },
                  "n": {
                    "type": "integer",
                    "minimum": 1,
                    "default": 1,
                    "description": "请求生成张数，默认 1，上限以所选模型为准。当前图片接口接受 1–10 的整数，所选模型还需支持对应数量。"
                  },
                  "size": {
                    "type": "string",
                    "description": "图片尺寸，填写所选模型支持的值；不能套用视频的 resolution 参数。"
                  },
                  "quality": {
                    "type": "string",
                    "description": "质量档位，以所选模型能力为准。"
                  },
                  "response_format": {
                    "type": "string",
                    "enum": [
                      "url",
                      "b64_json"
                    ],
                    "description": "仅在模型支持时选择 url 或 b64_json；按实际响应读取结果。"
                  },
                  "background": {
                    "type": "string",
                    "description": "背景选项，仅在模型支持时填写。"
                  },
                  "output_format": {
                    "type": "string",
                    "description": "输出图片格式，仅在模型支持时填写。"
                  },
                  "output_compression": {
                    "type": "integer",
                    "description": "输出压缩设置，仅在模型支持时填写。"
                  },
                  "input_fidelity": {
                    "type": "string",
                    "description": "参考图片保真度，仅在模型支持时填写。"
                  },
                  "style": {
                    "type": "string",
                    "description": "图片风格，仅在模型支持时填写。"
                  },
                  "user": {
                    "type": "string",
                    "description": "可选下游用户标识。"
                  },
                  "moderation": {
                    "type": "string",
                    "description": "内容审核选项，仅在模型支持时填写。"
                  },
                  "image": {
                    "oneOf": [
                      {
                        "type": "string",
                        "description": "公网 HTTP(S) 图片直链或模型支持的图片 Data URL。"
                      },
                      {
                        "type": "object",
                        "required": [
                          "url"
                        ],
                        "properties": {
                          "url": {
                            "type": "string"
                          }
                        }
                      },
                      {
                        "type": "array",
                        "items": {
                          "oneOf": [
                            {
                              "type": "string",
                              "description": "公网 HTTP(S) 图片直链或模型支持的图片 Data URL。"
                            },
                            {
                              "type": "object",
                              "required": [
                                "url"
                              ],
                              "properties": {
                                "url": {
                                  "type": "string"
                                }
                              }
                            }
                          ]
                        },
                        "minItems": 1
                      }
                    ],
                    "description": "参考原图。支持这些等价字段的模型只使用一种，使用多项时必须一致；具体支持情况以所选模型说明为准。"
                  },
                  "images": {
                    "oneOf": [
                      {
                        "type": "string",
                        "description": "公网 HTTP(S) 图片直链或模型支持的图片 Data URL。"
                      },
                      {
                        "type": "object",
                        "required": [
                          "url"
                        ],
                        "properties": {
                          "url": {
                            "type": "string"
                          }
                        }
                      },
                      {
                        "type": "array",
                        "items": {
                          "oneOf": [
                            {
                              "type": "string",
                              "description": "公网 HTTP(S) 图片直链或模型支持的图片 Data URL。"
                            },
                            {
                              "type": "object",
                              "required": [
                                "url"
                              ],
                              "properties": {
                                "url": {
                                  "type": "string"
                                }
                              }
                            }
                          ]
                        },
                        "minItems": 1
                      }
                    ],
                    "description": "参考原图。支持这些等价字段的模型只使用一种，使用多项时必须一致；具体支持情况以所选模型说明为准。"
                  },
                  "image_urls": {
                    "oneOf": [
                      {
                        "type": "string",
                        "description": "公网 HTTP(S) 图片直链或模型支持的图片 Data URL。"
                      },
                      {
                        "type": "object",
                        "required": [
                          "url"
                        ],
                        "properties": {
                          "url": {
                            "type": "string"
                          }
                        }
                      },
                      {
                        "type": "array",
                        "items": {
                          "oneOf": [
                            {
                              "type": "string",
                              "description": "公网 HTTP(S) 图片直链或模型支持的图片 Data URL。"
                            },
                            {
                              "type": "object",
                              "required": [
                                "url"
                              ],
                              "properties": {
                                "url": {
                                  "type": "string"
                                }
                              }
                            }
                          ]
                        },
                        "minItems": 1
                      }
                    ],
                    "description": "参考原图。支持这些等价字段的模型只使用一种，使用多项时必须一致；具体支持情况以所选模型说明为准。"
                  },
                  "reference_images": {
                    "oneOf": [
                      {
                        "type": "string",
                        "description": "公网 HTTP(S) 图片直链或模型支持的图片 Data URL。"
                      },
                      {
                        "type": "object",
                        "required": [
                          "url"
                        ],
                        "properties": {
                          "url": {
                            "type": "string"
                          }
                        }
                      },
                      {
                        "type": "array",
                        "items": {
                          "oneOf": [
                            {
                              "type": "string",
                              "description": "公网 HTTP(S) 图片直链或模型支持的图片 Data URL。"
                            },
                            {
                              "type": "object",
                              "required": [
                                "url"
                              ],
                              "properties": {
                                "url": {
                                  "type": "string"
                                }
                              }
                            }
                          ]
                        },
                        "minItems": 1
                      }
                    ],
                    "description": "参考原图。支持这些等价字段的模型只使用一种，使用多项时必须一致；具体支持情况以所选模型说明为准。"
                  },
                  "mask": {
                    "oneOf": [
                      {
                        "type": "string",
                        "description": "公网 HTTP(S) 图片直链或模型支持的图片 Data URL。"
                      },
                      {
                        "type": "object",
                        "required": [
                          "url"
                        ],
                        "properties": {
                          "url": {
                            "type": "string"
                          }
                        }
                      }
                    ]
                  }
                }
              },
              "examples": {
                "referenceUrl": {
                  "summary": "支持 JSON 原图输入的图片模型",
                  "value": {
                    "model": "YOUR_IMAGE_MODEL_ID",
                    "prompt": "把背景改为海边",
                    "image": [
                      "https://example.com/reference.png"
                    ],
                    "n": 1
                  }
                }
              }
            },
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "required": [
                  "model",
                  "prompt",
                  "image"
                ],
                "properties": {
                  "model": {
                    "type": "string",
                    "description": "本站公开模型 ID；从 GET /v1/models 原样复制，不填写渠道名或上游 ID。"
                  },
                  "prompt": {
                    "type": "string",
                    "description": "图片生成或编辑提示词。"
                  },
                  "n": {
                    "type": "integer",
                    "minimum": 1,
                    "default": 1,
                    "description": "请求生成张数，默认 1，上限以所选模型为准。当前图片接口接受 1–10 的整数，所选模型还需支持对应数量。"
                  },
                  "size": {
                    "type": "string",
                    "description": "图片尺寸，填写所选模型支持的值；不能套用视频的 resolution 参数。"
                  },
                  "quality": {
                    "type": "string",
                    "description": "质量档位，以所选模型能力为准。"
                  },
                  "response_format": {
                    "type": "string",
                    "enum": [
                      "url",
                      "b64_json"
                    ],
                    "description": "仅在模型支持时选择 url 或 b64_json；按实际响应读取结果。"
                  },
                  "background": {
                    "type": "string",
                    "description": "背景选项，仅在模型支持时填写。"
                  },
                  "output_format": {
                    "type": "string",
                    "description": "输出图片格式，仅在模型支持时填写。"
                  },
                  "output_compression": {
                    "type": "integer",
                    "description": "输出压缩设置，仅在模型支持时填写。"
                  },
                  "input_fidelity": {
                    "type": "string",
                    "description": "参考图片保真度，仅在模型支持时填写。"
                  },
                  "style": {
                    "type": "string",
                    "description": "图片风格，仅在模型支持时填写。"
                  },
                  "user": {
                    "type": "string",
                    "description": "可选下游用户标识。"
                  },
                  "moderation": {
                    "type": "string",
                    "description": "内容审核选项，仅在模型支持时填写。"
                  },
                  "image": {
                    "oneOf": [
                      {
                        "type": "string",
                        "format": "binary"
                      },
                      {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "format": "binary"
                        },
                        "minItems": 1
                      }
                    ],
                    "description": "原图文件；多图重复 image 字段，或使用模型支持的 image[]。不得手动填写 multipart boundary。"
                  },
                  "mask": {
                    "type": "string",
                    "format": "binary",
                    "description": "可选蒙版文件，仅在模型支持时填写。"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "图片结果已返回。读取 data[].url 下载图片，或将 data[].b64_json 解码为图片字节；JSON 本身不是图片文件。图片不使用视频任务轮询或视频 content 下载接口。请及时保存图片；仅请求本站鉴权地址时携带本站 API Key。",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "created": {
                      "type": "integer",
                      "description": "Unix 秒级时间戳。"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "url": {
                            "type": "string",
                            "description": "实际图片地址，请及时保存。"
                          },
                          "b64_json": {
                            "type": "string",
                            "description": "Base64 编码的图片字节。"
                          },
                          "revised_prompt": {
                            "type": "string"
                          }
                        }
                      }
                    }
                  }
                },
                "examples": {
                  "url": {
                    "summary": "URL 结果示例",
                    "value": {
                      "created": 1795622400,
                      "data": [
                        {
                          "url": "https://example.com/generated-image.png"
                        }
                      ]
                    }
                  },
                  "base64": {
                    "summary": "Base64 结果示例；示意字符串不是完整图片",
                    "value": {
                      "created": 1795622400,
                      "data": [
                        {
                          "b64_json": "BASE64_IMAGE_BYTES"
                        }
                      ]
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "参数错误或模型不支持编辑"
          },
          "401": {
            "description": "Key 无效"
          }
        },
        "description": "仅限支持图片编辑的模型。按所选模型支持的方式传入 JSON 原图链接、图片 Data URL 或 multipart 原图文件；同一次请求不要混用原图链接和文件上传。多图和 mask 能力以模型为准。结果直接返回 data，不使用视频任务轮询。"
      }
    }
  },
  "components": {
    "securitySchemes": {
      "BearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "填写本站签发的 API 令牌"
      }
    },
    "schemas": {
      "Error": {
        "type": "object",
        "properties": {
          "error": {
            "type": "object",
            "properties": {
              "message": {
                "type": "string"
              },
              "type": {
                "type": "string"
              },
              "code": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          },
          "code": {
            "type": "string"
          },
          "message": {
            "type": "string"
          },
          "data": {
            "description": "兼容旧版任务错误响应的可选数据"
          }
        },
        "description": "本站统一错误，不包含服务商地址、服务商模型 ID 或密钥"
      }
    }
  }
}
