宇博API-OpenAI(ChatGPT)中文文档
  1. 聊天接口(Chat)
宇博API-OpenAI(ChatGPT)中文文档
  • 发出请求
  • 模型接口
    • 聊天接口(Chat)
      • 聊天接口
        POST
      • gpt-4-vision-preview
        POST
      • 函数调用 / Function Calling
        POST
    • 自动补全接口(Completions)
      • 内容补全接口
    • 图像接口(Images)
      • DALL·E 3
    • 向量生成接口(Embeddings)
      • 创建嵌入
    • 音频接口(Audio)
      • TTS文本转语音
      • wisper语音转文本
  • 帮助中心
    • 常见问题及解决办法
  • 未命名接口
    POST
  • 未命名接口
    POST
  1. 聊天接口(Chat)

函数调用 / Function Calling

POST
https://api.gpts.vin/v1/chat/completions

请求参数

Header 参数
Content-Type
string 
可选
示例值:
application/json
Authorization
string 
可选
示例值:
{{YOUR_API_KEY}}
Body 参数application/json
object {0}
示例
{
  "model": "gpt-4-0613",
  "messages": [
    {
      "role": "user",
      "content": "What is the weather like in Shanghai?"
    }
  ],
  "functions": [
    {
      "name": "get_current_weather",
      "description": "Get the current weather in a given location",
      "parameters": {
        "type": "object",
        "properties": {
          "location": {
            "type": "string",
            "description": "The city and state, e.g. San Francisco, CA"
          },
          "unit": {
            "type": "string",
            "enum": [
              "celsius",
              "fahrenheit"
            ]
          }
        },
        "required": [
          "location"
        ]
      }
    }
  ]
}

示例代码

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.gpts.vin/v1/chat/completions' \
--header 'Authorization:  {{YOUR_API_KEY}}' \
--header 'Content-Type: application/json' \
--data-raw '{
  "model": "gpt-4-0613",
  "messages": [
    {
      "role": "user",
      "content": "What is the weather like in Shanghai?"
    }
  ],
  "functions": [
    {
      "name": "get_current_weather",
      "description": "Get the current weather in a given location",
      "parameters": {
        "type": "object",
        "properties": {
          "location": {
            "type": "string",
            "description": "The city and state, e.g. San Francisco, CA"
          },
          "unit": {
            "type": "string",
            "enum": [
              "celsius",
              "fahrenheit"
            ]
          }
        },
        "required": [
          "location"
        ]
      }
    }
  ]
}'

返回响应

🟢200成功
application/json
Body
object {0}
示例
{}
上一页
gpt-4-vision-preview
下一页
内容补全接口
Built with