Skip to content
InfercomInfercomInfercom Documentation

Messages

Create a message

POST
/messages
Code sample: Python
import anthropic
client = anthropic.Anthropic(
base_url="https://api.infercom.ai",
api_key="your-infercom-api-key",
)
message = client.messages.create(
model="MiniMax-M2.7",
max_tokens=1024,

Send a structured list of input messages and the model will generate the next message in the conversation. This endpoint is compatible with Anthropic’s Messages API format, allowing you to use the Anthropic SDK with Infercom models.

anthropic-version
string
Example
2023-06-01

The API version to use. Supported but optional.

Message creation parameters

Media typeapplication/json
Create Message Request

Request body for creating a message.

object
model
required

The model ID to use. Call GET /v1/models to retrieve the current list of available models. See available models for details.

string
Example
MiniMax-M2.7
messages
required

The conversation messages.

Array<object>
>= 1 items
Input Message

A message in the conversation.

object
role
required

The role of the message author.

string
Allowed values: user assistant
content
required
Any of:
string
max_tokens
required

The maximum number of tokens to generate.

integer
>= 1
Example
1024
system
Any of:
string
temperature

Sampling temperature between 0 and 2. Unlike the Anthropic API, this endpoint has no default: omitting this parameter makes most models decode greedily, which behaves like temperature 0. Set it explicitly. See Recommended sampling parameters.

number
<= 2
Example
1
top_p

Nucleus sampling parameter.

number
<= 1
top_k

Top-K sampling. The minimum accepted value is 1; -1 and 0 are rejected with a 400. top_k has no effect unless temperature is 0.001 or above - below that, including when temperature is omitted, it is forced to 1 and decoding is greedy. When omitted, top_k is 1048576, which is effectively unrestricted. No upper bound is enforced.

integer
>= 1
stop_sequences

Custom stop sequences.

Array<string>
stream

Whether to stream the response.

boolean
tools

Tools the model may use.

Array<object>
Tool

Definition of a tool the model may use.

object
name
required

The name of the tool.

string
/^[a-zA-Z0-9_-]{1,128}$/
description

Description of what the tool does.

string
input_schema
required

JSON Schema for the tool’s input parameters.

object
key
additional properties
any
tool_choice
One of: discriminator: type
Tool Choice Auto
object
type
required
string
Allowed value: auto
Example
{
"model": "MiniMax-M2.7",
"max_tokens": 1024,
"messages": [
{
"role": "user",
"content": "Hello, how are you?"
}
]
}

Successful response. Returns a Message object (non-streaming), or a stream of Server-Sent Events (when stream: true).

Media typeapplication/json
Message Response

A message response from the API.

object
id
required

Unique message identifier.

string
type
required

Object type, always “message”.

string
Allowed value: message
role
required

The role of the message author, always “assistant”.

string
Allowed value: assistant
content
required

The generated content blocks.

Array
One of: discriminator: type
Text Block

A text content block in an Anthropic message.

object
type
required

The type of content block.

string
Allowed value: text
text
required

The text content.

string
model
required

The model used to generate the response.

string
stop_reason
required

The reason generation stopped.

string
nullable
Allowed values: end_turn max_tokens stop_sequence tool_use
stop_sequence

The stop sequence that triggered stopping, if any.

string
nullable
usage
required
Usage

Token usage information.

object
input_tokens
required

The number of input tokens used.

integer
output_tokens
required

The number of output tokens generated.

integer
Example
{
"id": "msg_013Zva2CMHLNnXjNJJKqJ2EF",
"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.7",
"stop_reason": "end_turn",
"stop_sequence": null,
"usage": {
"input_tokens": 12,
"output_tokens": 18
}
}
inference-id
string
Example
a0b08d8a-1893-45d6-a0f4-7ad6fdeb5443

Unique identifier for this inference request, useful for debugging and support.

x-ratelimit-limit-requests
integer
Example
250

Maximum requests allowed per minute.

x-ratelimit-limit-requests-day
integer
Example
50000

Maximum requests allowed per day.

x-ratelimit-remaining-requests
integer
Example
247

Remaining requests in the current minute window.

x-ratelimit-remaining-requests-day
integer
Example
49988

Remaining requests in the current day.

x-ratelimit-reset-requests
integer
Example
1776937132

Unix timestamp when the per-minute limit resets.

x-ratelimit-reset-requests-day
integer
Example
1777023472

Unix timestamp when the daily limit resets.

Bad Request - Missing or invalid parameters

Media typeapplication/json
Anthropic Error

Error response in Anthropic format.

object
type
required
string
Allowed value: error
error
required
object
type
required

The error type.

string
Allowed values: invalid_request_error authentication_error permission_error not_found_error rate_limit_error api_error
message
required

A human-readable error message.

string
param

The parameter that caused the error.

string
nullable
code

An error code.

string
nullable
request_id

Unique request identifier for debugging.

string
Examples
Examplemissing_field

Required field missing

{
"type": "error",
"error": {
"type": "invalid_request_error",
"message": "messages: field required"
},
"request_id": "abc123"
}

Unauthorized - Invalid or missing API key

Media typeapplication/json
Anthropic Error

Error response in Anthropic format.

object
type
required
string
Allowed value: error
error
required
object
type
required

The error type.

string
Allowed values: invalid_request_error authentication_error permission_error not_found_error rate_limit_error api_error
message
required

A human-readable error message.

string
param

The parameter that caused the error.

string
nullable
code

An error code.

string
nullable
request_id

Unique request identifier for debugging.

string
Example
{
"type": "error",
"error": {
"type": "invalid_request_error",
"message": "The model `nonexistent-model` does not exist or you do not have access to it.",
"param": "model"
},
"request_id": "2f8274e5"
}

Not found - Model does not exist

Media typeapplication/json
Anthropic Error

Error response in Anthropic format.

object
type
required
string
Allowed value: error
error
required
object
type
required

The error type.

string
Allowed values: invalid_request_error authentication_error permission_error not_found_error rate_limit_error api_error
message
required

A human-readable error message.

string
param

The parameter that caused the error.

string
nullable
code

An error code.

string
nullable
request_id

Unique request identifier for debugging.

string
Examples
Examplemodel_not_found

Model not found

{
"type": "error",
"error": {
"type": "not_found_error",
"message": "The model `nonexistent-model` does not exist or you do not have access to it."
},
"request_id": "req_5e55617e48434cdea3665c1d3044d8d4"
}

Gone - the model has been deprecated and removed. Returned in the Anthropic error shape with type: not_found_error and no code field. The condition is permanent - change the model ID rather than retrying.

Media typeapplication/json
Anthropic Error

Error response in Anthropic format.

object
type
required
string
Allowed value: error
error
required
object
type
required

The error type.

string
Allowed values: invalid_request_error authentication_error permission_error not_found_error rate_limit_error api_error
message
required

A human-readable error message.

string
param

The parameter that caused the error.

string
nullable
code

An error code.

string
nullable
request_id

Unique request identifier for debugging.

string
Example
{
"type": "error",
"error": {
"type": "not_found_error",
"message": "The requested model (MiniMax-M2.5) is not available on SambaNova Cloud."
},
"request_id": "req_dahdi1m7sdbsi2nnq710"
}

Unprocessable Entity - the model exists but is not enabled on your plan. Returned in the Anthropic error shape, so error carries message and type only.

Media typeapplication/json
Anthropic Error

Error response in Anthropic format.

object
type
required
string
Allowed value: error
error
required
object
type
required

The error type.

string
Allowed values: invalid_request_error authentication_error permission_error not_found_error rate_limit_error api_error
message
required

A human-readable error message.

string
param

The parameter that caused the error.

string
nullable
code

An error code.

string
nullable
request_id

Unique request identifier for debugging.

string
Example
{
"type": "error",
"error": {
"type": "invalid_request_error",
"message": "The model `Qwen3-TTS-12Hz-1.7B-Base` is not available on your current plan."
},
"request_id": "req_dagknn5cohtmhkppf8d0"
}

Too Many Requests - Rate limit exceeded

Media typeapplication/json
Anthropic Error

Error response in Anthropic format.

object
type
required
string
Allowed value: error
error
required
object
type
required

The error type.

string
Allowed values: invalid_request_error authentication_error permission_error not_found_error rate_limit_error api_error
message
required

A human-readable error message.

string
param

The parameter that caused the error.

string
nullable
code

An error code.

string
nullable
request_id

Unique request identifier for debugging.

string
Example
{
"type": "error",
"error": {
"type": "invalid_request_error",
"message": "The model `nonexistent-model` does not exist or you do not have access to it.",
"param": "model"
},
"request_id": "2f8274e5"
}

Internal Server Error

Media typeapplication/json
Anthropic Error

Error response in Anthropic format.

object
type
required
string
Allowed value: error
error
required
object
type
required

The error type.

string
Allowed values: invalid_request_error authentication_error permission_error not_found_error rate_limit_error api_error
message
required

A human-readable error message.

string
param

The parameter that caused the error.

string
nullable
code

An error code.

string
nullable
request_id

Unique request identifier for debugging.

string
Example
{
"type": "error",
"error": {
"type": "invalid_request_error",
"message": "The model `nonexistent-model` does not exist or you do not have access to it.",
"param": "model"
},
"request_id": "2f8274e5"
}