OpenModelOpenModel
API Reference

Messages Protocol

Access Anthropic, DeepSeek, DashScope, Xiaomi, Kimi, MiniMax, and Zai models through the Anthropic Messages API format.

The Messages protocol exposes the Anthropic Messages API format at POST /v1/messages. It is the most broadly supported protocol on OpenModel, serving seven providers: Anthropic, DeepSeek, DashScope, Xiaomi, Kimi, MiniMax, and Zai.

Because every provider shares the same endpoint and request shape, you use the Anthropic SDK for all of them — switching providers means changing only the model parameter, with no other code changes. See the Anthropic SDK guide for installation and full examples.

Endpoint

POST https://api.openmodel.ai/v1/messages

A second endpoint, POST /v1/messages/count_tokens, counts tokens without creating a message (Anthropic only).

Authentication

All providers authenticate with a single OpenModel API key. Pass it either as a bearer token or via the X-Api-Key header:

Authorization: Bearer om-your-api-key

The anthropic-version header is accepted for SDK compatibility and defaults to 2023-06-01.

Switching providers

To target a different provider, change only the model parameter:

# DeepSeek
client.messages.create(model="deepseek-v4-flash", max_tokens=1024, messages=[...])
# DashScope
client.messages.create(model="qwen3-max", max_tokens=1024, messages=[...])
# Xiaomi
client.messages.create(model="mimo-v2.5-pro", max_tokens=1024, messages=[...])
# Kimi
client.messages.create(model="kimi-k2.5", max_tokens=1024, messages=[...])
# MiniMax
client.messages.create(model="MiniMax-M2.5", max_tokens=1024, messages=[...])
# Zai
client.messages.create(model="glm-5", max_tokens=1024, messages=[...])

Provider differences & playground

Select a provider below to see its example models, error-response format, and an interactive playground pre-filled with that provider's model. Most providers behave identically to the Anthropic baseline; only the documented differences vary.

Example models
claude-opus-4-6claude-opus-4-7claude-opus-4-8claude-sonnet-4-6claude-haiku-4-5-20251001
Error response format
Standard Anthropic format — errors carry a string error.type (e.g. authentication_error, rate_limit_error). This is the baseline all Messages providers are compared against.
Official documentation
Anthropic Messages API

These are example models; the available list may change. View all available models in the Console

POST
/v1/messages

Authorization

AuthorizationBearer <token>

Include your API key: Authorization: Bearer om-your-api-key

In: header

Header Parameters

anthropic-version*string

Required. Specifies the Anthropic API version.

Default"2023-06-01"

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/v1/messages" \  -H "anthropic-version: 2023-06-01" \  -H "Content-Type: application/json" \  -d '{    "model": "claude-sonnet-4-6",    "max_tokens": 1024,    "messages": [      {        "role": "user",        "content": "Explain the concept of recursion in programming."      }    ]  }'
{
  "id": "msg_01XFDUDYJgAACzvnptvVoYEL",
  "type": "message",
  "role": "assistant",
  "content": [
    {
      "type": "text",
      "text": "Recursion is a programming technique where a function calls itself to solve a problem by breaking it down into smaller, identical subproblems."
    }
  ],
  "model": "claude-sonnet-4-6",
  "stop_reason": "end_turn",
  "usage": {
    "input_tokens": 15,
    "output_tokens": 168
  }
}
{
  "type": "string",
  "error": {
    "type": "string",
    "message": "string"
  }
}
{
  "type": "string",
  "error": {
    "type": "string",
    "message": "string"
  }
}
{
  "type": "string",
  "error": {
    "type": "string",
    "message": "string"
  }
}
POST
/v1/messages/count_tokens

Authorization

AuthorizationBearer <token>

Include your API key: Authorization: Bearer om-your-api-key

In: header

Header Parameters

anthropic-version*string

Required. Specifies the Anthropic API version.

Default"2023-06-01"

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

curl -X POST "https://example.com/v1/messages/count_tokens" \  -H "anthropic-version: 2023-06-01" \  -H "Content-Type: application/json" \  -d '{    "model": "claude-sonnet-4-6",    "messages": [      {        "role": "user",        "content": "What is the meaning of life?"      }    ]  }'
{
  "input_tokens": 15
}
{
  "type": "string",
  "error": {
    "type": "string",
    "message": "string"
  }
}
{
  "type": "string",
  "error": {
    "type": "string",
    "message": "string"
  }
}
Example models
deepseek-v4-flashdeepseek-v4-pro
Error response format
Standard Anthropic error.type format.

These are example models; the available list may change. View all available models in the Console

Compatibility notes

DeepSeek's Anthropic-format endpoint does not implement every Anthropic feature. Behavior differs from Anthropic as follows.

