> ## Documentation Index
> Fetch the complete documentation index at: https://www.qhaigc.net/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Claude 风格

> Claude Messages API 风格（原生字段结构）

## Base URL

* `https://api.qhaigc.net`
* `https://api-hk.qhaigc.net`

## Endpoint

`POST /v1/messages`

## 鉴权与请求头

| Header                                 | 是否必填 | 说明                  |
| :------------------------------------- | :--- | :------------------ |
| `Authorization: Bearer <YOUR_API_KEY>` | 是    | 启航 API Key          |
| `anthropic-version: 2023-06-01`        | 是    | Claude Messages 版本头 |
| `Content-Type: application/json`       | 是    | JSON 请求体            |

## 请求体格式（Claude 原生）

| 字段            | 类型      | 必填 | 说明                     |
| :------------ | :------ | :- | :--------------------- |
| `model`       | string  | 是  | 例如 `claude-sonnet-4-5` |
| `max_tokens`  | integer | 是  | 最大输出 token 数           |
| `messages`    | array   | 是  | 对话消息数组                 |
| `system`      | string  | 否  | 系统提示词                  |
| `temperature` | number  | 否  | 采样温度                   |
| `stream`      | boolean | 否  | 是否流式                   |

## 请求示例

```bash theme={null}
curl --location --request POST 'https://api.qhaigc.net/v1/messages' \
--header 'Authorization: Bearer <YOUR_API_KEY>' \
--header 'anthropic-version: 2023-06-01' \
--header 'Content-Type: application/json' \
--data-raw '{
  "model": "claude-sonnet-4-5",
  "max_tokens": 1024,
  "system": "你是一个简洁的技术助手。",
  "messages": [
    {
      "role": "user",
      "content": "用 3 点总结量子计算的核心价值"
    }
  ],
  "temperature": 0.3,
  "stream": false
}'
```

## 响应结构示例

```json theme={null}
{
  "id": "msg_01ABCDEF",
  "type": "message",
  "role": "assistant",
  "model": "claude-sonnet-4-5",
  "content": [
    {
      "type": "text",
      "text": "1) ... 2) ... 3) ..."
    }
  ],
  "stop_reason": "end_turn",
  "usage": {
    "input_tokens": 33,
    "output_tokens": 86
  }
}
```

## 官方格式参考

* [Anthropic Messages API](https://docs.anthropic.com/en/api/messages)
* [Using the Messages API](https://docs.anthropic.com/en/api/messages-examples)

## 相关页面

* [OpenAI 风格](/docs/api-reference/chat/openai-style)
* [Gemini 风格](/docs/api-reference/chat/gemini-style)


## OpenAPI

````yaml POST /v1/messages
openapi: 3.1.0
info:
  title: 启航 AI API
  version: 1.0.0
  description: 启航 AI API 文档，支持绘图、语音生成、视频生成、音乐生成等多种 AIGC 接口。
servers:
  - url: https://api.qhaigc.net
    description: 生产服务器
security:
  - bearerAuth: []
paths:
  /v1/messages:
    post:
      tags:
        - 聊天模型
      summary: Claude 风格消息
      description: 使用 Claude Messages 风格进行对话
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                model:
                  type: string
                  description: 模型名称，如 claude-sonnet-4-5
                max_tokens:
                  type: integer
                  description: 最大输出 token 数
                system:
                  type: string
                  description: 系统提示词
                messages:
                  type: array
                  items:
                    type: object
                    properties:
                      role:
                        type: string
                        enum:
                          - user
                          - assistant
                      content:
                        type: string
                    required:
                      - role
                      - content
                temperature:
                  type: number
                stream:
                  type: boolean
              required:
                - model
                - max_tokens
                - messages
      responses:
        '200':
          description: 成功响应
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                  type:
                    type: string
                  role:
                    type: string
                  model:
                    type: string
                  content:
                    type: array
                    items:
                      type: object
                      properties:
                        type:
                          type: string
                        text:
                          type: string
                  stop_reason:
                    type: string
                  usage:
                    type: object
                    properties:
                      input_tokens:
                        type: integer
                      output_tokens:
                        type: integer
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````