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

# Qwen3.8-Max-Preview - Anthropic 兼容接口

> > 🚧 **该模型暂未开放，敬请期待**

- 使用 Anthropic Messages 协议调用 Qwen3.8-Max-Preview
- **系统提示词**：通过顶层 `system` 字段设定（不放在 messages 内）
- **多模态输入**：`content` 传内容块数组，支持 `text` / `image`
- **上下文缓存**：在内容块上加 `cache_control` 声明显式缓存；命中 / 创建见响应 `usage.cache_read_input_tokens` / `usage.cache_creation_input_tokens`
- **思考模式**：通过 `thinking` 开启，思考以 `thinking` 内容块流式返回
- **流式输出**：`stream=true` 时按 Anthropic SSE 事件（`message_start` / `content_block_delta` / `message_delta` 等）返回

<Note>
  **BaseURL 说明**：默认 BaseURL 为 `https://direct.evolink.ai`，对文本模型支持更好，支持长连接；`https://api.evolink.ai` 是多模态主力地址，含图像输入时请使用该地址。
</Note>


## OpenAPI

````yaml cn/api-manual/language-series/qwen3.8-max-preview/qwen3.8-max-preview-messages.json POST /v1/messages
openapi: 3.1.0
info:
  title: Qwen3.8-Max-Preview - Anthropic 兼容接口
  description: |-
    通义千问 Qwen3.8-Max-Preview 的 Anthropic Messages 兼容接口（`/v1/messages`）。

    **适用场景**：Claude Code、Claude Desktop 等使用 Anthropic Messages 协议的客户端。

    **能力**：
    - 上下文长度 **1,000,000 tokens**（1M）
    - 多模态输入：`content` 支持文本 + 图像块
    - 上下文缓存：`cache_control` 显式缓存标记，命中 / 创建见响应 `usage`
    - 思考模式：`thinking` 字段控制
    - 流式输出：SSE 增量返回
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://direct.evolink.ai
    description: 生产环境（推荐，文本模型长连接支持更好）
  - url: https://api.evolink.ai
    description: 多模态主力地址（含图像输入时使用）
security:
  - bearerAuth: []
