主题
快速开始
1. 获取 API Key
注册账号后,在控制台创建 API Key。
2. 发起请求
bash
curl https://api.example.com/v1/chat/completions \
-H "Authorization: Bearer sk-your-api-key" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4o",
"messages": [{"role": "user", "content": "Hello!"}]
}'3. 查看响应
成功响应示例:
json
{
"id": "chatcmpl-xxx",
"object": "chat.completion",
"choices": [{
"message": {
"role": "assistant",
"content": "Hello! How can I help you?"
}
}]
}