wenwen
  1. 聊天对话-OpenAI格式(/chat/completions)
wenwen
  • 聊天对话-OpenAI格式(/chat/completions)
    • 聊天
      POST
    • 流式返回
      POST
    • 结构化输出
      POST
    • 工具调用(function call)
      POST
    • 分析图片
      POST
    • 修改图片
      POST
    • 生成图片
      POST
  • 聊天对话-Anthropic格式(/messages)
    • 聊天
      POST
    • 流式返回
      POST
    • 分析图片
      POST
  • 绘图模型-OpenAI格式(/images)
    • 文生图(基础)
      POST
    • 文生图(高质量)
      POST
    • 文生图(base64)
      POST
    • 图像编辑(dall-e-2)
      POST
    • 图像编辑(gpt-image-1)
      POST
  • 绘图模型-Midjourney(/mj)
    • 文生图(Imagine)
      POST
    • 图片融合(Blend)
      POST
  • 向量化(/embeddings)
    • 文本向量化
      POST
  1. 聊天对话-OpenAI格式(/chat/completions)

生成图片

POST
/v1/chat/completions
根据提示词生成图片。
需要模型支持生图能力,比如:gpt-4o-image
模型列表请参考问问平台:https://api.wenwen-ai.com/pricing
BASE_URL: https://api.wenwen-ai.com

请求参数

Header 参数
Authorization
string 
必需
示例值:
Bearer {YOUR_API_KEY}
Content-Type
string 
必需
示例值:
application/json
Body 参数application/json
model
string 
要使用的模型的名字
必需
stream
boolean 
设置为false
必需
messages
array [object {2}] 
必需
role
string 
user
必需
content
string 
画图提示词
必需
示例
{
   "model": "gpt-4o-image",
   "stream": false,
   "messages": [
      {
         "role": "user",
         "content": "画只猫"
      }
   ]
}

示例代码

HTTP
Shell
JavaScript
Java
Swift
Go
PHP
Python
C
C#
Objective-C
Ruby
OCaml
Dart
R
请求示例请求示例
HTTP
Shell
JavaScript
Java
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-image",
   "stream": false,
   "messages": [
      {
         "role": "user",
         "content": "画只猫"
      }
   ]
}'

返回响应

🟢200成功
application/json
Body
id
string 
必需
object
string 
必需
created
integer 
必需
model
string 
必需
choices
array [object {3}] 
必需
index
integer 
可选
message
object 
可选
finish_reason
string 
可选
usage
object 
必需
prompt_tokens
integer 
必需
completion_tokens
integer 
必需
total_tokens
integer 
必需
示例
{
    "id": "chatcmpl-2ae838b1-6281-47fd-9a49-a1dc7bfd0d97",
    "object": "chat.completion",
    "created": 1749370100,
    "model": "sora_image",
    "choices": [
        {
            "index": 0,
            "message": {
                "role": "assistant",
                "content": "![图片](https://midjourney-plus.oss-us-west-1.aliyuncs.com/sora/75d509d1-4c64-4299-8286-29c1f11db701.png)\n\n"
            },
            "finish_reason": "stop"
        }
    ],
    "usage": {
        "prompt_tokens": 0,
        "completion_tokens": 0,
        "total_tokens": 0
    }
}
修改于 2025-06-11 08:25:54
上一页
修改图片
下一页
聊天
Built with