Felo API PlatformFelo API Platform
v0.4.0
OpenAPI 3.1.0

语音转文字

服务器:https://openapi.felo.ai
客户端库

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 按可信上游成本及发布的加价、折扣结算。

请求头
  • X-Felo-Channel
    类型: string

    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.

请求体
必填
application/json
响应
  • 200
    类型: object

    同步 JSON 响应包含 text;usage 可选,可能报告秒数或 token。usage.cost 是上游成本,不是最终 Felo 扣费。无需轮询任务。

    • text
      类型: string
      必填
    • usage
      类型: object | null
      • cost
        类型: number
        最小值:  
        0

        Reported upstream cost in USD.

      • input_token_details
        类型: object
        • audio_tokens
          类型: integer
          最小值:  
          0

          Integer numbers.

        • text_tokens
          类型: integer
          最小值:  
          0

          Integer numbers.

      • input_tokens
        类型: integer
        最小值:  
        0

        Integer numbers.

      • output_tokens
        类型: integer
        最小值:  
        0

        Integer numbers.

      • seconds
        类型: number
        最小值:  
        0

        Duration reported by the selected channel.

      • total_tokens
        类型: integer
        最小值:  
        0

        Integer numbers.

      • type
        类型: string 枚举
        值
        • duration
        • tokens
    application/json
  • 400
    类型: object

    Upload, wallet or upstream error

    • error
      类型: object
      必填
      • code
        类型: string | null
      • message
        类型: string
      • param
        类型: string | null
      • type
        类型: string
    application/json
  • 402
    类型: object

    Upload, wallet or upstream error

    • error
      类型: object
      必填
      • code
        类型: string | null
      • message
        类型: string
      • param
        类型: string | null
      • type
        类型: string
    application/json
  • 413
    类型: object

    Upload, wallet or upstream error

    • error
      类型: object
      必填
      • code
        类型: string | null
      • message
        类型: string
      • param
        类型: string | null
      • type
        类型: string
    application/json
  • 415
    类型: object

    Upload, wallet or upstream error

    • error
      类型: object
      必填
      • code
        类型: string | null
      • message
        类型: string
      • param
        类型: string | null
      • type
        类型: string
    application/json
  • 429
    类型: object

    Upload, wallet or upstream error

    • error
      类型: object
      必填
      • code
        类型: string | null
      • message
        类型: string
      • param
        类型: string | null
      • type
        类型: string
    application/json
  • 500
    类型: object

    Upload, wallet or upstream error

    • error
      类型: object
      必填
      • code
        类型: string | null
      • message
        类型: string
      • param
        类型: string | null
      • type
        类型: string
    application/json
  • 502
    类型: object

    Upload, wallet or upstream error

    • error
      类型: object
      必填
      • code
        类型: string | null
      • message
        类型: string
      • param
        类型: string | null
      • type
        类型: string
    application/json
  • 503
    类型: object

    Upload, wallet or upstream error

    • error
      类型: object
      必填
      • code
        类型: string | null
      • message
        类型: string
      • param
        类型: string | null
      • type
        类型: string
    application/json
  • 504
    类型: object

    Upload, wallet or upstream error

    • error
      类型: object
      必填
      • code
        类型: string | null
      • message
        类型: string
      • param
        类型: string | null
      • type
        类型: string
    application/json
Request Example for post/api/v1/audio/transcriptions
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
  }
}
Transcribe a WAV recording

需要帮助?