Anthropic Claude
POST
https://api.deerapi.com/v1/messages
请求示例请求示例
Shell
JavaScript
Java
Swift
curl --location --request POST 'https://api.deerapi.com/v1/messages' \
--header 'Authorization: Bearer {{api-key}}' \
--header 'Content-Type: application/json' \
--data-raw '{
"model": "claude-3-5-sonnet-20240620",
"max_tokens": 1024,
"messages": [
{
"role": "user",
"content": "Hello, world"
}
]
}'
响应示例响应示例
{
"id": "chatcmpl-a1568ee22c7a4f31848f3dc16c2f3",
"type": "message",
"role": "assistant",
"content": [
{
"type": "text",
"text": "Hello! It's nice to meet you. I'm Claude, an AI assistant. How can I help you today? Feel free to ask me anything you'd like - I'm happy to assist with a wide range of topics and tasks."
}
],
"model": "claude-3-5-sonnet-20240620",
"stop_reason": "end_turn",
"stop_sequence": null,
"usage": {
"input_tokens": 3,
"output_tokens": 52,
"cache_creation_input_tokens": 0,
"cache_read_input_tokens": 0
}
}
请求参数
Header 参数
Authorization
string
必需
示例值:
Bearer {{api-key}}
Body 参数application/json
返回响应
修改于 2025-03-28 02:59:36