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,gemini-2.5-flash-image-preview

请求参数

Header 参数

Body 参数application/json

示例
{
           "model": "gpt-4o",
           "stream": false,
           "messages": [
              {
                 "role": "user",
                 "content": [
                    {
                       "type": "text",
                       "text": "这张图片有什么"
                    },
                    {
                       "type": "image_url",
                       "image_url": {
                          "url": "https://github.com/dianping/cat/raw/master/cat-home/src/main/webapp/images/logo/cat_logo03.png"
                       }
                    }
                 ]
              }
           ],
           "max_tokens": 400
         }

请求示例代码

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-4o",
           "stream": false,
           "messages": [
              {
                 "role": "user",
                 "content": [
                    {
                       "type": "text",
                       "text": "这张图片有什么"
                    },
                    {
                       "type": "image_url",
                       "image_url": {
                          "url": "https://github.com/dianping/cat/raw/master/cat-home/src/main/webapp/images/logo/cat_logo03.png"
                       }
                    }
                 ]
              }
           ],
           "max_tokens": 400
         }'

返回响应

🟢200成功
application/json
Body

示例
{
    "choices": [
        {
            "content_filter_results": {
                "hate": {
                    "filtered": false,
                    "severity": "safe"
                },
                "self_harm": {
                    "filtered": false,
                    "severity": "safe"
                },
                "sexual": {
                    "filtered": false,
                    "severity": "safe"
                },
                "violence": {
                    "filtered": false,
                    "severity": "safe"
                }
            },
            "finish_reason": "stop",
            "index": 0,
            "logprobs": null,
            "message": {
                "annotations": [],
                "content": "这张图片显示了一个卡通化的猫的图案,使用渐变蓝色设计成一个猫的轮廓,并且旁边有大写字母“CAT”。其中猫的图形可能作为标识或者商标使用,并且字体和颜色设计使整个图片看起来简洁现代。",
                "refusal": null,
                "role": "assistant"
            }
        }
    ],
    "created": 1749369245,
    "id": "chatcmpl-Bg58vzK3MvTcDVatmYqnN5rTuCFe9",
    "model": "gpt-4o-2024-08-06",
    "object": "chat.completion",
    "prompt_filter_results": [
        {
            "prompt_index": 0,
            "content_filter_result": {
                "jailbreak": {
                    "filtered": false,
                    "detected": false
                },
                "custom_blocklists": {
                    "filtered": false,
                    "details": []
                }
            }
        },
        {
            "prompt_index": 1,
            "content_filter_result": {
                "sexual": {
                    "filtered": false,
                    "severity": "safe"
                },
                "violence": {
                    "filtered": false,
                    "severity": "safe"
                },
                "hate": {
                    "filtered": false,
                    "severity": "safe"
                },
                "self_harm": {
                    "filtered": false,
                    "severity": "safe"
                },
                "custom_blocklists": {
                    "filtered": false,
                    "details": []
                }
            }
        }
    ],
    "system_fingerprint": "fp_ee1d74bde0",
    "usage": {
        "completion_tokens": 68,
        "completion_tokens_details": {
            "accepted_prediction_tokens": 0,
            "audio_tokens": 0,
            "reasoning_tokens": 0,
            "rejected_prediction_tokens": 0
        },
        "prompt_tokens": 1116,
        "prompt_tokens_details": {
            "audio_tokens": 0,
            "cached_tokens": 0
        },
        "total_tokens": 1184
    }
}
修改于 2025-10-04 05:56:49
上一页
MCP调用(stdio)
下一页
修改图片
Built with