文档提示:本目录为静态文档,接口示例与 OpenAPI 地址已固定为 https://api.xiexus.cn
AI 模型接口 图像(Images) OpenAI聊天格式

OpenAI聊天格式

Gemini 图片生成

POST
https://api.xiexus.cn/v1/chat/completions
请求体:可选
接口信息
方法
POST
路径
/v1/chat/completions
完整地址
https://api.xiexus.cn/v1/chat/completions
请求体
可选
标签
图像(Images)/原生Gemini格式
响应码
200
当前接口页内已嵌入 OpenAPI JSON;如果需要查看总文件,可直接打开固定静态文件 relay.json
当前 JSON
../../../openapi/generated/ai-model/图像(Images)/原生Gemini格式/post-v1-chat-completions-geminirelayv1beta-389846313-389846313.json
总文件
../../../openapi/relay.json

OpenAPI JSON

已将服务地址固定为 https://api.xiexus.cn,其余结构保持和源文档一致。
{
  "openapi": "3.1.0",
  "info": {
    "title": "OpenAI聊天格式",
    "version": "1.0.0",
    "description": "Gemini 图片生成"
  },
  "tags": [
    {
      "name": "图像(Images)/原生Gemini格式"
    }
  ],
  "components": {
    "securitySchemes": {
      "BearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "使用 Bearer Token 认证。\n格式: `Authorization: Bearer sk-xxxxxx`\n"
      }
    }
  },
  "paths": {
    "/v1/chat/completions": {
      "post": {
        "tags": [
          "图像(Images)/原生Gemini格式"
        ],
        "summary": "OpenAI聊天格式",
        "description": "Gemini 图片生成",
        "operationId": "geminirelayv1beta-389846313",
        "parameters": [],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "model": {
                    "type": "string"
                  },
                  "stream": {
                    "type": "boolean"
                  },
                  "messages": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "role": {
                          "type": "string"
                        },
                        "content": {
                          "type": "string"
                        }
                      },
                      "x-apifox-orders": [
                        "role",
                        "content"
                      ]
                    }
                  },
                  "extra_body": {
                    "type": "object",
                    "properties": {
                      "google": {
                        "type": "object",
                        "properties": {
                          "image_config": {
                            "type": "object",
                            "properties": {
                              "aspect_ratio": {
                                "type": "string"
                              },
                              "image_size": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "aspect_ratio",
                              "image_size"
                            ],
                            "x-apifox-orders": [
                              "aspect_ratio",
                              "image_size"
                            ]
                          }
                        },
                        "required": [
                          "image_config"
                        ],
                        "x-apifox-orders": [
                          "image_config"
                        ]
                      }
                    },
                    "required": [
                      "google"
                    ],
                    "x-apifox-orders": [
                      "google"
                    ]
                  },
                  "contents": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "role": {
                          "type": "string"
                        },
                        "parts": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "text": {
                                "type": "string"
                              }
                            },
                            "x-apifox-orders": [
                              "text"
                            ]
                          }
                        }
                      },
                      "x-apifox-orders": [
                        "role",
                        "parts"
                      ]
                    }
                  }
                },
                "required": [
                  "model",
                  "stream",
                  "messages",
                  "contents"
                ],
                "x-apifox-orders": [
                  "model",
                  "stream",
                  "messages",
                  "extra_body",
                  "contents"
                ]
              }
            }
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "成功",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "model": {
                      "type": "string"
                    },
                    "object": {
                      "type": "string"
                    },
                    "created": {
                      "type": "integer"
                    },
                    "choices": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "index": {
                            "type": "integer"
                          },
                          "message": {
                            "type": "object",
                            "properties": {
                              "role": {
                                "type": "string"
                              },
                              "content": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "role",
                              "content"
                            ],
                            "x-apifox-orders": [
                              "role",
                              "content"
                            ]
                          },
                          "finish_reason": {
                            "type": "string"
                          }
                        },
                        "x-apifox-orders": [
                          "index",
                          "message",
                          "finish_reason"
                        ]
                      }
                    },
                    "usage": {
                      "type": "object",
                      "properties": {
                        "prompt_tokens": {
                          "type": "integer"
                        },
                        "completion_tokens": {
                          "type": "integer"
                        },
                        "total_tokens": {
                          "type": "integer"
                        }
                      },
                      "required": [
                        "prompt_tokens",
                        "completion_tokens",
                        "total_tokens"
                      ],
                      "x-apifox-orders": [
                        "prompt_tokens",
                        "completion_tokens",
                        "total_tokens"
                      ]
                    }
                  },
                  "required": [
                    "id",
                    "model",
                    "object",
                    "created",
                    "choices",
                    "usage"
                  ],
                  "x-apifox-orders": [
                    "id",
                    "model",
                    "object",
                    "created",
                    "choices",
                    "usage"
                  ]
                }
              }
            }
          }
        }
      }
    }
  },
  "servers": [
    {
      "url": "https://api.xiexus.cn",
      "description": "固定生产地址"
    }
  ]
}