Perplexity.ai
    Perplexity.ai
    • pplx-api 入门
    • 速率限制
    • 支持型号
    • 功能路线图
    • PerplexityBot
    • 价钱
    • 常见问题
    • 聊天完成
      POST

      聊天完成

      开发环境
      http://dev-cn.your-api-server.com
      开发环境
      http://dev-cn.your-api-server.com
      POST
      /chat/completions
      为给定的聊天对话生成模型的响应。
      请求示例请求示例
      Shell
      JavaScript
      Java
      Swift
      curl --location --request POST 'http://dev-cn.your-api-server.com/chat/completions' \
      --header 'content-type: application/json' \
      --data-raw '{
        "model": "mistral-7b-instruct",
        "messages": [
          {
            "role": "system",
            "content": "Be precise and concise."
          },
          {
            "role": "user",
            "content": "How many stars are there in our galaxy?"
          }
        ]
      }'
      响应示例响应示例
      200 - 成功示例
      {
        "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
        "model": "string",
        "object": "string",
        "created": 0,
        "choices": [
          {
            "index": 0,
            "finish_reason": "stop",
            "message": {
              "content": "string",
              "role": "system"
            },
            "delta": {
              "content": "string",
              "role": "system"
            }
          }
        ],
        "usage": {
          "prompt_tokens": 0,
          "completion_tokens": 0,
          "total_tokens": 0
        }
      }

      请求参数

      Header 参数

      Body 参数application/json

      示例

      返回响应

      🟢200成功
      application/json
      Body

      🟠422参数错误
      修改于 2023-12-13 05:54:22
      上一页
      常见问题
      Built with