MetaChat API
  1. 普通聊天
MetaChat API
  • 概述
  • Midjourney
    • 接入说明
    • 模型价格
    • 图像生成
      • 图像生成
    • 图像变换
      • 图像拆分
      • 图像微调(四宫格)
      • 图像重绘
      • 图像高清
      • 图像微调(单图)
      • 图像变焦
      • 图像平移
    • 图像处理
      • 图像描述
      • 图像融合
    • 任务查询
      • 查询结果
  • FLUX.1
    • 接入说明
    • 模型价格
    • 图像生成
      • 图像生成
    • 任务查询
      • 查询结果
  • OpenAI
    • 接入说明
    • 模型价格
    • 聊天(Chat)
      • Chat Completions 对象
      • Chat Completions 对象块
      • 创建 Chat Completions
    • 图像(Images)
      • 图像对象
      • 图像生成
      • 图片编辑
  • Claude
    • 接入说明
    • 模型价格
    • 聊天(Messages)
      • 消息
  • Gemini
    • 接入说明
    • 模型价格
    • 文本生成
      • 文档理解
      • 文字输入
      • 图片输入
      • 流式输出
      • 多轮对话
      • 多轮对话(流式)
      • 配置参数
    • 图像生成
      • 使用 Gemini 生成图像
      • 使用 Gemini 编辑图像
      • 使用 Imagen 生成图像
  • DeepSeek
    • 接入说明
    • 模型价格
    • 普通聊天
      • 多轮对话
      • 对话补全
        POST
    • 推理聊天
      • 推理模型
  1. 普通聊天

对话补全

POST
https://llm-api.mmchat.xyz/v1/chat/completions
根据输入的上下文,来让模型补全对话内容。
请求示例请求示例
Shell
JavaScript
Java
Swift
curl --location --request POST 'https://llm-api.mmchat.xyz/v1/chat/completions' \
--header 'Authorization: Bearer METACHAT_API_KEY' \
--header 'Content-Type: application/json' \
--data-raw '{
  "messages": [
    {
      "content": "You are a helpful assistant",
      "role": "system"
    },
    {
      "content": "你是谁?",
      "role": "user"
    }
  ],
  "model": "deepseek-chat",
  "frequency_penalty": 0,
  "max_tokens": 2048,
  "presence_penalty": 0,
  "response_format": {
    "type": "text"
  },
  "stop": null,
  "stream": false,
  "stream_options": null,
  "temperature": 1,
  "top_p": 1,
  "tools": null,
  "tool_choice": "none",
  "logprobs": false,
  "top_logprobs": null
}'
响应示例响应示例
200 - No streaming - 成功示例
{
    "id": "e137bb42-7580-4cb8-88ba-825209cf966b",
    "choices": [
        {
            "index": 0,
            "message": {
                "role": "assistant",
                "content": "Hello! How can I assist you today? 😊"
            },
            "logprobs": null,
            "finish_reason": "stop"
        }
    ],
    "created": 1739112811,
    "model": "deepseek-chat",
    "system_fingerprint": "fp_3a5790e1b4",
    "object": "chat.completion",
    "usage": {
        "prompt_tokens": 9,
        "completion_tokens": 11,
        "total_tokens": 20,
        "prompt_tokens_details": {
            "cached_tokens": 0
        },
        "prompt_cache_hit_tokens": 0,
        "prompt_cache_miss_tokens": 9
    }
}

请求参数

Header 参数
Content-Type
string 
必需
示例值:
application/json
Authorization
string 
必需
示例值:
Bearer METACHAT_API_KEY
Body 参数application/json
messages
array [oneOf] 
对话的消息列表
必需
>= 1 items
object 
System message
可选
object 
User message
可选
object 
Assistant message
可选
object 
Tool message
可选
model
enum<string> 
使用的 AI 模型
必需
枚举值:
deepseek-chatdeepseek-reasoner
frequency_penalty
number  | null 
可选
max_tokens
integer  | null 
可选
presence_penalty
number  | null 
可选
response_format
object  | null 
可选
type
string  | null 
可选
stop
可选
One of
stream
boolean  | null 
是否启用流式传输
可选
stream_options
object  | null 
可选
include_usage
boolean 
可选
temperature
number  | null 
可选
top_p
number  | null 
可选
tools
null 
可选
tool_choice
可选
One of
logprobs
boolean  | null 
可选
top_logprobs
integer  | null 
可选
示例

返回响应

🟢200No streaming
application/json
OK, 返回一个 chat completion 对象。
Body
id
string 
必需
choices
array [object {4}] 
必需
finish_reason
string 
可选
index
integer 
可选
message
object 
可选
logprobs
object  | null 
必需
created
integer 
必需
model
string 
必需
system_fingerprint
string 
必需
object
string 
必需
usage
object 
可选
completion_tokens
integer 
必需
prompt_tokens
integer 
必需
prompt_cache_hit_tokens
integer 
必需
prompt_cache_miss_tokens
integer 
必需
total_tokens
integer 
必需
completion_tokens_details
object 
可选
🟢200Streaming
修改于 2025-06-17 17:49:49
上一页
多轮对话
下一页
推理模型
Built with