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
基础文本对话
所有对话模型,都可使用此接口, 修改 model 属性为模型名

请求参数

Header 参数

Body 参数application/json

示例
{
    "model": "gpt-3.5-turbo",
    "messages": [
        {
            "role": "system",
            "content": "You are a helpful assistant."
        },
        {
            "role": "user",
            "content": "Hello!"
        }
    ]
}

请求示例代码

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 {YOUR_API_KEY}' \
--header 'Content-Type: application/json' \
--data-raw '{
    "model": "gpt-3.5-turbo",
    "messages": [
        {
            "role": "system",
            "content": "You are a helpful assistant."
        },
        {
            "role": "user",
            "content": "Hello!"
        }
    ]
}'

返回响应

🟢200成功
application/json
Body

示例
{
    "id": "chatcmpl-123",
    "object": "chat.completion",
    "created": 1677652288,
    "choices": [
        {
            "index": 0,
            "message": {
                "role": "assistant",
                "content": "\n\nHello there, how may I assist you today?"
            },
            "finish_reason": "stop"
        }
    ],
    "usage": {
        "prompt_tokens": 9,
        "completion_tokens": 12,
        "total_tokens": 21
    }
}
修改于 2025-10-06 06:23:25
上一页
Models(列出模型)
下一页
流式返回
Built with