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

# 创建 Lana 消息

> 向 Solana AI 智能体 Lana 提问，并以事件流或单个 JSON 响应的形式获取答案。

使用 `lana-thinking` 时，每个请求消耗 **10,000 积分**；使用 `lana-fast` 时，每个请求消耗 **2,000 积分**。

需要付费套餐。免费套餐的请求会返回 `403 Forbidden`。

有关快速入门、流式事件和错误处理，请参阅 [Lana API 指南](https://www.helius.dev/docs/zh/lana.md)。

## 请求参数

**model** `string` *required*

`lana-thinking` 用于多步骤分析，每轮最多可执行 20 个查询步骤；它可以流式传输推理过程。`lana-fast` 用于快速查询和单一事实，每轮最多可执行 4 个查询步骤。

* `lana-thinking`
* `lana-fast`

**messages** `array` *required*

对话内容，按时间从早到晚排列。至少需要一条消息，并且最后一条消息必须具有 `role` `user`。API 不会存储对话；每次请求时都需要发送完整对话。

**messages\[].role** `string` *required*

消息的发送者。

* `user`
* `assistant`

**messages\[].content** `any` *required*

非空字符串或非空内容块数组。`text` 可用于两种角色；`image` 和 `tool_result` 只能用于 `user` 消息；`tool_use` 只能用于 `assistant` 消息。

**max\_tokens** `number` (default: 8192)

Lana 在一个模型步骤中最多可以生成的输出 token 数量。包含查询的轮次需要执行多个步骤，因此该轮次的 `output_tokens` 总数可能更高。低于 2,048 时，`lana-thinking` 不会进行推理。

**stream** `boolean` (default: false)

`true` 会以流式方式传输服务器发送事件。`false` 会在该轮次结束时返回一个 JSON 对象。

**system** `string`

附加指令，例如“用三个要点回答”。这些指令会添加到 Lana 自身的指令中，而不是取代它们。

**extensions** `object`

Lana 专用选项。所有选项均为可选。`include_*` 选项允许生成输出；Lana 会决定是否发送。

**extensions.read\_only** `boolean` (default: true)

移除转账、兑换和代币发行工具。请将其保留为 `true`。

**extensions.output\_format** `string` (default: markdown)

`plain` 会让 Lana 不使用 Markdown，并移除 `{{cite:N}}` 标记。`source` 事件仍会到达。

* `markdown`
* `plain`

**extensions.include\_ui\_schema** `boolean` (default: false)

允许使用 UI 组件，这些组件会以 `ui_block` 和 `ui_schema` 事件的形式提供。

**extensions.include\_followups** `boolean` (default: false)

允许提供最多 3 个建议的后续问题。

**extensions.include\_documents** `boolean` (default: false)

允许提供可下载的 CSV、JSON 或文本文件，这些文件会以 `document` 事件的形式提供。

**extensions.enable\_deep\_scan** `boolean` (default: false)

允许 Lana 读取某个地址历史记录中最多 10,000 笔交易（统计数量和总额时最多 50,000 笔），每轮最多扫描 3 次。仅支持主网。如果不启用，Lana 每次查询最多读取 100 笔交易。价格仍为相同的固定价格。

**extensions.user\_context** `object`

提问者的信息。

**extensions.user\_context.wallet** `string`

用户的地址，以便使用“我的钱包”和“我的余额”等表达。

**extensions.user\_context.address\_kind** `string`

`wallet` 或 `token`：表示 `wallet` 的类型。需要提供 `wallet`。

**extensions.user\_context.time\_zone** `string`

IANA 时区，例如 `America/New_York`，以便正确理解“今天”。

**extensions.user\_context.network** `string` (default: mainnet)

要查询的网络。

* `mainnet`
* `devnet`

**extensions.attachments** `array`

最多可向最后一条用户消息添加 8 张图片。`messages` 中的 `image` 块不计入此限制。

**extensions.attachments\[].url** `string` *required*

图片 URL。

**extensions.attachments\[].kind** `string` *required*

始终为 `image`。

* `image`

**extensions.progress\_context** `object`

供 Orb 浏览器使用。你不需要设置它。

**extensions.transaction\_filter\_context** `object`

供 Orb 浏览器使用。你不需要设置它。


## OpenAPI

````yaml zh/openapi/lana/openapi.yaml POST /v1/lana/messages
openapi: 3.0.3
info:
  title: Lana API
  description: |
    Lana 是一个可通过 HTTP 调用的 Solana AI 智能体。用普通英语发送问题，Lana 会查询
    钱包、代币、交易和价格，然后给出回答。该 API 的结构类似于 Anthropic
    Messages API，但 Anthropic SDK 无法与其配合使用。

    ## 身份验证

    通过以下任一方式发送你的 Helius API 密钥：
    - 请求头（推荐）：`X-Api-Key: YOUR_API_KEY`
    - 查询参数：`?api-key=YOUR_API_KEY`

    `Authorization: Bearer` 不适用于此端点，并会返回 `401`。
  version: 1.0.0
  contact:
    name: API 支持
    url: https://helius.dev
servers:
  - url: https://beta.helius-rpc.com
    description: Gatekeeper（Beta）
security:
  - ApiKeyHeader: []
  - ApiKeyQuery: []
tags:
  - name: 消息
    description: 向 Lana 提问
paths:
  /v1/lana/messages:
    post:
      tags:
        - 消息
      summary: 创建 Lana 消息
      description: |
        向 Lana 发送对话并返回其回答。使用 `"stream": true` 时，回答将以服务器发送事件
        （`text/event-stream`）的形式到达。使用 `"stream": false`（默认值）时，
        对话轮次结束后会返回一个 JSON 对象。

        使用 `"stream": true` 时，Lana 首次响应时会返回 `200` 和首批事件，最迟不超过
        10 秒，之后每 10 秒会收到一个 `ping` 事件。请将
        HTTP 客户端的读取超时设置为 30 秒或更长；像 `httpx` 那样的 5 秒默认值
        太短。如果请求在响应开始前失败，会收到具有对应状态的常规错误
        响应，因此在将正文作为流读取前，请先检查 HTTP 状态。响应开始后，故障会作为最后一个 `error` 事件到达。

        使用 `lana-thinking` 时，每个请求固定消耗 10,000 积分；使用
        `lana-fast` 时固定消耗 2,000 积分。无论对话轮次如何结束，只要请求获得 HTTP `200`，就会计费。
        在响应开始前失败的请求会获得其他状态且不收费。
        仅限付费套餐。
      operationId: createLanaMessage
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/MessagesRequest'
            examples:
              nonStreaming:
                summary: 非流式
                value:
                  model: lana-thinking
                  messages:
                    - role: user
                      content: SOL 当前的价格是多少？
                  extensions:
                    read_only: true
              streaming:
                summary: 流式
                value:
                  model: lana-thinking
                  stream: true
                  messages:
                    - role: user
                      content: EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v 的最大持有者是谁？
                  extensions:
                    read_only: true
      responses:
        '200':
          description: >
            对话轮次已运行。使用 `"stream": false` 时，返回一个 JSON 对象。检查
            `stop_reason`：即使某个轮次在生成内容后失败，仍会返回 `200`，其中 `stop_reason: "error"`，

            并包含一个 `error` 对象。


            使用 `"stream": true` 时，返回服务器发送事件流。每个事件包含一行

            `event: <type>` 和一行 `data: <json>`，之后是一个空行。流

            以 `message_start` 开始，并始终以 `message_end` 或 `error` 结束。可能会添加新的事件

            类型和字段；请忽略无法识别的内容。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MessageResponse'
            text/event-stream:
              schema:
                $ref: '#/components/schemas/StreamEvent'
              example: >
                event: message_start

                data:
                {"type":"message_start","message":{"id":"msg_3f9c...","model":"lana-thinking"}}


                event: tool_use

                data:
                {"type":"tool_use","tool_use_id":"toolu_01...","name":"...","input":{"mint":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"}}


                event: tool_result

                data:
                {"type":"tool_result","tool_use_id":"toolu_01...","content":"{\"holders\":[..."}


                event: content_block_delta

                data:
                {"type":"content_block_delta","delta":{"type":"text_delta","text":"最大的
                USDC 持有者是"}}


                event: message_end

                data:
                {"type":"message_end","stop_reason":"end_turn","usage":{"input_tokens":91200,"output_tokens":212,"tool_calls":1,"prompt_tokens":46100,"context_window":200000}}
        '400':
          description: |
            正文无效，例如模型未知、字段未知或 `max_tokens`
            超过 8,192。`message` 会列出每个无效字段。不收费。

            超过 10 MB 的正文会被 Gatekeeper 拒绝，并返回纯文本 `Bad Request` 正文。

            如果由于对话无法放入上下文窗口而导致轮次在响应开始前失败，
            也会返回 `400`，且 `error.type` 为 `context_overflow`。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                type: error
                error:
                  type: invalid_request_error
                  message: max_tokens：max_tokens 必须小于或等于 8192
            text/plain:
              schema:
                type: string
              example: Bad Request
        '401':
          description: |
            API 密钥缺失或无效，或者通过 `Authorization: Bearer` 发送。返回纯文本正文。不收费。
          content:
            text/plain:
              schema:
                type: string
        '403':
          description: 你的套餐不包含 Lana（免费套餐），或密钥的访问设置阻止了访问。返回纯文本正文。不收费。
          content:
            text/plain:
              schema:
                type: string
        '429':
          description: >
            不收费。可能是以下情况之一：

            - 纯文本 `Too Many Requests`：你已超出套餐的速率限制。在 `Retry-After` 指定的时间后重试（1 秒）。

            - 纯文本 `max usage reached`：你的项目积分已用尽。没有
            `Retry-After`；在添加积分或升级之前，重试仍会失败。

            - `error.type` 为 `rate_limit_error` 的 JSON：你的项目已有大约 3 个 Lana
            请求正在运行。在 `Retry-After` 指定的时间后重试（5 秒）。
          headers:
            Retry-After:
              $ref: '#/components/headers/RetryAfter'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
            text/plain:
              schema:
                type: string
              example: Too Many Requests
        '500':
          description: 对话轮次在响应开始前因 `api_error` 而失败。不收费。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '502':
          description: 对话轮次在响应开始前因 `tool_error` 而失败。不收费。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '503':
          description: >-
            Lana 已达到容量上限或正在重启。在 `Retry-After` 指定的时间后重试（达到容量上限时为 5 秒，重启期间为 30
            秒）。不收费。
          headers:
            Retry-After:
              $ref: '#/components/headers/RetryAfter'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '504':
          description: 对话轮次在响应开始前因 `timeout_error` 而失败。不收费。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '529':
          description: >-
            对话轮次在响应开始前因 `overloaded_error` 而失败。某些 HTTP 客户端无法识别 `529`；请像处理 `503`
            一样处理它。不收费。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    MessagesRequest:
      type: object
      additionalProperties: false
      required:
        - model
        - messages
      properties:
        model:
          type: string
          enum:
            - lana-thinking
            - lana-fast
          description: >-
            使用 `lana-thinking` 进行多步骤分析，每个轮次最多可执行 20 个查询步骤；它可以流式传输推理过程。使用
            `lana-fast` 进行快速查询和获取单一事实，每个轮次最多可执行 4 个查询步骤。
          example: lana-thinking
        messages:
          type: array
          minItems: 1
          description: >-
            对话按从旧到新的顺序排列。至少需要一条消息，且最后一条消息的 `role` 必须为 `user`。API
            不存储对话；每次请求都要发送完整对话。
          items:
            $ref: '#/components/schemas/Message'
        max_tokens:
          type: integer
          minimum: 1
          maximum: 8192
          default: 8192
          description: >-
            Lana 在一个模型步骤中最多可以写入的输出 token 数。包含查询的轮次需要多个步骤，因此该轮次的 `output_tokens`
            总数可能更高。低于 2,048 时，`lana-thinking` 不会进行推理。
        stream:
          type: boolean
          default: false
          description: '`true` 会流式传输服务器发送事件。`false` 会在对话轮次结束时返回一个 JSON 对象。'
        system:
          type: string
          minLength: 1
          maxLength: 10000
          description: 额外指令，例如“用三个项目符号回答”。这些指令会添加到 Lana 自身的指令中，而不是取代它们。
        extensions:
          $ref: '#/components/schemas/Extensions'
    MessageResponse:
      type: object
      description: 非流式响应。回答由按顺序连接的 `text` 块组成。
      required:
        - id
        - type
        - role
        - model
        - content
        - stop_reason
        - usage
      properties:
        id:
          type: string
          example: msg_3f9c...
        type:
          type: string
          enum:
            - message
        role:
          type: string
          enum:
            - assistant
        model:
          type: string
          enum:
            - lana-thinking
            - lana-fast
        content:
          type: array
          items:
            oneOf:
              - $ref: '#/components/schemas/TextBlock'
              - $ref: '#/components/schemas/ToolUseBlock'
              - $ref: '#/components/schemas/ToolResultBlock'
        stop_reason:
          $ref: '#/components/schemas/StopReason'
        usage:
          $ref: '#/components/schemas/Usage'
        ui_schema:
          type: object
          description: 以单个树形结构表示的所有 UI 组件。当 `include_ui_schema` 已启用且有内容可显示时存在。
        documents:
          type: array
          description: 当 `include_documents` 已启用且 Lana 创建了文件时存在。
          items:
            $ref: '#/components/schemas/Document'
        follow_up:
          type: array
          description: 当 `include_followups` 已启用且 Lana 建议了问题时存在。
          items:
            type: string
        sources:
          type: array
          description: 当 Lana 使用了网页时存在。
          items:
            $ref: '#/components/schemas/Source'
        error:
          $ref: '#/components/schemas/ErrorObject'
      example:
        id: msg_3f9c...
        type: message
        role: assistant
        model: lana-thinking
        content:
          - type: tool_use
            id: toolu_01...
            name: ...
            input:
              mint: So11111111111111111111111111111111111111112
          - type: tool_result
            tool_use_id: toolu_01...
            content: '{"price":...'
          - type: text
            text: SOL 的交易价格为……
        stop_reason: end_turn
        usage:
          input_tokens: 90800
          output_tokens: 96
          tool_calls: 1
          prompt_tokens: 45600
          context_window: 200000
    StreamEvent:
      description: >
        一个服务器发送事件。`data` JSON 的 `type` 与 `event` 名称匹配。顺序：

        1. `message_start`，始终为第一个。

        2.
        `content_block_delta`、`tool_use`、`tool_result`、`source`、`ui_block`、`document`、`progress_update`
        和 `ping` 的任意组合。

        3. `ui_schema`，最多一次。

        4. `follow_up`，最多一次。

        5. 如果对话轮次完成，则为 `message_end`；如果失败，则为 `error`。始终为最后一个。
      oneOf:
        - $ref: '#/components/schemas/MessageStartEvent'
        - $ref: '#/components/schemas/ContentBlockDeltaEvent'
        - $ref: '#/components/schemas/ToolUseEvent'
        - $ref: '#/components/schemas/ToolResultEvent'
        - $ref: '#/components/schemas/SourceEvent'
        - $ref: '#/components/schemas/ProgressUpdateEvent'
        - $ref: '#/components/schemas/UiBlockEvent'
        - $ref: '#/components/schemas/DocumentEvent'
        - $ref: '#/components/schemas/UiSchemaEvent'
        - $ref: '#/components/schemas/FollowUpEvent'
        - $ref: '#/components/schemas/MessageEndEvent'
        - $ref: '#/components/schemas/ErrorEvent'
        - $ref: '#/components/schemas/PingEvent'
    ErrorResponse:
      type: object
      required:
        - type
        - error
      properties:
        type:
          type: string
          enum:
            - error
        error:
          $ref: '#/components/schemas/ErrorObject'
    Message:
      type: object
      additionalProperties: false
      required:
        - role
        - content
      properties:
        role:
          type: string
          enum:
            - user
            - assistant
          description: 消息的作者。
        content:
          description: >-
            非空字符串或非空内容块数组。两个角色都允许使用 `text`，只有 `user` 消息允许使用 `image` 和
            `tool_result`，只有 `assistant` 消息允许使用 `tool_use`。
          oneOf:
            - type: string
              minLength: 1
            - type: array
              minItems: 1
              items:
                $ref: '#/components/schemas/ContentBlock'
    Extensions:
      type: object
      additionalProperties: false
      description: Lana 专用选项。全部为可选项。`include_*` 选项允许生成相应输出；是否发送由 Lana 决定。
      properties:
        read_only:
          type: boolean
          default: true
          description: 移除转账、兑换和代币发行工具。请将其保持为 `true`。
        output_format:
          type: string
          enum:
            - markdown
            - plain
          default: markdown
          description: '`plain` 指示 Lana 不使用 Markdown，并移除 `{{cite:N}}` 标记。仍会收到 `source` 事件。'
        include_ui_schema:
          type: boolean
          default: false
          description: 允许使用 UI 组件，并通过 `ui_block` 和 `ui_schema` 事件发送。
        include_followups:
          type: boolean
          default: false
          description: 最多允许提供 3 个建议的后续问题。
        include_documents:
          type: boolean
          default: false
          description: 允许提供可下载的 CSV、JSON 或文本文件，并通过 `document` 事件发送。
        enable_deep_scan:
          type: boolean
          default: false
          description: >-
            允许 Lana 读取某个地址历史记录中最多 10,000 笔交易（统计数量和总额时最多 50,000 笔），每个轮次最多扫描 3
            次。仅限主网。如果不启用，Lana 每次查询最多读取 100 笔交易。固定价格不变。
        user_context:
          $ref: '#/components/schemas/UserContext'
        attachments:
          type: array
          maxItems: 8
          description: 最多向最后一条用户消息添加 8 张图像。`messages` 中的 `image` 块不计入此限制。
          items:
            $ref: '#/components/schemas/Attachment'
        progress_context:
          type: object
          description: 供 Orb 浏览器使用。你不需要它。
        transaction_filter_context:
          type: object
          description: 供 Orb 浏览器使用。你不需要它。
    TextBlock:
      type: object
      additionalProperties: false
      required:
        - type
        - text
      properties:
        type:
          type: string
          enum:
            - text
        text:
          type: string
          minLength: 1
    ToolUseBlock:
      type: object
      additionalProperties: false
      description: 重放先前轮次中的查询，内容与 Lana 返回时相同。仅限 `assistant` 消息。
      required:
        - type
        - id
        - name
        - input
      properties:
        type:
          type: string
          enum:
            - tool_use
        id:
          type: string
        name:
          type: string
        input:
          type: object
          additionalProperties: true
    ToolResultBlock:
      type: object
      additionalProperties: false
      description: 重放查询的结果。仅限 `user` 消息。
      required:
        - type
        - tool_use_id
        - content
      properties:
        type:
          type: string
          enum:
            - tool_result
        tool_use_id:
          type: string
        content:
          type: string
        is_error:
          type: boolean
    StopReason:
      type: string
      enum:
        - end_turn
        - max_tokens
        - tool_use
        - error
      description: |
        - `end_turn`：Lana 已完成回答。
        - `max_tokens`：回答达到 `max_tokens`，可能被截断。
        - `tool_use`：对话轮次在查询步骤处结束，通常是因为达到步骤限制。
        - `error`：对话轮次失败。回答不完整。
    Usage:
      type: object
      required:
        - input_tokens
        - output_tokens
        - tool_calls
        - prompt_tokens
      properties:
        input_tokens:
          type: integer
          description: 整个对话轮次的输入 token 数。
        output_tokens:
          type: integer
          description: 整个对话轮次的输出 token 数。
        tool_calls:
          type: integer
          description: 对话轮次中运行的查询数，包括一些从未显示为 `tool_use` 的查询。
        prompt_tokens:
          type: integer
          description: 最后一个模型步骤中的输入 token 数。可用于查看上下文的占用程度。
        context_window:
          type: integer
          description: 模型的上下文窗口，当前为 `200000`。
    Document:
      type: object
      required:
        - filename
        - format
        - content
      properties:
        tool_use_id:
          type: string
        filename:
          type: string
        format:
          type: string
          enum:
            - csv
            - json
            - txt
        content:
          type: string
        description:
          type: string
    Source:
      type: object
      required:
        - index
        - url
        - title
      properties:
        index:
          type: integer
          description: 与回答中的 `{{cite:N}}` 标记相匹配。
        url:
          type: string
        title:
          type: string
        snippet:
          type: string
    ErrorObject:
      type: object
      required:
        - type
        - message
      properties:
        type:
          type: string
          description: >
            根据此字段进行分支处理，而不是根据
            `message`。已知值：`invalid_request_error`、`context_overflow`、

            `overloaded_error`、`timeout_error`、`tool_error`、`rate_limit_error`、`api_error`。

            将任何其他值按 `api_error` 处理。
          example: invalid_request_error
        message:
          type: string
    MessageStartEvent:
      type: object
      title: message_start
      description: 对话轮次已开始。
      required:
        - type
        - message
      properties:
        type:
          type: string
          enum:
            - message_start
        message:
          type: object
          required:
            - id
            - model
          properties:
            id:
              type: string
            model:
              type: string
              enum:
                - lana-thinking
                - lana-fast
    ContentBlockDeltaEvent:
      type: object
      title: content_block_delta
      description: >-
        回答的一个片段（`text_delta`），或 Lana 推理过程的一个片段（`thinking_delta`，仅限
        `lana-thinking`，且仅在 Lana 进行推理时）。请将推理过程与回答分开显示，或跳过推理过程。
      required:
        - type
        - delta
      properties:
        type:
          type: string
          enum:
            - content_block_delta
        delta:
          oneOf:
            - type: object
              title: text_delta
              required:
                - type
                - text
              properties:
                type:
                  type: string
                  enum:
                    - text_delta
                text:
                  type: string
            - type: object
              title: thinking_delta
              required:
                - type
                - thinking
              properties:
                type:
                  type: string
                  enum:
                    - thinking_delta
                thinking:
                  type: string
    ToolUseEvent:
      type: object
      title: tool_use
      description: Lana 开始查询。仅将其用于进度指示器；工具名称和输入可能会更改。
      required:
        - type
        - tool_use_id
        - name
        - input
      properties:
        type:
          type: string
          enum:
            - tool_use
        tool_use_id:
          type: string
        name:
          type: string
        input:
          type: object
          additionalProperties: true
    ToolResultEvent:
      type: object
      title: tool_result
      description: 查询已完成。查询失败不会导致对话轮次失败；Lana 会设法绕过该问题。
      required:
        - type
        - tool_use_id
        - content
      properties:
        type:
          type: string
          enum:
            - tool_result
        tool_use_id:
          type: string
        content:
          type: string
          description: 最多 500 个字符的预览。当 `is_error` 为 `true` 时，为包含 `error` 消息和 `code` 的 JSON。
        is_error:
          type: boolean
    SourceEvent:
      type: object
      title: source
      description: Lana 使用的网页。
      required:
        - type
        - index
        - url
        - title
      properties:
        type:
          type: string
          enum:
            - source
        index:
          type: integer
          description: 与回答中的 `{{cite:N}}` 标记相匹配。
        url:
          type: string
        title:
          type: string
        snippet:
          type: string
    ProgressUpdateEvent:
      type: object
      title: progress_update
      description: 长时间对话轮次中的简短状态信息。请将其与回答分开显示。
      required:
        - type
        - id
        - message
        - created_at
      properties:
        type:
          type: string
          enum:
            - progress_update
        id:
          type: string
        message:
          type: string
        created_at:
          type: integer
          description: Unix 毫秒时间戳。
    UiBlockEvent:
      type: object
      title: ui_block
      description: 一个 UI 组件。需要启用 `include_ui_schema`。
      required:
        - type
        - component
        - schema
      properties:
        type:
          type: string
          enum:
            - ui_block
        tool_use_id:
          type: string
        component:
          type: string
        schema:
          type: object
    DocumentEvent:
      type: object
      title: document
      description: 可下载的文件。需要启用 `include_documents`。
      required:
        - type
        - filename
        - format
        - content
      properties:
        type:
          type: string
          enum:
            - document
        tool_use_id:
          type: string
        filename:
          type: string
        format:
          type: string
          enum:
            - csv
            - json
            - txt
        content:
          type: string
        description:
          type: string
    UiSchemaEvent:
      type: object
      title: ui_schema
      description: 以单个树形结构表示的所有 UI 组件。需要启用 `include_ui_schema`。最多出现一次。
      required:
        - type
        - schema
      properties:
        type:
          type: string
          enum:
            - ui_schema
        schema:
          type: object
    FollowUpEvent:
      type: object
      title: follow_up
      description: 建议的后续问题。需要启用 `include_followups`。最多出现一次。
      required:
        - type
        - suggestions
      properties:
        type:
          type: string
          enum:
            - follow_up
        suggestions:
          type: array
          items:
            type: string
    MessageEndEvent:
      type: object
      title: message_end
      description: 对话轮次已结束。当 `stop_reason` 为 `error` 时，请像处理 `api_error` 一样处理；之前的任何回答文本都不完整。
      required:
        - type
        - stop_reason
        - usage
      properties:
        type:
          type: string
          enum:
            - message_end
        stop_reason:
          $ref: '#/components/schemas/StopReason'
        usage:
          $ref: '#/components/schemas/Usage'
    ErrorEvent:
      type: object
      title: error
      description: 流开始后，对话轮次失败。之前的任何回答文本都不完整。
      required:
        - type
        - error
      properties:
        type:
          type: string
          enum:
            - error
        error:
          $ref: '#/components/schemas/ErrorObject'
    PingEvent:
      type: object
      title: ping
      description: 每 10 秒发送一次的心跳事件。忽略即可。
      required:
        - type
      properties:
        type:
          type: string
          enum:
            - ping
    ContentBlock:
      oneOf:
        - $ref: '#/components/schemas/TextBlock'
        - $ref: '#/components/schemas/ImageBlock'
        - $ref: '#/components/schemas/ToolUseBlock'
        - $ref: '#/components/schemas/ToolResultBlock'
    UserContext:
      type: object
      additionalProperties: false
      description: 提问者的信息。
      properties:
        wallet:
          type: string
          minLength: 1
          maxLength: 128
          description: 用户的地址，以便支持“我的钱包”和“我的余额”等表述。
        address_kind:
          type: string
          minLength: 1
          maxLength: 32
          description: '`wallet` 或 `token`：用于说明 `wallet` 的类型。需要提供 `wallet`。'
        time_zone:
          type: string
          minLength: 1
          maxLength: 64
          description: IANA 时区，例如 `America/New_York`，以便正确理解“今天”。
        network:
          type: string
          enum:
            - mainnet
            - devnet
          default: mainnet
          description: 要查询的网络。
    Attachment:
      type: object
      additionalProperties: false
      required:
        - url
        - kind
      properties:
        url:
          type: string
          format: uri
          description: 图像 URL。
        kind:
          type: string
          enum:
            - image
          description: 始终为 `image`。
    ImageBlock:
      type: object
      additionalProperties: false
      description: 通过 URL 指定的图像。仅限 `user` 消息。不支持 Base64 图像。
      required:
        - type
        - source
      properties:
        type:
          type: string
          enum:
            - image
        source:
          type: object
          additionalProperties: false
          required:
            - type
            - url
          properties:
            type:
              type: string
              enum:
                - url
            url:
              type: string
              format: uri
  headers:
    RetryAfter:
      description: 重试前需要等待的秒数。
      schema:
        type: integer
  securitySchemes:
    ApiKeyHeader:
      type: apiKey
      in: header
      name: X-Api-Key
      description: 你的 Helius API 密钥。
    ApiKeyQuery:
      type: apiKey
      in: query
      name: api-key
      description: 你的 Helius API 密钥。

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.