跳转到主要内容
POST
/
v1
/
messages
Claude Messages
curl --request POST \
  --url https://api.acedata.cloud/v1/messages \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "model": "claude-sonnet-4-6",
  "messages": [
    {
      "role": "user",
      "content": "<string>"
    }
  ],
  "max_tokens": 1024,
  "metadata": {
    "user_id": "<string>"
  },
  "stop_sequences": [
    "<string>"
  ],
  "stream": false,
  "system": "<string>",
  "temperature": 1,
  "tool_choice": {},
  "tools": [
    {}
  ],
  "top_k": 123,
  "top_p": 123
}
'
{
  "id": "<string>",
  "type": "message",
  "role": "assistant",
  "content": [
    {
      "type": "text",
      "text": "<string>",
      "id": "<string>",
      "name": "<string>",
      "input": {}
    }
  ],
  "model": "<string>",
  "stop_reason": "end_turn",
  "stop_sequence": "<string>",
  "usage": {
    "input_tokens": 123,
    "output_tokens": 123
  }
}

授权

Authorization
string
header
必填

请求体

application/json
model
string
必填

The model that will complete your prompt.

示例:

"claude-sonnet-4-6"

messages
object[]
必填

Input messages.

max_tokens
integer
必填

The maximum number of tokens to generate before stopping.

示例:

1024

metadata
object
stop_sequences
string[]

Custom text sequences that will cause the model to stop generating.

stream
boolean
默认值:false

Whether to incrementally stream the response using server-sent events.

system
string

System prompt.

temperature
number

Amount of randomness injected into the response.

必填范围: 0 <= x <= 1
示例:

1

tool_choice
object

How the model should use the provided tools.

tools
object[]

Definitions of tools that the model may use.

top_k
integer

Only sample from the top K options for each subsequent token.

top_p
number

Use nucleus sampling.

响应

OK

id
string
必填

Unique object identifier.

type
enum<string>
必填
可用选项:
message
role
enum<string>
必填
可用选项:
assistant
content
object[]
必填
model
string
必填

The model that handled the request.

stop_reason
enum<string> | null
必填
可用选项:
end_turn,
max_tokens,
stop_sequence,
tool_use
stop_sequence
string | null
必填
usage
object
必填