文档提示:本目录为静态文档,接口示例与 OpenAPI 地址已固定为 https://api.xiexus.cn
AI 模型接口 音频(Audio) 原生Gemini格式

原生Gemini格式

Gemini 音频生成接口。 可使用gemini-2.5-flash-preview-tts等模型

POST
https://api.xiexus.cn/v1beta/models/{model}:generateContent
请求体:可选
接口信息
方法
POST
路径
/v1beta/models/{model}:generateContent
完整地址
https://api.xiexus.cn/v1beta/models/{model}:generateContent
请求体
可选
标签
音频(Audio)
响应码
200
当前接口页内已嵌入 OpenAPI JSON;如果需要查看总文件,可直接打开固定静态文件 relay.json
当前 JSON
../../openapi/generated/ai-model/音频(Audio)/post-v1beta-models-model-generatecontent-geminirelayv1beta-383836364-383836364.json
总文件
../../openapi/relay.json

OpenAPI JSON

已将服务地址固定为 https://api.xiexus.cn,其余结构保持和源文档一致。
{
  "openapi": "3.1.0",
  "info": {
    "title": "原生Gemini格式",
    "version": "1.0.0",
    "description": "Gemini 音频生成接口。\n可使用gemini-2.5-flash-preview-tts等模型"
  },
  "tags": [
    {
      "name": "音频(Audio)"
    }
  ],
  "components": {
    "securitySchemes": {
      "BearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "使用 Bearer Token 认证。\n格式: `Authorization: Bearer sk-xxxxxx`\n"
      }
    }
  },
  "paths": {
    "/v1beta/models/{model}:generateContent": {
      "post": {
        "tags": [
          "音频(Audio)"
        ],
        "summary": "原生Gemini格式",
        "description": "Gemini 音频生成接口。\n可使用gemini-2.5-flash-preview-tts等模型",
        "operationId": "geminirelayv1beta-383836364",
        "parameters": [
          {
            "name": "model",
            "in": "path",
            "required": true,
            "description": "模型名称",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "contents": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "parts": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "text": {
                                "type": "string"
                              }
                            },
                            "x-apifox-orders": [
                              "text"
                            ]
                          }
                        }
                      },
                      "x-apifox-orders": [
                        "parts"
                      ]
                    }
                  },
                  "generationConfig": {
                    "type": "object",
                    "properties": {
                      "responseModalities": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "speechConfig": {
                        "type": "object",
                        "properties": {
                          "voiceConfig": {
                            "type": "object",
                            "properties": {
                              "prebuiltVoiceConfig": {
                                "type": "object",
                                "properties": {
                                  "voiceName": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "voiceName"
                                ],
                                "x-apifox-orders": [
                                  "voiceName"
                                ]
                              }
                            },
                            "required": [
                              "prebuiltVoiceConfig"
                            ],
                            "x-apifox-orders": [
                              "prebuiltVoiceConfig"
                            ]
                          }
                        },
                        "required": [
                          "voiceConfig"
                        ],
                        "x-apifox-orders": [
                          "voiceConfig"
                        ]
                      }
                    },
                    "required": [
                      "responseModalities",
                      "speechConfig"
                    ],
                    "x-apifox-orders": [
                      "responseModalities",
                      "speechConfig"
                    ]
                  }
                },
                "required": [
                  "contents",
                  "generationConfig"
                ],
                "x-apifox-orders": [
                  "contents",
                  "generationConfig"
                ]
              }
            }
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "成功",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "candidates": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "content": {
                            "type": "object",
                            "properties": {
                              "role": {
                                "type": "string"
                              },
                              "parts": {
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "properties": {},
                                  "x-apifox-orders": []
                                }
                              }
                            },
                            "x-apifox-orders": [
                              "role",
                              "parts"
                            ]
                          },
                          "finishReason": {
                            "type": "string"
                          },
                          "safetyRatings": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {},
                              "x-apifox-orders": []
                            }
                          }
                        },
                        "x-apifox-orders": [
                          "content",
                          "finishReason",
                          "safetyRatings"
                        ]
                      }
                    },
                    "usageMetadata": {
                      "type": "object",
                      "properties": {
                        "promptTokenCount": {
                          "type": "integer"
                        },
                        "candidatesTokenCount": {
                          "type": "integer"
                        },
                        "totalTokenCount": {
                          "type": "integer"
                        }
                      },
                      "x-apifox-orders": [
                        "promptTokenCount",
                        "candidatesTokenCount",
                        "totalTokenCount"
                      ]
                    }
                  },
                  "x-apifox-orders": [
                    "candidates",
                    "usageMetadata"
                  ]
                }
              }
            }
          }
        }
      }
    }
  },
  "servers": [
    {
      "url": "https://api.xiexus.cn",
      "description": "固定生产地址"
    }
  ]
}