Messages
Create a message
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.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Header Parameters
Section titled “Header Parameters”Example
2023-06-01The API version to use. Supported but optional.
Request Bodyrequired
Section titled “Request Bodyrequired”Message creation parameters
Request body for creating a message.
object
The model ID to use. Call GET /v1/models to retrieve the current list of available models. See available models for details.
Example
MiniMax-M2.7The conversation messages.
A message in the conversation.
object
The role of the message author.
A text content block in an Anthropic message.
object
The type of content block.
The text content.
A tool use content block, indicating the model wants to call a tool.
object
The type of content block.
Unique identifier for this tool use.
The name of the tool to call.
The input parameters for the tool call.
object
A tool result content block, providing the output of a tool call.
object
The type of content block.
The ID of the tool use this result is for.
A text content block in an Anthropic message.
object
The type of content block.
The text content.
Whether this result represents an error.
The maximum number of tokens to generate.
Example
1024A text content block in an Anthropic message.
object
The type of content block.
The text content.
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.
Example
1Nucleus sampling parameter.
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.
Custom stop sequences.
Whether to stream the response.
Tools the model may use.
Definition of a tool the model may use.
object
The name of the tool.
Description of what the tool does.
JSON Schema for the tool’s input parameters.
object
object
object
object
The name of the specific tool to use.
Example
{ "model": "MiniMax-M2.7", "max_tokens": 1024, "messages": [ { "role": "user", "content": "Hello, how are you?" } ]}Responses
Section titled “Responses”Successful response. Returns a Message object (non-streaming), or a stream of Server-Sent Events (when stream: true).
A message response from the API.
object
Unique message identifier.
Object type, always “message”.
The role of the message author, always “assistant”.
The generated content blocks.
A text content block in an Anthropic message.
object
The type of content block.
The text content.
A tool use content block, indicating the model wants to call a tool.
object
The type of content block.
Unique identifier for this tool use.
The name of the tool to call.
The input parameters for the tool call.
object
The model used to generate the response.
The reason generation stopped.
The stop sequence that triggered stopping, if any.
Token usage information.
object
The number of input tokens used.
The number of output tokens generated.
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 }}Headers
Section titled “Headers”Example
a0b08d8a-1893-45d6-a0f4-7ad6fdeb5443Unique identifier for this inference request, useful for debugging and support.
Example
250Maximum requests allowed per minute.
Example
50000Maximum requests allowed per day.
Example
247Remaining requests in the current minute window.
Example
49988Remaining requests in the current day.
Example
1776937132Unix timestamp when the per-minute limit resets.
Example
1777023472Unix timestamp when the daily limit resets.
Bad Request - Missing or invalid parameters
Error response in Anthropic format.
object
object
The error type.
A human-readable error message.
The parameter that caused the error.
An error code.
Unique request identifier for debugging.
Examples
Required field missing
{ "type": "error", "error": { "type": "invalid_request_error", "message": "messages: field required" }, "request_id": "abc123"}Unauthorized - Invalid or missing API key
Error response in Anthropic format.
object
object
The error type.
A human-readable error message.
The parameter that caused the error.
An error code.
Unique request identifier for debugging.
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
Error response in Anthropic format.
object
object
The error type.
A human-readable error message.
The parameter that caused the error.
An error code.
Unique request identifier for debugging.
Examples
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.
Error response in Anthropic format.
object
object
The error type.
A human-readable error message.
The parameter that caused the error.
An error code.
Unique request identifier for debugging.
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.
Error response in Anthropic format.
object
object
The error type.
A human-readable error message.
The parameter that caused the error.
An error code.
Unique request identifier for debugging.
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
Error response in Anthropic format.
object
object
The error type.
A human-readable error message.
The parameter that caused the error.
An error code.
Unique request identifier for debugging.
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
Error response in Anthropic format.
object
object
The error type.
A human-readable error message.
The parameter that caused the error.
An error code.
Unique request identifier for debugging.
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"}