FieldStatus
max_tokens, system, stream, stop_sequences, top_p, toolsFully supported
temperatureSupported, range 0.0 – 2.0
tool_choiceSupported (none / auto / any / tool); disable_parallel_tool_use ignored
thinkingSupported (budget_tokens ignored)
top_kIgnored
metadataIgnored
cache_control (on tools and message blocks)Ignored
anthropic-beta, anthropic-version headersIgnored
tool_result.is_errorIgnored

Unsupported content block types: image, document, search_result, redacted_thinking, server_tool_use, web_search_tool_result, code_execution_tool_result, mcp_tool_use, mcp_tool_result, container_upload.

Model fallback: passing an unsupported model name is silently mapped to deepseek-v4-flash by the DeepSeek backend.

POST
/v1/messages

Authorization

AuthorizationBearer <token>

Include your API key: Authorization: Bearer om-your-api-key

In: header

Header Parameters

anthropic-version*string

Required. Specifies the Anthropic API version.

Default"2023-06-01"

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/v1/messages" \  -H "anthropic-version: 2023-06-01" \  -H "Content-Type: application/json" \  -d '{    "model": "deepseek-v4-flash",    "max_tokens": 1024,    "messages": [      {        "role": "user",        "content": "Explain the concept of recursion in programming."      }    ]  }'
{
  "id": "msg_01XFDUDYJgAACzvnptvVoYEL",
  "type": "message",
  "role": "assistant",
  "content": [
    {
      "type": "text",
      "text": "Recursion is a programming technique where a function calls itself to solve a problem by breaking it down into smaller, identical subproblems."
    }
  ],
  "model": "deepseek-v4-flash",
  "stop_reason": "end_turn",
  "usage": {
    "input_tokens": 15,
    "output_tokens": 168
  }
}
{
  "type": "string",
  "error": {
    "type": "string",
    "message": "string"
  }
}
{
  "type": "string",
  "error": {
    "type": "string",
    "message": "string"
  }
}
{
  "type": "string",
  "error": {
    "type": "string",
    "message": "string"
  }
}
Example models
qwen3.7-maxqwen3.6-plusqwen3.6-max-previewqwen3.6-flashqwen3-max
Error response format
The Messages endpoint returns DashScope's native error format — a root-level code/type with no error wrapper. The Responses endpoint uses the standard error.code + error.type shape.
Official documentation
DashScope Anthropic API

These are example models; the available list may change. View all available models in the Console

POST
/v1/messages

Authorization

AuthorizationBearer <token>

Include your API key: Authorization: Bearer om-your-api-key

In: header

Header Parameters

anthropic-version*string

Required. Specifies the Anthropic API version.

Default"2023-06-01"

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/v1/messages" \  -H "anthropic-version: 2023-06-01" \  -H "Content-Type: application/json" \  -d '{    "model": "qwen3-max",    "max_tokens": 1024,    "messages": [      {        "role": "user",        "content": "Explain the concept of recursion in programming."      }    ]  }'
{
  "id": "msg_01XFDUDYJgAACzvnptvVoYEL",
  "type": "message",
  "role": "assistant",
  "content": [
    {
      "type": "text",
      "text": "Recursion is a programming technique where a function calls itself to solve a problem by breaking it down into smaller, identical subproblems."
    }
  ],
  "model": "qwen3-max",
  "stop_reason": "end_turn",
  "usage": {
    "input_tokens": 15,
    "output_tokens": 168
  }
}
{
  "type": "string",
  "error": {
    "type": "string",
    "message": "string"
  }
}
{
  "type": "string",
  "error": {
    "type": "string",
    "message": "string"
  }
}
{
  "type": "string",
  "error": {
    "type": "string",
    "message": "string"
  }
}
Example models
mimo-v2-flashmimo-v2-omnimimo-v2-promimo-v2.5mimo-v2.5-pro
Error response format
Anthropic-compatible error.type format. The gateway additionally retries on 529 (API overloaded) responses.
Official documentation
Xiaomi MiMo Anthropic API

These are example models; the available list may change. View all available models in the Console

POST
/v1/messages

Authorization

AuthorizationBearer <token>

Include your API key: Authorization: Bearer om-your-api-key

In: header

Header Parameters

anthropic-version*string

Required. Specifies the Anthropic API version.

Default"2023-06-01"

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/v1/messages" \  -H "anthropic-version: 2023-06-01" \  -H "Content-Type: application/json" \  -d '{    "model": "mimo-v2.5-pro",    "max_tokens": 1024,    "messages": [      {        "role": "user",        "content": "Explain the concept of recursion in programming."      }    ]  }'
{
  "id": "msg_01XFDUDYJgAACzvnptvVoYEL",
  "type": "message",
  "role": "assistant",
  "content": [
    {
      "type": "text",
      "text": "Recursion is a programming technique where a function calls itself to solve a problem by breaking it down into smaller, identical subproblems."
    }
  ],
  "model": "mimo-v2.5-pro",
  "stop_reason": "end_turn",
  "usage": {
    "input_tokens": 15,
    "output_tokens": 168
  }
}
{
  "type": "string",
  "error": {
    "type": "string",
    "message": "string"
  }
}
{
  "type": "string",
  "error": {
    "type": "string",
    "message": "string"
  }
}
{
  "type": "string",
  "error": {
    "type": "string",
    "message": "string"
  }
}
Example models
kimi-k2.5kimi-k2.6
Error response format
Standard Anthropic error.type format.
Official documentation
Kimi Platform

