跳转到主要内容
POST
/
v1
/
messages
创建 Messages 响应
curl --request POST \
  --url https://api.apiany.ai/v1/messages \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "model": "minimax-m3",
  "max_tokens": 512,
  "messages": [
    {
      "role": "user",
      "content": "Draft three API documentation section titles."
    }
  ]
}
'
{
  "id": "<string>",
  "type": "message",
  "role": "assistant",
  "content": [
    {}
  ],
  "model": "<string>",
  "usage": {
    "prompt_tokens": 123,
    "completion_tokens": 123,
    "total_tokens": 123,
    "input_tokens": 123,
    "output_tokens": 123,
    "cached_input_tokens": 123
  }
}

授权

Authorization
string
header
必填

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

请求体

application/json
model
string
必填
示例:

"minimax-m3"

messages
object[]
必填
max_tokens
integer
必填

最大生成 token 数(必填)。

必填范围: x >= 1
system

系统提示词。

temperature
number

随机性(0–1)。

必填范围: 0 <= x <= 1
top_p
number
必填范围: 0 <= x <= 1
top_k
integer

仅从概率最高的 K 个候选采样。

stop_sequences
string[]

自定义停止序列。

tools
object[]

模型可调用的工具;每个含 name、description、input_schema(JSON Schema)。

tool_choice
object

工具选择:{ type: 'auto' } | { type: 'any' } | { type: 'tool', name }。

stream
boolean

为 true 时按 Anthropic SSE 事件流返回(message_start / content_block_delta / message_delta / message_stop)。

响应

Anthropic 兼容的 Messages 响应。

id
string
必填
type
string
必填
示例:

"message"

role
string
必填
示例:

"assistant"

content
object[]
必填
model
string
必填
usage
object