Skip to main content
POST
/
messages
Anthropic Messages
curl --request POST \
  --url https://api.linkmodel.ai/v1/messages \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "model": "claude-opus-4-7",
  "messages": [
    {
      "role": "user",
      "content": "Hello, who are you?"
    }
  ],
  "max_tokens": 1024,
  "system": "You are a helpful assistant.",
  "stream": false,
  "stop_sequences": [
    "<string>"
  ]
}
'
{
  "id": "msg_abc123",
  "type": "message",
  "role": "assistant",
  "model": "claude-opus-4-7",
  "content": [
    {
      "type": "text",
      "text": "I'm Claude, an AI assistant made by Anthropic."
    }
  ],
  "stop_reason": "end_turn",
  "stop_sequence": "<string>",
  "usage": {
    "input_tokens": 12,
    "output_tokens": 18
  }
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json
model
enum<string>
required

ID of the chat model to use. Must be one of the supported models listed above.

Available options:
claude-opus-4-7,
deepseek-v4-pro,
kimi-k2.6
Example:

"claude-opus-4-7"

messages
object[]
required

Input messages. Alternating user / assistant turns.

max_tokens
integer
required

The maximum number of tokens to generate before stopping. Required.

Example:

1024

system
string

A system prompt providing context and instructions, set at the top level.

Example:

"You are a helpful assistant."

stream
boolean
default:false

If true, the response is streamed as Server-Sent Events.

stop_sequences
string[]

Custom text sequences that will cause the model to stop generating. The generated text will not contain the stop sequence.

Response

Message result. When stream is true, the body is an SSE stream instead.

id
string
Example:

"msg_abc123"

type
string
Example:

"message"

role
string
Example:

"assistant"

model
string
Example:

"claude-opus-4-7"

content
object[]
stop_reason
enum<string>
Available options:
end_turn,
max_tokens,
stop_sequence
Example:

"end_turn"

stop_sequence
string | null
usage
object