These are example models; the available list may change. View all available models in the Console

POST
/v1/messages

Authorization

AuthorizationBearer <token>

Include your API key: Authorization: Bearer om-your-api-key

In: header

Header Parameters

anthropic-version*string

Required. Specifies the Anthropic API version.

Default"2023-06-01"

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/v1/messages" \  -H "anthropic-version: 2023-06-01" \  -H "Content-Type: application/json" \  -d '{    "model": "claude-sonnet-4-6",    "max_tokens": 1024,    "messages": [      {        "role": "user",        "content": "Explain the concept of recursion in programming."      }    ]  }'
{
  "id": "msg_01XFDUDYJgAACzvnptvVoYEL",
  "type": "message",
  "role": "assistant",
  "content": [
    {
      "type": "text",
      "text": "Recursion is a programming technique where a function calls itself to solve a problem by breaking it down into smaller, identical subproblems."
    }
  ],
  "model": "claude-sonnet-4-6",
  "stop_reason": "end_turn",
  "usage": {
    "input_tokens": 15,
    "output_tokens": 168
  }
}
{
  "type": "string",
  "error": {
    "type": "string",
    "message": "string"
  }
}
{
  "type": "string",
  "error": {
    "type": "string",
    "message": "string"
  }
}
{
  "type": "string",
  "error": {
    "type": "string",
    "message": "string"
  }
}
Example models
MiniMax-M3MiniMax-M2.7MiniMax-M2.5
Error response format
Standard Anthropic error.type format.
Official documentation
MiniMax Platform

These are example models; the available list may change. View all available models in the Console

POST
/v1/messages

Authorization

AuthorizationBearer <token>

Include your API key: Authorization: Bearer om-your-api-key

In: header

Header Parameters

anthropic-version*string

Required. Specifies the Anthropic API version.

Default"2023-06-01"

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/v1/messages" \  -H "anthropic-version: 2023-06-01" \  -H "Content-Type: application/json" \  -d '{    "model": "claude-sonnet-4-6",    "max_tokens": 1024,    "messages": [      {        "role": "user",        "content": "Explain the concept of recursion in programming."      }    ]  }'
{
  "id": "msg_01XFDUDYJgAACzvnptvVoYEL",
  "type": "message",
  "role": "assistant",
  "content": [
    {
      "type": "text",
      "text": "Recursion is a programming technique where a function calls itself to solve a problem by breaking it down into smaller, identical subproblems."
    }
  ],
  "model": "claude-sonnet-4-6",
  "stop_reason": "end_turn",
  "usage": {
    "input_tokens": 15,
    "output_tokens": 168
  }
}
{
  "type": "string",
  "error": {
    "type": "string",
    "message": "string"
  }
}
{
  "type": "string",
  "error": {
    "type": "string",
    "message": "string"
  }
}
{
  "type": "string",
  "error": {
    "type": "string",
    "message": "string"
  }
}
Example models
glm-5.1glm-5glm-4.7
Error response format
Standard Anthropic error.type format.
Official documentation
Zai Platform

These are example models; the available list may change. View all available models in the Console

POST
/v1/messages

Authorization

AuthorizationBearer <token>

Include your API key: Authorization: Bearer om-your-api-key

In: header

Header Parameters

anthropic-version*string

Required. Specifies the Anthropic API version.

Default"2023-06-01"

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/v1/messages" \  -H "anthropic-version: 2023-06-01" \  -H "Content-Type: application/json" \  -d '{    "model": "claude-sonnet-4-6",    "max_tokens": 1024,    "messages": [      {        "role": "user",        "content": "Explain the concept of recursion in programming."      }    ]  }'
{
  "id": "msg_01XFDUDYJgAACzvnptvVoYEL",
  "type": "message",
  "role": "assistant",
  "content": [
    {
      "type": "text",
      "text": "Recursion is a programming technique where a function calls itself to solve a problem by breaking it down into smaller, identical subproblems."
    }
  ],
  "model": "claude-sonnet-4-6",
  "stop_reason": "end_turn",
  "usage": {
    "input_tokens": 15,
    "output_tokens": 168
  }
}
{
  "type": "string",
  "error": {
    "type": "string",
    "message": "string"
  }
}
{
  "type": "string",
  "error": {
    "type": "string",
    "message": "string"
  }
}
{
  "type": "string",
  "error": {
    "type": "string",
    "message": "string"
  }
}

On this page