Service API 接入 · 02

30 秒快速验证

bash
curl -sS "$JF_BASE_URL/chat/completions" \
  -H "Authorization: Bearer $JF_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "stream": false,
    "messages": [{"role": "user", "content": "用一句话介绍你自己"}]
  }'

返回:

json
{
  "id": "chatcmpl-xxxxxxxxxxxx",
  "object": "chat.completion",
  "created": 1745300000,
  "model": "<service 绑定的模型>",
  "choices": [{
    "index": 0,
    "message": {"role": "assistant", "content": "..."},
    "finish_reason": "stop"
  }],
  "usage": {"prompt_tokens": 0, "completion_tokens": 0, "total_tokens": 0},
  "conversation_id": "conv-xxxxxxxx"
}

拿到 conversation_id 后续要带上才能续会话,详见 §3。