MESSAGES

Create a Message

Send a structured list of input messages and receive a model-generated response. Supports text, images, tool use, and extended thinking.

POST/v1/messages

Authorization

Authorizationstringheaderrequired

Bearer token — your API key. Example: Bearer sk-...

Request body

application/json
modelstringrequired

The model to use (e.g. MiniMax-M2.5).

messagesobject[]required

An array of input messages. Each message has a role (user or assistant) and content.

max_tokensintegerrequired

The maximum number of tokens to generate before stopping.

systemstring | object[]

System prompt — provides instructions and context to the model. Can be a string or array of system blocks.

toolsobject[]

Definitions of tools the model may use. Each tool has a name, description, and input schema.

tool_choice"auto" | "any" | object

Controls which tool (if any) the model calls. 'auto' lets the model decide, 'any' forces tool use, 'none' disables tools, or specify a tool by name.

stop_sequencesstring[]

Custom sequences that will cause the model to stop generating. The stop sequence itself is not included in the response.

temperaturenumber

Sampling temperature between 0 and 1. Higher values (e.g. 0.8) make output more random, lower values (e.g. 0.2) make it more deterministic. Defaults to 1.

top_pnumber

Nucleus sampling: only consider tokens whose cumulative probability exceeds this value. Recommended to use temperature or top_p, but not both.

top_kinteger

Only sample from the top K most likely tokens at each step. Recommended to use either temperature, top_p, or top_k.

streamboolean

Whether to stream the response using server-sent events. When true, the response is sent as a series of SSE events: message_start, content_block_start, content_block_delta, content_block_stop, message_delta, and message_stop.

thinkingobject

Configuration for extended thinking. When enabled, the model can use internal reasoning before responding.

metadataobject

Optional metadata about the request.

Response

idstringrequired

Unique message identifier (e.g. msg_01XFDUDYJgAACzvnptvVoYEL).

type"message"required

Object type — always "message".

role"assistant"required

The role — always "assistant".

contentobject[]required

Array of content blocks generated by the model.

modelstringrequired

The model that handled the request.

stop_reason"end_turn" | "max_tokens" | "stop_sequence" | "tool_use"required

The reason the model stopped generating. end_turn: natural stop, max_tokens: hit the limit, stop_sequence: matched a stop sequence, tool_use: the model invoked a tool.

end_turnmax_tokensstop_sequencetool_use
stop_sequencestringrequired

The stop sequence that caused the model to stop, if applicable.

usageobjectrequired

Request

import Anthropic from "@anthropic-ai/sdk";

const client = new Anthropic({
  apiKey: "your-scx-api-key",
  baseURL: "https://api.scx.ai",
});

const message = await client.messages.create({
  model: "MiniMax-M2.5",
  max_tokens: 1024,
  messages: [{ role: "user", content: "Hello, how are you?" }],
});

console.log(message);

Response

{
  "id": "msg_01XFDUDYJgAACzvnptvVoYEL",
  "type": "message",
  "role": "assistant",
  "content": [
    {
      "type": "text",
      "text": "Hello! I'm doing well, thank you for asking. How can I help you today?"
    }
  ],
  "model": "MiniMax-M2.5",
  "stop_reason": "end_turn",
  "stop_sequence": null,
  "usage": {
    "input_tokens": 12,
    "output_tokens": 18
  }
}