API调用文档
  1. 聊天模型(chat)
API调用文档
  • 前言(必读)
  • 常见错误代码及其含义
  • 聊天模型(chat)
    • 聊天接口(通用)
      POST
    • 列出可用模型
      GET
    • 聊天接口(o1系列模型)
      POST
    • 聊天补全
      POST
    • Claude3+(Openai格式调用)
      POST
    • Gemini1.5+(全系列)
      POST
    • GPTs
      POST
    • gpt-4-all 文件分析
      POST
    • gpt-4o-all 文件分析
      POST
    • 聊天接口(图片分析)
      POST
  • 创建嵌入
    • 创建嵌入
      POST
  • 音频模型(Audio)
    • 文字转语音 TTS
      POST
    • 语音转文字 whisper-1
      POST
    • 创建翻译
      POST
  • 绘画模型(Painting)
    • Dalle
      • 图像生成
      • 图像编辑
    • MidJourney
      • 提交模式与状态码说明
  • 常用调用代码整理
    • Python 示例1-1: 普通Post文本对话
    • Python 示例1-2: Openai官方库使用示例
    • Python 示例1-3: 流式输出 复制代码
    • Python 示例2:Json固定格式输出 代码展示 复制代码
    • Python 示例3:embedding代码例子 复制代码
    • Python 示例4:O1系列模型代码例子
  1. 聊天模型(chat)

聊天接口(o1系列模型)

POST
https://api.claudeshop.top/v1/chat/completions
o1系列模型官方暂不支持流式输出

请求参数

Header 参数
Content-Type
string 
必需
示例值:
application/json
Authorization
string 
令牌KEY
必需
示例值:
Bearer sk-xxxx
Body 参数application/json
model
enum<string> 
模型名称
必需
枚举值:
o1-minio1-preview
示例值:
o1-mini
messages
array [object {2}] 
必需
role
string 
角色
必需
不支持 system角色
content
string 
提问消息
必需
max_completion_tokens
number 
最大回复
可选
聊天完成时生成的最大Tokens数量。 输入标记和生成标记的总长度受模型上下文长度的限制。
stream
boolean 
流式输出
可选
该模型仅支持 false
默认值:
false
示例
{
  "model": "o1-mini",
  "messages": [
    {
      "role": "user",
      "content": "晚上好"
    }
  ],
  "max_completion_tokens": 1688,
  "stream": false
}

示例代码

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.claudeshop.top/v1/chat/completions' \
--header 'Authorization: Bearer sk-xxxx' \
--header 'Content-Type: application/json' \
--data-raw '{
    "model": "o1-mini",
    "messages": [
        {
            "role": "user",
            "content": "晚上好"
        }
    ],
    "max_completion_tokens": 1688,
    "stream": false
}'

返回响应

🟢200成功
application/json
Body
id
string 
必需
object
string 
必需
created
integer 
必需
model
string 
必需
choices
array [object {4}] 
必需
index
integer 
可选
message
object 
可选
logprobs
null 
可选
finish_reason
string 
可选
usage
object 
必需
prompt_tokens
integer 
必需
completion_tokens
integer 
必需
total_tokens
integer 
必需
system_fingerprint
string 
必需
示例
{
  "id": "chatcmpl-A1iMgDLzZtUJ9QDpfqDLxKH0zfUnp",
  "object": "chat.completion",
  "created": 1724972230,
  "model": "gpt-4o-2024-05-13",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "晚上好!有什么我可以帮你的吗?",
        "refusal": null
      },
      "logprobs": null,
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 9,
    "completion_tokens": 10,
    "total_tokens": 19
  },
  "system_fingerprint": "fp_157b3831f5"
}
上一页
列出可用模型
下一页
聊天补全
Built with