Skip to content
中文

POST /v1/messages

Method: POSTEndpoint: /v1/messages

This section contains endpoint-specific behavior, parameters, or usage notes for this API.

This section contains endpoint-specific behavior, parameters, or usage notes for this API. This section contains endpoint-specific behavior, parameters, or usage notes for this API.

--header "anthropic-beta: output-128k-2025-02-19"

This section contains endpoint-specific behavior, parameters, or usage notes for this API.

{
"content": [
{
"type": "thinking",
"thinking": "To approach this, let's think about what we know about prime numbers...",
"signature": "zbbJhbGciOiJFU8zI1NiIsImtakcjsu38219c0.eyJoYXNoIjoiYWJjMTIzIiwiaWFxxxjoxNjE0NTM0NTY3fQ...."
},
{
"type": "text",
"text": "Yes, there are infinitely many prime numbers such that..."
}
]
}

Request Parameters

Header Parameters

text
Content-Type
string
Optional
Example:
application/json
Accept
string
Optional
Example:
*/*
x-api-key
string
Optional
Example:
{{key}}
Authorization
string
Optional
Default Value:
Bearer {{YOUR_API_KEY}}

Body Parameters application/json

text
object
Example
{
"model"
:
"claude-3-7-sonnet-20250219"
,
"max_tokens"
:
20000
,
"thinking"
:
{
"type"
:
"enabled"
,
"budget_tokens"
:
16000
}
,
"messages"
:
[
{
"role"
:
"user"
,
"content"
:
  // provider-specific example normalized for English documentation
}
]
}

Example Request

Shell

bash
curl --location --request POST '/v1/messages' \
--header 'Accept: */*' \
--header 'x-api-key: {{key}}' \
--header 'Authorization: Bearer {{YOUR_API_KEY}}' \
--header 'Content-Type: application/json' \
--data-raw '{
    "model": "claude-3-7-sonnet-20250219",
    "max_tokens": 20000,
    "thinking": {
        "type": "enabled",
        "budget_tokens": 16000
    },
    "messages": [
        {
            "role": "user",
  // provider-specific example normalized for English documentation
        }
    ]
}'

Response

🟢 200 Success

Content Type: application/json

Response Schema

text
object

Example

json
{}