tags: []
paths:
  /v1/messages:
    post:
      summary: Qwen3.8-Max-Preview 对话接口（Anthropic Messages 兼容）
      description: >-
        > 🚧 **该模型暂未开放，敬请期待**


        - 使用 Anthropic Messages 协议调用 Qwen3.8-Max-Preview

        - **系统提示词**：通过顶层 `system` 字段设定（不放在 messages 内）

        - **多模态输入**：`content` 传内容块数组，支持 `text` / `image`

        - **上下文缓存**：在内容块上加 `cache_control` 声明显式缓存；命中 / 创建见响应
        `usage.cache_read_input_tokens` / `usage.cache_creation_input_tokens`

        - **思考模式**：通过 `thinking` 开启，思考以 `thinking` 内容块流式返回

        - **流式输出**：`stream=true` 时按 Anthropic SSE 事件（`message_start` /
        `content_block_delta` / `message_delta` 等）返回
      operationId: createMessageQwen38MaxPreview
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateMessageRequest'
            examples:
              basic:
                summary: 基础对话
                value:
                  model: qwen3.8-max-preview
                  max_tokens: 1024
                  system: You are a helpful assistant.
                  messages:
                    - role: user
                      content: 你好，介绍一下你自己
              explicit_cache:
                summary: 显式缓存（system + cache_control）
                value:
                  model: qwen3.8-max-preview
                  max_tokens: 1024
                  system:
                    - type: text
                      text: <超过 1024 token 的稳定系统提示词……>
                      cache_control:
                        type: ephemeral
                  messages:
                    - role: user
                      content: 基于以上背景回答问题
              multimodal:
                summary: 多模态输入（图像块）
                value:
                  model: qwen3.8-max-preview
                  max_tokens: 1024
                  messages:
                    - role: user
                      content:
                        - type: text
                          text: 描述这张图片
                        - type: image
                          source:
                            type: url
                            url: https://example.com/image.jpg
      responses:
        '200':
          description: 生成成功
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MessageResponse'
        '400':
          description: 请求参数错误
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                type: error
                error:
                  type: invalid_request_error
                  message: max_tokens is required
        '401':
          description: 未认证、Token 无效或过期
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                type: error
                error:
                  type: authentication_error
                  message: Invalid or expired token
        '402':
          description: 余额不足
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                type: error
                error:
                  type: insufficient_quota
                  message: Insufficient credits
        '429':
          description: 请求过于频繁（限流）
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: 服务器内部错误
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    CreateMessageRequest:
      type: object
      required:
        - model
        - max_tokens
        - messages
      properties:
        model:
          type: string
          enum:
            - qwen3.8-max-preview
          example: qwen3.8-max-preview
          description: 对话模型名称
        max_tokens:
          type: integer
          description: |-
            生成内容的最大 token 数。

            > **必填**（Anthropic 协议要求）。若模型生成超过该值将被截断。
          example: 1024
        messages:
          type: array
          description: >-
            对话消息列表（不含 system）。每条消息含 `role`（`user` / `assistant`）与
            `content`（字符串或内容块数组）。
          items:
            $ref: '#/components/schemas/InputMessage'
        system:
          description: 系统提示词。纯文本时传字符串；需声明显式缓存时传内容块数组（在块上加 `cache_control`）。
          oneOf:
            - type: string
            - type: array
              items:
                $ref: '#/components/schemas/ContentBlock'
        temperature:
          type: number
          description: 采样温度，取值范围 `[0, 2]`。
          minimum: 0
          maximum: 2
        top_p:
          type: number
          description: 核采样参数，取值范围 `(0, 1]`。
          minimum: 0
          maximum: 1
        top_k:
          type: integer
          description: 从概率最高的 K 个 token 中采样。
        stop_sequences:
          type: array
          items:
            type: string
          description: 自定义停止序列，命中后停止生成。
        stream:
          type: boolean
          description: 是否以 Anthropic SSE 事件流式返回。
          default: false
        thinking:
          type: object
          description: 深度思考配置。开启后模型以 `thinking` 内容块返回思考过程。
          properties:
            type:
              type: string
              enum:
                - enabled
                - disabled
              description: 是否开启深度思考
        tools:
          type: array
          description: 工具定义列表（Anthropic tools 格式），用于 Function Calling。
          items:
            $ref: '#/components/schemas/Tool'
    MessageResponse:
      type: object
      properties:
        id:
          type: string
          example: msg_xxxxxxxx
        type:
          type: string
          example: message
        role:
          type: string
          example: assistant
        model:
          type: string
          example: qwen3.8-max-preview
        content:
          type: array
          description: 回复内容块数组
          items:
            $ref: '#/components/schemas/OutputContentBlock'
        stop_reason:
          type: string
          description: >-
            停止原因：`end_turn`（正常结束）、`max_tokens`（达到上限）、`stop_sequence`（命中停止序列）、`tool_use`（需要调用工具）
          example: end_turn
        usage:
          $ref: '#/components/schemas/AnthropicUsage'
    ErrorResponse:
      type: object
      properties:
        type:
          type: string
          example: error
        error:
          type: object
          properties:
            type:
              type: string
              description: 错误类型
            message:
              type: string
              description: 错误描述信息
    InputMessage:
      type: object
      required:
        - role
        - content
      properties:
        role:
          type: string
          enum:
            - user
            - assistant
          description: 消息角色
        content:
          description: 消息内容。纯文本时传字符串；多模态或需显式缓存时传内容块数组。
          oneOf:
            - type: string
            - type: array
              items:
                $ref: '#/components/schemas/ContentBlock'
    ContentBlock:
      type: object
      description: 内容块，通过 `type` 声明类型。可在任意块上附加 `cache_control` 声明显式缓存。
      required:
        - type
      properties:
        type:
          type: string
          enum:
            - text
            - image
            - thinking
            - tool_use
            - tool_result
          description: |-
            内容块类型

            - `text`：文本块
            - `image`：图像块
            - `thinking`：思考块（响应中出现）
            - `tool_use` / `tool_result`：工具调用与结果
        text:
          type: string
          description: 当 `type=text` 时的文本内容
        source:
          type: object
          description: 图像来源（当 `type=image` 时）。支持 JPEG / PNG / GIF / WEBP。
          properties:
            type:
              type: string
              enum:
                - url
                - base64
              description: 来源类型：`url`（图片链接）或 `base64`（内联数据）
            url:
              type: string
              description: 当 `type=url` 时的图片链接
            media_type:
              type: string
              description: 当 `type=base64` 时的 MIME 类型，如 `image/jpeg`
              example: image/jpeg
            data:
              type: string
              description: 当 `type=base64` 时的 base64 图像数据
        cache_control:
          $ref: '#/components/schemas/CacheControl'
    Tool:
      type: object
      description: Anthropic 工具定义。
      required:
        - name
      properties:
        name:
          type: string
          description: 工具名称
        description:
          type: string
          description: 工具用途描述
        input_schema:
          type: object
          description: 工具输入参数的 JSON Schema
    OutputContentBlock:
      type: object
      properties:
        type:
          type: string
          description: 内容块类型：`text` / `thinking` / `tool_use`
          example: text
        text:
          type: string
          description: 当 `type=text` 时的文本内容
          example: 你好！我是通义千问 Qwen3.8-Max-Preview。
    AnthropicUsage:
      type: object
      description: Token 使用统计（Anthropic 语义：`input_tokens` 不含缓存，与 cache 字段互斥相加）。
      properties:
        input_tokens:
          type: integer
          description: 输入 token 数（不含缓存部分）
          example: 12
        output_tokens:
          type: integer
          description: 输出 token 数（含思考）
          example: 104
        cache_creation_input_tokens:
          type: integer
          description: 本次新创建缓存的 token 数（缓存写）
          example: 0
        cache_read_input_tokens:
          type: integer
          description: 命中缓存的 token 数（缓存读）
          example: 0
    CacheControl:
      type: object
      description: >-
        显式缓存标记（提示词缓存）。系统以该标记位置为终点向前回溯创建 / 命中缓存块。


        - 最小可缓存长度 **1024 token**，有效期 **5 分钟**（命中后重置）

        - 单次请求最多 **4 个**缓存标记

        - 命中见响应 `usage.cache_read_input_tokens`，创建见
        `usage.cache_creation_input_tokens`
      required:
        - type
      properties:
        type:
          type: string
          enum:
            - ephemeral
          description: 缓存类型，固定为 `ephemeral`（5 分钟临时缓存）
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: |-
        ##所有接口均需要使用 Bearer Token 进行认证##

        **获取 API Key**：

        访问 [API Key 管理页面](https://evolink.ai/dashboard/keys) 获取您的 API Key

        **使用时在请求头中添加**：
        ```
        Authorization: Bearer YOUR_API_KEY
        ```

````