> ## 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.

# Tạo tin nhắn Lana

> Đặt câu hỏi cho Lana, một tác nhân AI Solana, và nhận câu trả lời dưới dạng luồng sự kiện hoặc một phản hồi JSON.

Mỗi yêu cầu tốn **10.000 credit** với `lana-thinking` hoặc **2.000 credit** với `lana-fast`.

Yêu cầu gói trả phí. Các yêu cầu từ gói miễn phí trả về `403 Forbidden`.

Để xem hướng dẫn bắt đầu nhanh, sự kiện truyền phát và cách xử lý lỗi, hãy tham khảo [hướng dẫn Lana API](https://www.helius.dev/docs/vi/lana.md).

## Tham số yêu cầu

**model** `string` *required*

`lana-thinking` dành cho phân tích nhiều bước, với tối đa 20 bước tra cứu mỗi lượt; mô hình này có thể truyền phát quá trình suy luận. `lana-fast` dành cho các lượt tra cứu nhanh và thông tin đơn lẻ, với tối đa 4 bước tra cứu mỗi lượt.

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

**messages** `array` *required*

Cuộc hội thoại, sắp xếp từ cũ nhất đến mới nhất. Cuộc hội thoại phải có ít nhất một tin nhắn và tin nhắn cuối cùng phải có `role` `user`. API không lưu trữ các cuộc hội thoại; hãy gửi toàn bộ cuộc hội thoại trong mỗi yêu cầu.

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

Người viết tin nhắn.

* `user`
* `assistant`

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

Một chuỗi không rỗng hoặc một mảng khối nội dung không rỗng. `text` được phép trong cả hai vai trò, `image` và `tool_result` chỉ được phép trong các tin nhắn `user`, còn `tool_use` chỉ được phép trong các tin nhắn `assistant`.

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

Số token đầu ra tối đa mà Lana có thể tạo trong một bước của mô hình. Một lượt có hoạt động tra cứu cần nhiều bước, vì vậy tổng `output_tokens` của lượt đó có thể cao hơn. Khi dưới 2.048, `lana-thinking` không thực hiện suy luận.

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

`true` truyền phát các sự kiện do máy chủ gửi. `false` trả về một đối tượng JSON khi lượt kết thúc.

**system** `string`

Các chỉ dẫn bổ sung, chẳng hạn như "Trả lời bằng ba dấu đầu dòng." Những chỉ dẫn này được thêm vào chỉ dẫn riêng của Lana chứ không thay thế chúng.

**extensions** `object`

Các tùy chọn chỉ dành cho Lana. Tất cả đều không bắt buộc. Các tùy chọn `include_*` cho phép tạo đầu ra; Lana sẽ quyết định có gửi đầu ra đó hay không.

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

Loại bỏ các công cụ chuyển, hoán đổi và khởi chạy token. Hãy giữ giá trị là `true`.

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

`plain` yêu cầu Lana không sử dụng Markdown và loại bỏ các dấu `{{cite:N}}`. Các sự kiện `source` vẫn được gửi đến.

* `markdown`
* `plain`

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

Cho phép các thành phần UI dưới dạng sự kiện `ui_block` và `ui_schema`.

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

Cho phép tối đa 3 câu hỏi tiếp theo được đề xuất.

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

Cho phép các tệp CSV, JSON hoặc văn bản có thể tải xuống dưới dạng sự kiện `document`.

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

Cho phép Lana đọc tối đa 10.000 giao dịch trong lịch sử của một địa chỉ (50.000 để đếm và tính tổng), với tối đa 3 lần quét mỗi lượt. Chỉ dành cho mainnet. Nếu không bật tùy chọn này, Lana đọc tối đa 100 giao dịch mỗi lần tra cứu. Mức giá cố định không đổi.

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

Người đang đặt câu hỏi.

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

Địa chỉ của người dùng để các cụm từ "ví của tôi" và "số dư của tôi" hoạt động.

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

`wallet` hoặc `token`: cho biết `wallet` là gì. Yêu cầu `wallet`.

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

Múi giờ IANA, chẳng hạn như `America/New_York`, để cụm từ "hôm nay" hoạt động.

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

Mạng cần tra cứu.

* `mainnet`
* `devnet`

**extensions.attachments** `array`

Tối đa 8 hình ảnh được thêm vào tin nhắn cuối cùng của người dùng. Các khối `image` trong `messages` không được tính vào giới hạn này.

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

URL của hình ảnh.

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

Luôn là `image`.

* `image`

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

Được trình khám phá Orb sử dụng. Bạn không cần tùy chọn này.

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

Được trình khám phá Orb sử dụng. Bạn không cần tùy chọn này.


## OpenAPI

````yaml vi/openapi/lana/openapi.yaml POST /v1/lana/messages
openapi: 3.0.3
info:
  title: Lana API
  description: >
    Lana là một tác nhân AI Solana mà bạn gọi qua HTTP. Gửi câu hỏi bằng tiếng
    Anh thông thường, Lana sẽ tra cứu

    ví, token, giao dịch và giá, rồi trả lời. API có cấu trúc giống Anthropic

    Messages API, nhưng các SDK của Anthropic không hoạt động với API này.


    ## Xác thực


    Gửi khóa API Helius theo một trong các cách sau:

    - Header (khuyến nghị): `X-Api-Key: YOUR_API_KEY`

    - Tham số truy vấn: `?api-key=YOUR_API_KEY`


    `Authorization: Bearer` không hoạt động trên endpoint này và trả về `401`.
  version: 1.0.0
  contact:
    name: Hỗ trợ API
    url: https://helius.dev
servers:
  - url: https://beta.helius-rpc.com
    description: Gatekeeper (Beta)
security:
  - ApiKeyHeader: []
  - ApiKeyQuery: []
tags:
  - name: Tin nhắn
    description: Đặt câu hỏi cho Lana
paths:
  /v1/lana/messages:
    post:
      tags:
        - Tin nhắn
      summary: Tạo tin nhắn Lana
      description: >
        Gửi một cuộc trò chuyện đến Lana và trả về câu trả lời. Với `"stream":
        true`, câu trả lời

        đến dưới dạng sự kiện do máy chủ gửi (`text/event-stream`). Với
        `"stream": false` (mặc định),

        câu trả lời đến dưới dạng một đối tượng JSON khi lượt kết thúc.


        Với `"stream": true`, phản hồi `200` và các sự kiện đầu tiên đến khi
        Lana phản hồi lần đầu hoặc

        chậm nhất sau 10 giây, rồi một sự kiện `ping` đến sau mỗi 10 giây. Hãy
        đặt

        thời gian chờ đọc của máy khách HTTP thành 30 giây trở lên; giá trị mặc
        định 5 giây như trong `httpx`

        là quá ngắn. Yêu cầu bị lỗi trước khi phản hồi bắt đầu sẽ nhận phản hồi
        lỗi

        thông thường với trạng thái tương ứng, vì vậy hãy kiểm tra trạng thái
        HTTP trước khi đọc phần thân dưới dạng

        luồng. Sau khi phản hồi bắt đầu, lỗi sẽ đến dưới dạng sự kiện `error`
        cuối cùng.


        Mỗi yêu cầu có chi phí cố định 10.000 tín dụng với `lana-thinking` hoặc
        2.000 tín dụng với

        `lana-fast`. Mọi yêu cầu nhận được HTTP `200` đều bị tính phí, bất kể
        lượt kết thúc như thế nào.

        Các yêu cầu bị lỗi trước khi phản hồi bắt đầu sẽ nhận trạng thái khác và
        không mất phí. Chỉ dành cho

        gói trả phí.
      operationId: createLanaMessage
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/MessagesRequest'
            examples:
              nonStreaming:
                summary: Không truyền phát
                value:
                  model: lana-thinking
                  messages:
                    - role: user
                      content: Giá SOL hiện tại là bao nhiêu?
                  extensions:
                    read_only: true
              streaming:
                summary: Truyền phát
                value:
                  model: lana-thinking
                  stream: true
                  messages:
                    - role: user
                      content: >-
                        Ai là những người nắm giữ nhiều nhất
                        EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v?
                  extensions:
                    read_only: true
      responses:
        '200':
          description: >
            Lượt đã chạy. Với `"stream": false`, trả về một đối tượng JSON. Hãy
            kiểm tra `stop_reason`: một lượt

            bị lỗi sau khi tạo nội dung vẫn trả về `200`, với `stop_reason:
            "error"`

            và một đối tượng `error`.


            Với `"stream": true`, trả về một luồng sự kiện do máy chủ gửi. Mỗi
            sự kiện gồm một dòng

            `event: <type>` và một dòng `data: <json>`, theo sau là một dòng
            trống. Luồng

            bắt đầu bằng `message_start` và luôn kết thúc bằng `message_end`
            hoặc `error`. Có thể bổ sung

            các loại sự kiện và trường mới; hãy bỏ qua những loại hoặc trường
            bạn không nhận ra.
          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":"Những
                người nắm giữ USDC lớn nhất là"}}


                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: >
            Phần thân không hợp lệ, ví dụ như mô hình không xác định, trường
            không xác định hoặc `max_tokens`

            lớn hơn 8.192. `message` nêu tên từng trường không hợp lệ. Không
            tính phí.


            Phần thân lớn hơn 10 MB sẽ bị Gatekeeper từ chối với phần thân văn
            bản thuần `Bad Request`.


            Một lượt bị lỗi trước khi phản hồi bắt đầu do cuộc trò chuyện không
            vừa

            cửa sổ ngữ cảnh cũng trả về `400`, với `error.type` là
            `context_overflow`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                type: error
                error:
                  type: invalid_request_error
                  message: 'max_tokens: max_tokens phải <= 8192'
            text/plain:
              schema:
                type: string
              example: Bad Request
        '401':
          description: >
            Khóa API bị thiếu, không hợp lệ hoặc được gửi dưới dạng
            `Authorization: Bearer`. Phần thân là văn bản thuần. Không tính phí.
          content:
            text/plain:
              schema:
                type: string
        '403':
          description: >-
            Gói của bạn không bao gồm Lana (gói Free), hoặc cài đặt quyền truy
            cập của khóa chặn dịch vụ này. Phần thân là văn bản thuần. Không
            tính phí.
          content:
            text/plain:
              schema:
                type: string
        '429':
          description: >
            Không tính phí. Một trong các trường hợp sau:

            - Văn bản thuần `Too Many Requests`: bạn đã vượt quá giới hạn tốc độ
            của gói. Thử lại sau thời gian `Retry-After` (1 giây).

            - Văn bản thuần `max usage reached`: dự án của bạn đã hết tín dụng.
            Không có `Retry-After`; việc thử lại sẽ thất bại cho đến khi bạn
            thêm tín dụng hoặc nâng cấp.

            - JSON có `error.type` là `rate_limit_error`: dự án của bạn đã có
            khoảng 3 yêu cầu Lana đang chạy. Thử lại sau thời gian `Retry-After`
            (5 giây).
          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: >-
            Lượt bị lỗi với `api_error` trước khi phản hồi bắt đầu. Không tính
            phí.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '502':
          description: >-
            Lượt bị lỗi với `tool_error` trước khi phản hồi bắt đầu. Không tính
            phí.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '503':
          description: >-
            Lana đã hết công suất hoặc đang khởi động lại. Thử lại sau thời gian
            `Retry-After` (5 giây khi hết công suất, 30 giây khi đang khởi động
            lại). Không tính phí.
          headers:
            Retry-After:
              $ref: '#/components/headers/RetryAfter'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '504':
          description: >-
            Lượt bị lỗi với `timeout_error` trước khi phản hồi bắt đầu. Không
            tính phí.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '529':
          description: >-
            Lượt bị lỗi với `overloaded_error` trước khi phản hồi bắt đầu. Một
            số máy khách HTTP không nhận dạng `529`; hãy xử lý trạng thái này
            giống `503`. Không tính phí.
          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: >-
            Dùng `lana-thinking` để phân tích nhiều bước, với tối đa 20 bước tra
            cứu mỗi lượt; mô hình có thể truyền phát quá trình suy luận. Dùng
            `lana-fast` để tra cứu nhanh và tìm dữ kiện đơn lẻ, với tối đa 4
            bước tra cứu mỗi lượt.
          example: lana-thinking
        messages:
          type: array
          minItems: 1
          description: >-
            Cuộc trò chuyện, từ cũ nhất đến mới nhất. Cần có ít nhất một tin
            nhắn và tin nhắn cuối phải có `role` là `user`. API không lưu trữ
            cuộc trò chuyện; hãy gửi toàn bộ cuộc trò chuyện trong mỗi yêu cầu.
          items:
            $ref: '#/components/schemas/Message'
        max_tokens:
          type: integer
          minimum: 1
          maximum: 8192
          default: 8192
          description: >-
            Số token đầu ra tối đa mà Lana có thể ghi trong một bước mô hình.
            Một lượt có tra cứu cần nhiều bước, vì vậy tổng `output_tokens` của
            lượt có thể cao hơn. Khi dưới 2.048, `lana-thinking` không suy luận.
        stream:
          type: boolean
          default: false
          description: >-
            `true` truyền phát các sự kiện do máy chủ gửi. `false` trả về một
            đối tượng JSON khi lượt kết thúc.
        system:
          type: string
          minLength: 1
          maxLength: 10000
          description: >-
            Các hướng dẫn bổ sung, chẳng hạn như "Trả lời bằng ba gạch đầu
            dòng." Chúng được thêm vào hướng dẫn riêng của Lana, không thay thế
            các hướng dẫn đó.
        extensions:
          $ref: '#/components/schemas/Extensions'
    MessageResponse:
      type: object
      description: >-
        Phản hồi không truyền phát. Câu trả lời là các khối `text` được nối theo
        thứ tự.
      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: >-
            Tất cả thành phần UI dưới dạng một cây. Có mặt khi
            `include_ui_schema` được bật và có nội dung để hiển thị.
        documents:
          type: array
          description: Có mặt khi `include_documents` được bật và Lana đã tạo tệp.
          items:
            $ref: '#/components/schemas/Document'
        follow_up:
          type: array
          description: Có mặt khi `include_followups` được bật và Lana đã đề xuất câu hỏi.
          items:
            type: string
        sources:
          type: array
          description: Có mặt khi Lana sử dụng các trang web.
          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 đang được giao dịch ở mức ...
        stop_reason: end_turn
        usage:
          input_tokens: 90800
          output_tokens: 96
          tool_calls: 1
          prompt_tokens: 45600
          context_window: 200000
    StreamEvent:
      description: >
        Một sự kiện do máy chủ gửi. `type` trong JSON của `data` khớp với tên
        `event`. Thứ tự:

        1. `message_start`, luôn đứng đầu.

        2. Bất kỳ tổ hợp nào của `content_block_delta`, `tool_use`,
        `tool_result`, `source`, `ui_block`, `document`, `progress_update` và
        `ping`.

        3. `ui_schema`, tối đa một lần.

        4. `follow_up`, tối đa một lần.

        5. `message_end` nếu lượt hoàn tất, hoặc `error` nếu lượt bị lỗi. Luôn
        đứng cuối.
      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: Người viết tin nhắn.
        content:
          description: >-
            Một chuỗi không rỗng hoặc một mảng khối nội dung không rỗng. `text`
            được phép trong cả hai vai trò, `image` và `tool_result` chỉ trong
            tin nhắn `user`, còn `tool_use` chỉ trong tin nhắn `assistant`.
          oneOf:
            - type: string
              minLength: 1
            - type: array
              minItems: 1
              items:
                $ref: '#/components/schemas/ContentBlock'
    Extensions:
      type: object
      additionalProperties: false
      description: >-
        Các tùy chọn chỉ dành cho Lana. Tất cả đều không bắt buộc. Các tùy chọn
        `include_*` cho phép tạo đầu ra; Lana quyết định có gửi đầu ra đó hay
        không.
      properties:
        read_only:
          type: boolean
          default: true
          description: >-
            Loại bỏ các công cụ chuyển, hoán đổi và khởi chạy token. Hãy để giá
            trị là `true`.
        output_format:
          type: string
          enum:
            - markdown
            - plain
          default: markdown
          description: >-
            `plain` yêu cầu Lana không dùng Markdown và loại bỏ các dấu
            `{{cite:N}}`. Các sự kiện `source` vẫn được gửi đến.
        include_ui_schema:
          type: boolean
          default: false
          description: >-
            Cho phép các thành phần UI dưới dạng sự kiện `ui_block` và
            `ui_schema`.
        include_followups:
          type: boolean
          default: false
          description: Cho phép tối đa 3 câu hỏi tiếp theo được đề xuất.
        include_documents:
          type: boolean
          default: false
          description: >-
            Cho phép các tệp CSV, JSON hoặc văn bản có thể tải xuống dưới dạng
            sự kiện `document`.
        enable_deep_scan:
          type: boolean
          default: false
          description: >-
            Cho phép Lana đọc tối đa 10.000 giao dịch trong lịch sử của một địa
            chỉ (50.000 để đếm và tính tổng), tối đa 3 lần quét mỗi lượt. Chỉ
            dành cho mainnet. Nếu không có tùy chọn này, Lana đọc tối đa 100
            giao dịch mỗi lần tra cứu. Cùng một mức giá cố định.
        user_context:
          $ref: '#/components/schemas/UserContext'
        attachments:
          type: array
          maxItems: 8
          description: >-
            Tối đa 8 hình ảnh được thêm vào tin nhắn cuối của người dùng. Các
            khối `image` trong `messages` không được tính vào giới hạn này.
          items:
            $ref: '#/components/schemas/Attachment'
        progress_context:
          type: object
          description: Được trình khám phá Orb sử dụng. Bạn không cần tùy chọn này.
        transaction_filter_context:
          type: object
          description: Được trình khám phá Orb sử dụng. Bạn không cần tùy chọn này.
    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: >-
        Một lần tra cứu từ lượt trước, được phát lại đúng như Lana đã trả về.
        Chỉ dành cho tin nhắn `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: Kết quả của một lần tra cứu được phát lại. Chỉ dành cho tin nhắn `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 đã hoàn thành câu trả lời.

        - `max_tokens`: câu trả lời đã đạt `max_tokens` và có thể bị cắt bớt.

        - `tool_use`: lượt kết thúc ở một bước tra cứu, thường là khi đạt giới
        hạn bước.

        - `error`: lượt bị lỗi. Câu trả lời chưa hoàn chỉnh.
    Usage:
      type: object
      required:
        - input_tokens
        - output_tokens
        - tool_calls
        - prompt_tokens
      properties:
        input_tokens:
          type: integer
          description: Token đầu vào cho toàn bộ lượt.
        output_tokens:
          type: integer
          description: Token đầu ra cho toàn bộ lượt.
        tool_calls:
          type: integer
          description: >-
            Các lần tra cứu được chạy trong lượt, bao gồm một số lần không bao
            giờ xuất hiện dưới dạng `tool_use`.
        prompt_tokens:
          type: integer
          description: >-
            Token đầu vào trong bước mô hình cuối cùng. Dùng giá trị này để xem
            ngữ cảnh đã đầy đến mức nào.
        context_window:
          type: integer
          description: Cửa sổ ngữ cảnh của mô hình, hiện là `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: Khớp với các dấu `{{cite:N}}` trong câu trả lời.
        url:
          type: string
        title:
          type: string
        snippet:
          type: string
    ErrorObject:
      type: object
      required:
        - type
        - message
      properties:
        type:
          type: string
          description: >
            Phân nhánh dựa trên trường này, không phải `message`. Các giá trị đã
            biết: `invalid_request_error`, `context_overflow`,

            `overloaded_error`, `timeout_error`, `tool_error`,
            `rate_limit_error`, `api_error`.

            Hãy xử lý mọi giá trị khác giống như `api_error`.
          example: invalid_request_error
        message:
          type: string
    MessageStartEvent:
      type: object
      title: message_start
      description: Lượt đã bắt đầu.
      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: >-
        Một phần của câu trả lời (`text_delta`) hoặc quá trình suy luận của Lana
        (`thinking_delta`, chỉ với `lana-thinking` khi Lana suy luận). Hiển thị
        phần suy luận tách biệt với câu trả lời hoặc bỏ qua phần này.
      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 đã bắt đầu một lần tra cứu. Chỉ dùng sự kiện này cho chỉ báo tiến
        trình; tên công cụ và dữ liệu đầu vào có thể thay đổi.
      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: >-
        Một lần tra cứu đã hoàn tất. Một lần tra cứu thất bại không làm hỏng
        lượt; Lana sẽ xử lý để tiếp tục.
      required:
        - type
        - tool_use_id
        - content
      properties:
        type:
          type: string
          enum:
            - tool_result
        tool_use_id:
          type: string
        content:
          type: string
          description: >-
            Bản xem trước có tối đa 500 ký tự. Khi `is_error` là `true`, đây là
            JSON có thông báo `error` và một `code`.
        is_error:
          type: boolean
    SourceEvent:
      type: object
      title: source
      description: Một trang web mà Lana đã sử dụng.
      required:
        - type
        - index
        - url
        - title
      properties:
        type:
          type: string
          enum:
            - source
        index:
          type: integer
          description: Khớp với các dấu `{{cite:N}}` trong câu trả lời.
        url:
          type: string
        title:
          type: string
        snippet:
          type: string
    ProgressUpdateEvent:
      type: object
      title: progress_update
      description: >-
        Một dòng trạng thái ngắn trong một lượt dài. Hiển thị riêng với câu trả
        lời.
      required:
        - type
        - id
        - message
        - created_at
      properties:
        type:
          type: string
          enum:
            - progress_update
        id:
          type: string
        message:
          type: string
        created_at:
          type: integer
          description: Mili giây Unix.
    UiBlockEvent:
      type: object
      title: ui_block
      description: Một thành phần UI. Yêu cầu `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: Một tệp có thể tải xuống. Yêu cầu `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: >-
        Tất cả thành phần UI dưới dạng một cây. Yêu cầu `include_ui_schema`. Tối
        đa một lần.
      required:
        - type
        - schema
      properties:
        type:
          type: string
          enum:
            - ui_schema
        schema:
          type: object
    FollowUpEvent:
      type: object
      title: follow_up
      description: >-
        Các câu hỏi tiếp theo được đề xuất. Yêu cầu `include_followups`. Tối đa
        một lần.
      required:
        - type
        - suggestions
      properties:
        type:
          type: string
          enum:
            - follow_up
        suggestions:
          type: array
          items:
            type: string
    MessageEndEvent:
      type: object
      title: message_end
      description: >-
        Lượt đã hoàn tất. Khi `stop_reason` là `error`, hãy xử lý giống như
        `api_error`; mọi văn bản trả lời trước đó đều chưa hoàn chỉnh.
      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: >-
        Lượt bị lỗi sau khi luồng bắt đầu. Mọi văn bản trả lời trước đó đều chưa
        hoàn chỉnh.
      required:
        - type
        - error
      properties:
        type:
          type: string
          enum:
            - error
        error:
          $ref: '#/components/schemas/ErrorObject'
    PingEvent:
      type: object
      title: ping
      description: Một tín hiệu duy trì kết nối sau mỗi 10 giây. Hãy bỏ qua.
      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: Người đang đặt câu hỏi.
      properties:
        wallet:
          type: string
          minLength: 1
          maxLength: 128
          description: >-
            Địa chỉ của người dùng để các cụm từ "ví của tôi" và "số dư của tôi"
            hoạt động.
        address_kind:
          type: string
          minLength: 1
          maxLength: 32
          description: '`wallet` hoặc `token`: cho biết `wallet` là gì. Yêu cầu có `wallet`.'
        time_zone:
          type: string
          minLength: 1
          maxLength: 64
          description: >-
            Múi giờ IANA, chẳng hạn như `America/New_York`, để cụm từ "hôm nay"
            hoạt động.
        network:
          type: string
          enum:
            - mainnet
            - devnet
          default: mainnet
          description: Mạng cần tra cứu.
    Attachment:
      type: object
      additionalProperties: false
      required:
        - url
        - kind
      properties:
        url:
          type: string
          format: uri
          description: URL của hình ảnh.
        kind:
          type: string
          enum:
            - image
          description: Luôn là `image`.
    ImageBlock:
      type: object
      additionalProperties: false
      description: >-
        Hình ảnh theo URL. Chỉ dành cho tin nhắn `user`. Không hỗ trợ hình ảnh
        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: Số giây cần chờ trước khi thử lại.
      schema:
        type: integer
  securitySchemes:
    ApiKeyHeader:
      type: apiKey
      in: header
      name: X-Api-Key
      description: Khóa API Helius của bạn.
    ApiKeyQuery:
      type: apiKey
      in: query
      name: api-key
      description: Khóa API Helius của bạn.

````

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