切换主题
原生Gemini格式
Gemini 音频生成接口。 可使用gemini-2.5-flash-preview-tts等模型
原生Gemini格式
POST /v1beta/models/{model}:generateContent
Gemini 音频生成接口。 可使用gemini-2.5-flash-preview-tts等模型
认证
BearerAuth
请求参数
| 名称 | 位置 | 必填 | 类型 | 说明 |
|---|---|---|---|---|
| model | path | 是 | string | 模型名称 |
请求体
必填:否
application/json
| 字段 | 必填 | 类型 | 说明 |
|---|---|---|---|
| contents | 是 | array<object> | - |
| contents[].parts | 否 | array<object> | - |
| generationConfig | 是 | object | - |
| generationConfig.responseModalities | 是 | array<string> | - |
| generationConfig.speechConfig | 是 | object | - |
| generationConfig.speechConfig.voiceConfig | 是 | object | - |
| generationConfig.speechConfig.voiceConfig.prebuiltVoiceConfig | 是 | object | - |
原始 Schema
json
{
"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"
]
}响应
200 成功
application/json
| 字段 | 必填 | 类型 | 说明 |
|---|---|---|---|
| candidates | 否 | array<object> | - |
| candidates[].content | 否 | object | - |
| candidates[].content.role | 否 | string | - |
| candidates[].content.parts | 否 | array<object> | - |
| candidates[].finishReason | 否 | string | - |
| candidates[].safetyRatings | 否 | array<object> | - |
| usageMetadata | 否 | object | - |
| usageMetadata.promptTokenCount | 否 | integer | - |
| usageMetadata.candidatesTokenCount | 否 | integer | - |
| usageMetadata.totalTokenCount | 否 | integer | - |
原始 Schema
json
{
"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"
]
}