在使用 API 接口前,请先在百川 API 开放平台完成实名认证、充值、创建 APIkey 等流程,如下图所示 

curl --location --request POST 'http://dev-cn.your-api-server.com/v1/chat/completions' \
--header 'Authorization: Bearer ${api_key}' \
--header 'Content-Type: application/json' \
--data-raw '{
          "model": "Baichuan2-Turbo",
          "messages": [
            { "role": "user", "content": "我日薪8块钱,请问在闰年的二月,我月薪多少" }
          ],
          "temperature": 0.3,
          "stream": false
        }'                {
  "id": "3213214123",
  "created": 1697932800,
  "choices": [
    {
      "index": 0,
      "finish_reason": "stop",
      "message": {
        "role": "assistant",
        "content": "首先,我们需要确定闰年的二月有多少天。闰年的二月有29天。\n\n然后,我们可以计算你的月薪:\n\n日薪 = 月薪 / (当月天数)\n\n所以,你的月薪 = 日薪 * 当月天数\n\n将数值代入公式:\n\n月薪 = 8元/天 * 29天 = 232元\n\n因此,你在闰年的二月的月薪是232元。"
      }
    }
  ],
  "model": "Baichuan2-Turbo",
  "object": "chat.completion",
  "usage": {
    "prompt_tokens": 17,
    "completion_tokens": 100,
    "total_tokens": 117
  }
}