Anthropic Compatible API
Use the Anthropic-compatible endpoint to interact with MiMo models via the Messages API format.
Endpoint
POST https://api.mimo-v2.com/anthropic/v1/messagesAuthentication
Authenticate requests using the following header:
| Header | Format |
|---|---|
api-key | <your-api-key> |
You can generate API keys from Settings → API Keys in your Mimo dashboard.
Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
model | string | Yes | Model ID. Options: mimo-v2-pro, mimo-v2-omni, mimo-v2-flash |
messages | array | Yes | Array of message objects |
max_tokens | integer | Yes | Maximum tokens to generate |
system | string | No | System prompt |
temperature | number | No | Sampling temperature (default: 1.0) |
top_p | number | No | Nucleus sampling (default: 0.95) |
stream | boolean | No | Enable streaming (default: false) |
stop_sequences | array | No | Stop sequences |
Message Object
| Field | Type | Description |
|---|---|---|
role | string | One of: user, assistant |
content | string/array | Message content (text or content block array) |
Example Request
curl https://api.mimo-v2.com/anthropic/v1/messages \
-H "Content-Type: application/json" \
-H "api-key: YOUR_API_KEY" \
-d '{
"model": "mimo-v2-pro",
"max_tokens": 1024,
"system": "You are a helpful assistant.",
"messages": [
{"role": "user", "content": "Hello, who are you?"}
]
}'Response Format
{
"id": "msg_xxx",
"type": "message",
"role": "assistant",
"content": [
{
"type": "text",
"text": "Hello! I am MiMo..."
}
],
"model": "mimo-v2-pro",
"stop_reason": "end_turn",
"usage": {
"input_tokens": 50,
"output_tokens": 100
}
}Response Fields
| Field | Description |
|---|---|
id | Unique identifier for the message |
type | Always message |
role | Always assistant |
content | Array of content blocks |
content[].type | Content block type (e.g., text) |
content[].text | The generated text |
model | The model used |
stop_reason | Why the model stopped: end_turn, max_tokens, or stop_sequence |
usage | Token usage statistics |
Streaming Response
When stream is set to true, the API returns Server-Sent Events (SSE). The stream consists of a sequence of typed events.
Streaming Request Example
curl https://api.mimo-v2.com/anthropic/v1/messages \
-H "Content-Type: application/json" \
-H "api-key: YOUR_API_KEY" \
-d '{
"model": "mimo-v2-pro",
"max_tokens": 1024,
"messages": [
{"role": "user", "content": "Hello!"}
],
"stream": true
}'Streaming Event Format
The stream emits a series of SSE events with different types:
event: message_start
data: {"type":"message_start","message":{"id":"msg_xxx","type":"message","role":"assistant","content":[],"model":"mimo-v2-pro","stop_reason":null,"usage":{"input_tokens":50,"output_tokens":0}}}
event: content_block_start
data: {"type":"content_block_start","index":0,"content_block":{"type":"text","text":""}}
event: content_block_delta
data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"Hello"}}
event: content_block_delta
data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"!"}}
event: content_block_stop
data: {"type":"content_block_stop","index":0}
event: message_delta
data: {"type":"message_delta","delta":{"stop_reason":"end_turn"},"usage":{"output_tokens":15}}
event: message_stop
data: {"type":"message_stop"}Stream Event Types
| Event | Description |
|---|---|
message_start | Indicates the start of the message with metadata |
content_block_start | Marks the beginning of a new content block |
content_block_delta | Contains incremental text content |
content_block_stop | Marks the end of a content block |
message_delta | Contains message-level updates (e.g., stop reason) |
message_stop | Indicates the end of the stream |
Unlike the OpenAI streaming format, Anthropic-compatible streaming uses typed events with an event: field followed by a data: field for each SSE event.
MiMo API Docs