语音性别识别 API
根据上传的音频或音频 URL 识别说话人可能的性别。
基础 URL
https://api.genderrecognition.com
文件端点
POST /v1/voice-gender-recognition/api
请求标头
apiKey: YOUR_API_KEY
Content-Type: multipart/form-data
请求正文
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
file | file | 是 | 要分析的音频文件。 |
示例
curl -X POST "https://api.genderrecognition.com/v1/voice-gender-recognition/api" \
-H "apiKey: YOUR_API_KEY" \
-F "file=@audio.wav"
URL 端点
POST /v1/voice-gender-recognition/api/url
请求标头
apiKey: YOUR_API_KEY
Content-Type: application/json
请求正文
{
"url": "https://example.com/audio.wav"
}
响应
文件请求会返回预测结果、百分比形式的置信度以及更新后的配额信息。
{
"success": true,
"gender": "male",
"confidence": 97,
"remainingRequests": 2999
}
URL 请求会返回预测结果和配额信息。首次请求较慢时,响应中还可能包含 info 消息。
{
"success": true,
"gender": "male",
"remainingRequests": 2999
}
错误情况
缺少 API 密钥
{
"error": "API key is required"
}
API 密钥无效
{
"error": "Invalid API key"
}
缺少文件
{
"error": "No file uploaded"
}
文件类型无效
{
"error": "Invalid file type. Only audio formats are allowed"
}
URL 请求无效
{
"error": "A valid http or https URL is required"
}
缺少 JSON 内容类型
{
"error": "Content-Type header is required. Please set Content-Type: application/json"
}
不支持的 JSON 内容类型
{
"error": "Content-Type must be application/json"
}
配额已用尽
{
"error": {
"code": "RATE_LIMIT_EXCEEDED",
"message": "You have exceeded your free tier limit of 50 requests.",
"detailedMessage": "Insufficient remaining requests. Required: 1, Available: 0",
"details": {
"limit": 50,
"used": 50,
"reset_date": "2026-07-01T00:00:00.000Z"
},
"suggested_action": "Please upgrade to a premium plan to continue using the API."
}
}
说明
- 文件请求使用 multipart 表单数据。
- URL 请求使用 JSON。
- 音频上传使用
file字段,文件大小不得超过 10 MB。