claude-3-haiku-20240307
POST
/v1/chat/completions请求参数
Header 参数
Authorization
string
可选
示例值:
{{KEY}}
Body 参数application/json
model
string
必需
messages
array [object {2}]
必需
role
string
可选
content
array [object {3}]
可选
max_tokens
integer
必需
示例
{
"model": "claude-3-sonnet-20240229",
"messages": [
{
"role": "user",
"content": [
{
"type": "text",
"text": "你看到了什么?"
},
{
"type": "image_url",
"image_url": {
"url": "https://images.pexels.com/photos/20720278/pexels-photo-20720278.jpeg"
}
}
]
}
]
}
示例代码
返回响应
成功(200)
HTTP 状态码: 200
内容格式: JSONapplication/json
数据结构
id
string
必需
object
string
必需
created
integer
必需
model
string
必需
choices
array [object {3}]
必需
index
integer
可选
message
object
可选
finish_reason
string
可选
usage
object
必需
prompt_tokens
integer
必需
completion_tokens
integer
必需
total_tokens
integer
必需
示例
{
"id": "gen-vRuNXMylWM4Wh8gAanjZQUZfBvet",
"model": "anthropic/claude-3-sonnet",
"object": "chat.completion",
"created": 1712753844,
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "This image depicts a breathtaking winter landscape in what appears to be Iceland or a similar locale. In the foreground, there is a small house with a red roof, nestled on a snow-covered plain near a winding river or inlet. The river's dark waters contrast strikingly with the surrounding white snow.\n\nIn the background, two majestic snow-capped mountains rise prominently, their distinct cone-shaped peaks standing out against the cloudy gray sky. The larger mountain appears to have traces of black volcanic rock visible beneath the snow on its slopes.\n\nThe overall scene conveys a sense of remoteness, serenity, and the raw beauty of nature. The stark yet harmonious colors, the interplay of water, snow, and rock formations, and the isolated human dwelling create an incredibly picturesque and almost otherworldly composition."
},
"finish_reason": "end_turn"
}
],
"usage": {
"prompt_tokens": 1588,
"completion_tokens": 181,
"total_tokens": 1769,
"total_cost": 0.007479
}
}
最后修改时间: 6 个月前