Audio
语音转文字
以 multipart/form-data 提交 model、file。文件必须是完整的单声道 PCM WAV,最多 25,000,000 字节;还须满足渠道的采样率、时长限制。可选字段为 language(两个小写字母,如 zh)和 response_format=json(唯一支持的格式,也是默认值)。让 curl 自动生成 boundary。不支持 URL、文件 ID、prompt、时间戳或 stream。
计费以发布渠道为准:STT 可能按 input_audio_second 秒价或 token 计价;TTS 使用 input_character。检查 speech_billing_unit:utf16_code_unit 与 unicode_code_point 对 emoji 的计数不同。预占是估算,不是费用上限;最终结算可能异步完成,证据缺失不表示免费。两个接口都接受 X-Felo-Channel,仅向选定渠道派发一次。超时或断连后不要自动重试,包括 SDK 默认重试;保留 X-Request-Id 及可用的 X-Generation-Id 供核对。Console Playground 暂未支持这些语音调用。 configured_rates 按冻结费率和可信用量结算;upstream_cost 按可信上游成本及发布的加价、折扣结算。
- 类型: stringX
- Felo - Channel Ordered comma-separated public channel codes. Omit this header to use default; default must be used alone. In wallet mode, default scans the model's effective public channel order in reverse, skips unpublished or unavailable channels, and uses the first eligible channel. Explicit codes follow the supplied order. For stateless Chat Completions, Messages and Responses, the server may try another selected channel or provider group after a confirmed upstream rejection. A single explicit channel limits routing to that channel. Legacy provider headers cannot override channel routing.
- 类型: object200
同步 JSON 响应包含
text;usage可选,可能报告秒数或 token。usage.cost是上游成本,不是最终 Felo 扣费。无需轮询任务。- 类型: stringtext必填
- 类型: object | nullusage
- cost类型: number最小值:0
Reported upstream cost in USD.
- input类型: object
_token _details - audio类型: integer
_tokens 最小值:0Integer numbers.
- text类型: integer
_tokens 最小值:0Integer numbers.
- input类型: integer
_tokens 最小值:0Integer numbers.
- output类型: integer
_tokens 最小值:0Integer numbers.
- seconds类型: number最小值:0
Duration reported by the selected channel.
- total类型: integer
_tokens 最小值:0Integer numbers.
- type类型: string 枚举值
- duration
- tokens
application/json - 类型: object400
Upload, wallet or upstream error
- 类型: objecterror必填
- code类型: string | null
- message类型: string
- param类型: string | null
- type类型: string
application/json - 类型: object402
Upload, wallet or upstream error
- 类型: objecterror必填
- code类型: string | null
- message类型: string
- param类型: string | null
- type类型: string
application/json - 类型: object413
Upload, wallet or upstream error
- 类型: objecterror必填
- code类型: string | null
- message类型: string
- param类型: string | null
- type类型: string
application/json - 类型: object415
Upload, wallet or upstream error
- 类型: objecterror必填
- code类型: string | null
- message类型: string
- param类型: string | null
- type类型: string
application/json - 类型: object429
Upload, wallet or upstream error
- 类型: objecterror必填
- code类型: string | null
- message类型: string
- param类型: string | null
- type类型: string
application/json - 类型: object500
Upload, wallet or upstream error
- 类型: objecterror必填
- code类型: string | null
- message类型: string
- param类型: string | null
- type类型: string
application/json - 类型: object502
Upload, wallet or upstream error
- 类型: objecterror必填
- code类型: string | null
- message类型: string
- param类型: string | null
- type类型: string
application/json - 类型: object503
Upload, wallet or upstream error
- 类型: objecterror必填
- code类型: string | null
- message类型: string
- param类型: string | null
- type类型: string
application/json - 类型: object504
Upload, wallet or upstream error
- 类型: objecterror必填
- code类型: string | null
- message类型: string
- param类型: string | null
- type类型: string
application/json
curl https://openapi.felo.ai/api/v1/audio/transcriptions \
--request POST \
--header 'Content-Type: multipart/form-data' \
--header 'Authorization: Bearer YOUR_SECRET_TOKEN' \
--form 'model=grok-stt-2.0' \
--form 'file=@filename' \
--form 'language=' \
--form 'response_format=json'
{
"text": "string",
"usage": {
"seconds": 0,
"type": "duration",
"input_tokens": 0,
"output_tokens": 0,
"total_tokens": 0,
"input_token_details": {
"text_tokens": 0,
"audio_tokens": 0
},
"cost": 0
}
}