# 文字转图像

## OpenAPI Specification

```yaml
openapi: 3.0.1
info:
  title: ''
  description: ''
  version: 1.0.0
paths:
  /v1/stable-diffusion-xl/text-to-image:
    post:
      summary: 文字转图像
      deprecated: false
      description: |+
        根据给定的文本提示和源图像生成图像。目前唯一可用的模型是 stable-diffusion-xl-v1-0。

      tags:
        - Stable Diffusion XL
      parameters:
        - name: content-type
          in: header
          description: ''
          required: true
          example: application/json
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                prompt:
                  type: string
                  description: 指导图像生成所需的文本输入。
              x-apifox-orders:
                - prompt
              required:
                - prompt
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  image:
                    type: string
                  seed:
                    type: integer
                  cost:
                    type: number
                required:
                  - image
                  - seed
                  - cost
                x-apifox-orders:
                  - image
                  - seed
                  - cost
              example:
                image: ...looooong base64 encoded image string...
                seed: 42
                cost: 0.00663552
          headers: {}
          x-apifox-name: 成功
        '400':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      message:
                        type: string
                      type:
                        type: string
                      param:
                        type: string
                      code:
                        type: string
                    required:
                      - message
                      - type
                      - param
                      - code
                    x-apifox-orders:
                      - message
                      - type
                      - param
                      - code
                required:
                  - error
                x-apifox-orders:
                  - error
          headers: {}
          x-apifox-name: 请求有误
        '401':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      message:
                        type: string
                      type:
                        type: string
                      param:
                        type: 'null'
                      code:
                        type: string
                      doc_url:
                        type: string
                    required:
                      - message
                      - type
                      - param
                      - code
                      - doc_url
                    x-apifox-orders:
                      - message
                      - type
                      - param
                      - code
                      - doc_url
                required:
                  - error
                x-apifox-orders:
                  - error
          headers: {}
          x-apifox-name: 没有权限
      security: []
      x-apifox-folder: Stable Diffusion XL
      x-apifox-status: released
      x-run-in-apifox: https://app.apifox.com/web/project/3997609/apis/api-146705493-run
components:
  schemas: {}
  securitySchemes: {}
servers:
  - url: http://dev-cn.your-api-server.com
    description: 开发环境
  - url: http://test-cn.your-api-server.com
    description: 测试环境
  - url: https://api.getimg.ai/v1
    description: 正式环境
security: []

```
