wenwen
  1. chat
wenwen
  • (必读)使用说明
  • Base URL地址
  • 列出模型
    • Models(列出模型)
      GET
  • OpenAI 接口格式
    • chat
      • 聊天
        POST
      • 流式返回
        POST
      • 结构化输出
        POST
      • 工具调用(function call)
        POST
      • MCP调用(stdio)
        POST
      • 分析图片
        POST
      • 修改图片
        POST
      • 生成图片
        POST
      • 语音回复
        POST
      • 生成视频
        POST
    • responses
      • Responses API与Chat API对比
      • 创建对话
      • 流式返回
    • images
      • 生成图片
      • 编辑图片
    • 向量处理
      • 文本向量化
    • 语音识别
      • 语音识别
  • Anthropic 接口格式
    • messages
      • 聊天
      • 流式返回
      • 聊天(prompt cache)
      • 聊天(深度思考)
      • 工具调用(function call)
      • 工具调用(MCP)-待支持
      • 分析图片
  • Gemini 接口格式
    • generateContent
      • 聊天
      • 生成图片
      • 编辑图片
  • Midjourney 接口格式
    • 文生图(Imagine)
      POST
    • 图片融合(Blend)
      POST
    • 任务查询接口
      GET
    • 任务批量查询接口
      POST
    • 获取种子(Seed)
      GET
    • 按钮点击(Action)-选择图片
      POST
  1. chat

语音回复

POST
/v1/chat/completions
支持文本输入,语音回复,使用gpt-4o-audio模型
如果需要语音输入,语音输出,需要先使用语音转写将输入的语音转写为文本,参考接口「语音识别」

请求参数

Header 参数

Body 参数application/json

示例
{
  "model": "gpt-4o-audio-preview",
  "modalities": [
    "audio",
    "text"
  ],
  "audio": {
    "format": "wav",
    "voice": "alloy"
  },
  "messages": [
    {
      "role": "user",
      "content": "请用中文回答:你能听到我的声音吗?并用语音回复我。"
    }
  ]
}

请求示例代码

Shell
JavaScript
Java
Swift
Go
PHP
Python
HTTP
C
C#
Objective-C
Ruby
OCaml
Dart
R
请求示例请求示例
Shell
JavaScript
Java
Swift
curl --location --request POST 'https://api.wenwen-ai.com/v1/chat/completions' \
--header 'Authorization: Bearer {API_KEY}' \
--header 'Content-Type: application/json' \
--data-raw '{
  "model": "gpt-4o-audio-preview",
  "modalities": [
    "audio",
    "text"
  ],
  "audio": {
    "format": "wav",
    "voice": "alloy"
  },
  "messages": [
    {
      "role": "user",
      "content": "请用中文回答:你能听到我的声音吗?并用语音回复我。"
    }
  ]
}'

返回响应

🟢200成功
application/json
Body

示例
{
    "id": "chatcmpl-BqebNpDZkLbdiwDBINEDTuUBCQK5L",
    "choices": [
        {
            "finish_reason": "stop",
            "index": 0,
            "logprobs": null,
            "message": {
                "content": null,
                "refusal": null,
                "role": "assistant",
                "annotations": [],
                "audio": {
                    "id": "audio_686bb3bec2608191b1d7efbfbd8bdb51",
                    "data": "UklGRv////9XQVZFZ......AB4AgABcAFQAAwA=",
                    "expires_at": 1751892430,
                    "transcript": "是的,我可以听到你的声音。"
                },
                "function_call": null,
                "tool_calls": null
            }
        }
    ],
    "created": 1751888829,
    "model": "gpt-4o-audio-preview-2024-12-17",
    "object": "chat.completion",
    "service_tier": "default",
    "system_fingerprint": "fp_bf8dbd2ceb",
    "usage": {
        "completion_tokens": 67,
        "prompt_tokens": 27,
        "total_tokens": 94,
        "completion_tokens_details": {
            "accepted_prediction_tokens": 0,
            "audio_tokens": 50,
            "reasoning_tokens": 0,
            "rejected_prediction_tokens": 0,
            "text_tokens": 17
        },
        "prompt_tokens_details": {
            "audio_tokens": 0,
            "cached_tokens": 0,
            "text_tokens": 27,
            "image_tokens": 0
        }
    }
}
修改于 2025-09-16 09:10:26
上一页
生成图片
下一页
生成视频
Built with