Skip to main content
POST
Create message (Claude)

授權

Authorization
string
header
必填

Your DGrid API key. All endpoints use Authorization: Bearer <DGRID_API_KEY>.

標頭

anthropic-version
string
預設值:2023-06-01
必填

Anthropic API version header.

主體

application/json
model
string
必填

Model ID, such as claude-3-5-sonnet-20241022.

範例:

"claude-3-5-sonnet-20241022"

max_tokens
integer
必填

Maximum output token count.

範例:

1024

messages
object[]
必填

Conversation message list.

system
string

System instructions.

temperature
number

Sampling temperature.

top_p
number

Top-p sampling.

top_k
integer

Top-k sampling.

stop_sequences
string[]

Stop sequences.

stream
boolean

Enable streaming responses.

tools
object[]

Tool schema definitions.

tool_choice
object

Tool selection strategy.

回應

Claude message result.

id
string

Message identifier.

type
string

Always message.

role
string

Always assistant.

content
object[]

Returned content blocks.

model
string

Model that produced the output.

stop_reason
string

end_turn, max_tokens, stop_sequence, or tool_use.

usage
object

Token usage metadata.