Skip to main content
POST
/
v1
/
messages
Create a Message
curl --request POST \
  --url https://www.anyfast.ai/v1/messages \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "model": "claude-sonnet-4-6",
  "messages": [
    {
      "role": "user",
      "content": "Hello, Claude!"
    }
  ],
  "max_tokens": 1024,
  "system": "<string>",
  "metadata": {
    "user_id": "<string>"
  },
  "stop_sequences": [
    "<string>"
  ],
  "temperature": 1,
  "top_p": 0.5,
  "top_k": 1,
  "stream": false,
  "tools": [
    {
      "name": "<string>",
      "input_schema": {},
      "description": "<string>"
    }
  ],
  "tool_choice": {
    "type": "auto",
    "name": "<string>"
  },
  "thinking": {
    "type": "enabled",
    "budget_tokens": 1025
  }
}
'
{
  "id": "msg_01XFDUDYJgAACzvnptvVoYEL",
  "type": "message",
  "role": "assistant",
  "content": [
    {
      "type": "text",
      "text": "Hello! How can I help you today?"
    }
  ],
  "model": "claude-sonnet-4-6",
  "stop_reason": "end_turn",
  "usage": {
    "input_tokens": 123,
    "output_tokens": 123,
    "cache_creation_input_tokens": 123,
    "cache_read_input_tokens": 123
  },
  "stop_sequence": "<string>"
}

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

The model that will complete your prompt.

Available options:
claude-sonnet-4-6,
claude-sonnet-4-5-20250929,
claude-sonnet-4-20250514,
claude-opus-4-6,
claude-opus-4-5-20251101,
claude-opus-4-1-20250805,
claude-opus-4-20250514,
claude-haiku-4-5-20251001,
claude-3-7-sonnet-20250219,
claude-3-5-sonnet-20241022
Example:

"claude-sonnet-4-6"

messages
object[]
required

Input messages. Each message has a role and content.

Minimum array length: 1
Example:
[
  {
    "role": "user",
    "content": "Hello, Claude!"
  }
]
max_tokens
integer
required

The maximum number of tokens to generate before stopping.

Required range: x >= 1
Example:

1024

system

System prompt. Provides context and instructions to Claude.

metadata
object

An object describing metadata about the request.

stop_sequences
string[]

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

temperature
number
default:1

Amount of randomness injected into the response. Ranges from 0.0 to 1.0.

Required range: 0 <= x <= 1
Example:

1

top_p
number

Use nucleus sampling. Recommended to use either temperature or top_p, but not both.

Required range: 0 <= x <= 1
top_k
integer

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

Required range: x >= 0
stream
boolean
default:false

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

tools
object[]

Definitions of tools that the model may use.

tool_choice
object

How the model should use the provided tools.

thinking
object

Configuration for extended thinking. When enabled, the model will think before responding.

Response

Message created successfully

id
string
required
Example:

"msg_01XFDUDYJgAACzvnptvVoYEL"

type
string
required
Example:

"message"

role
string
required
Example:

"assistant"

content
object[]
required
Example:
[
  {
    "type": "text",
    "text": "Hello! How can I help you today?"
  }
]
model
string
required
Example:

"claude-sonnet-4-6"

stop_reason
enum<string>
required
Available options:
end_turn,
max_tokens,
stop_sequence,
tool_use,
null
usage
object
required
stop_sequence
string | null