메인 콘텐츠로 건너뛰기
POST
/
v1
/
messages
Create message (Claude)
curl --request POST \
  --url https://api.dgrid.ai/v1/messages \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --header 'anthropic-version: <anthropic-version>' \
  --data '
{
  "model": "claude-3-5-sonnet-20241022",
  "max_tokens": 1024,
  "messages": [
    {
      "role": "user",
      "content": "Hello, Claude"
    }
  ]
}
'
{
  "id": "<string>",
  "type": "<string>",
  "role": "<string>",
  "content": [
    {
      "type": "<string>",
      "text": "<string>"
    }
  ],
  "model": "<string>",
  "stop_reason": "<string>",
  "usage": {
    "input_tokens": 123,
    "output_tokens": 123,
    "cache_creation_input_tokens": 123,
    "cache_read_input_tokens": 123
  }
}

인증

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.