---
title: Claude Messages
description: 使用 Anthropic 兼容消息格式接入支持 Messages 的分组。
api: "POST /v1/messages"
---

<RequestExample>
```bash cURL
curl https://sub.vcnovb.cn/v1/messages \
  -H "Authorization: Bearer $VC_API_KEY" \
  -H "anthropic-version: 2023-06-01" \
  -H "Content-Type: application/json" \
  -d '{"model":"claude-opus-4-6","max_tokens":512,"messages":[{"role":"user","content":"简要解释什么是递归。"}],"stream":false}'
```
</RequestExample>

## 请求参数

<ParamField body="model" type="string" required>支持 Messages 协议的模型 ID。示例使用 `claude-opus-4-6`。</ParamField>
<ParamField body="max_tokens" type="integer" required>本次允许的最大输出 Token 数，需符合模型限制。</ParamField>
<ParamField body="messages" type="array" required>用户与助手消息，使用 Anthropic 兼容 content 格式。</ParamField>
<ParamField body="system" type="string | array">系统提示词放在顶层 system 字段。</ParamField>
<ParamField body="stream" type="boolean">开启后按 Messages 事件格式读取响应。</ParamField>

## 返回内容

非流式结果的 `content` 是内容块数组。文本块的 `type` 为 `text`，文本内容位于 `text` 字段；工具调用块按对应类型处理。

思考模式、工具调用、缓存和多模态输入的支持范围见对应模型说明。

## Claude Code

在 Key 的使用说明中选择对应客户端。常规基础地址为 `https://sub.vcnovb.cn`，由客户端补齐 `/v1/messages`。不要把完整接口路径填成基础地址。
