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

# 查询 Run 报价

> 在运行前查询 Glasser 会为每个请求预留的金额。此免费请求不创建 Run，也不预留余额。

* **请求：** 在 `requests` 中发送 1 到 20 项。每项包含你将发送给[运行接口](https://glasser.ai/docs/zh/api-reference/runs/create.md)的 `provider`、`endpoint`、`input` 和 `endpoint_version`。
* **响应：** `data` 中每个请求对应一项，顺序相同。带 `hold_usd` 的项是报价；带 `error` 的项被拒绝，运行接口也会以同样的原因拒绝它。

`hold_usd` 是按当前价格预留的金额，不是有保证的上限。数据提供商返回的结果多于输入要求，或价格在 Run 之前发生变化时，最终费用可能更高。


## OpenAPI

````yaml /openapi.zh.json post /v1/runs/quote
openapi: 3.1.0
info:
  title: Glasser
  version: 0.0.1
  description: 一个 API Key，无需合同，按次付费，即可调用批量采购的付费 API。每个响应包含 x-request-id；所有错误正文采用统一结构。
servers:
  - url: https://api.glasser.ai
security: []
tags:
  - name: Solutions
  - name: Endpoints
  - name: Runs
  - name: Feedback
  - name: Balance
paths:
  /v1/runs/quote:
    post:
      tags:
        - Runs
      summary: 查询 Run 报价
      description: >-
        在运行前查询 Glasser 会为每个请求预留的金额。发送 1 到 20 个请求，每个请求包含你将发送给运行接口的
        provider、endpoint、input 和 endpoint_version。此免费请求不创建 Run，不预留余额，也不调用数据提供商。


        data 中的每一项对应相同位置的请求。带 hold_usd 的项是报价，经过与运行接口相同的检查。带 error
        的项被拒绝，运行接口也会以同样的原因拒绝它：validation_failed、not_found、endpoint_not_permitted
        或 endpoint_version_mismatch。


        hold_usd 是按当前价格预留的金额，不是有保证的上限。最终费用通常不超过它。数据提供商返回的结果多于输入要求，或价格在 Run
        之前发生变化时，最终费用可能更高。报价不锁定价格，也不检查余额。
      operationId: runs-quote
      parameters: []
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                requests:
                  type: array
                  items:
                    type: object
                    properties:
                      provider:
                        type: string
                        pattern: ^[a-z0-9][a-z0-9-]*$
                      endpoint:
                        type: string
                        pattern: ^\/.+$
                      input:
                        anyOf:
                          - type: object
                          - type: array
                            items:
                              type: object
                        description: 数据提供商原生输入，按检查结果中的 input_schema 构造。
                      endpoint_version:
                        anyOf:
                          - type: integer
                            exclusiveMinimum: 0
                            description: >-
                              选择受支持版本，省略则使用默认版本。兼容更新保持版本号；版本不可用或已停用时返回
                              409。版本不锁定价格：新 Run 使用受理时价格，已受理 Run 保留至结算。
                          - type: 'null'
                    required:
                      - provider
                      - endpoint
                    additionalProperties: false
                  minItems: 1
                  maxItems: 20
                  description: >-
                    1 到 20 个请求。每个请求包含你将发送给运行接口的 provider、endpoint、input 和
                    endpoint_version。
              required:
                - requests
              additionalProperties: false
        required: true
      responses:
        '200':
          description: 成功
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items:
                      anyOf:
                        - type: object
                          properties:
                            provider:
                              type: string
                              pattern: ^[a-z0-9][a-z0-9-]*$
                            endpoint:
                              type: string
                              pattern: ^\/.+$
                            endpoint_version:
                              type: integer
                              description: 此报价解析到的接口版本。
                            hold_usd:
                              type: string
                              pattern: ^(0|[1-9]\d*)\.(\d{2}|\d{2}\d{0,3}[1-9])$
                              description: Glasser 按当前价格会为此输入预留的金额。不是最终费用有保证的上限。
                            price:
                              type: object
                              properties:
                                rule:
                                  anyOf:
                                    - type: object
                                      properties:
                                        type:
                                          type: string
                                          enum:
                                            - flat
                                        amount_usd:
                                          type: string
                                          pattern: >-
                                            ^(0|[1-9]\d*)\.(\d{2}|\d{2}\d{0,3}[1-9])$
                                          description: >-
                                            精确的美元十进制字符串，小数位数为
                                            2–6，采用唯一规范格式。求和时使用十进制运算或乘以 10^6
                                            转为整数，不使用浮点数。
                                      required:
                                        - type
                                        - amount_usd
                                      additionalProperties: false
                                    - type: object
                                      properties:
                                        type:
                                          type: string
                                          enum:
                                            - per_result
                                        per_result_usd:
                                          type: string
                                          pattern: >-
                                            ^(0|[1-9]\d*)\.(\d{2}|\d{2}\d{0,3}[1-9])$
                                          description: >-
                                            精确的美元十进制字符串，小数位数为
                                            2–6，采用唯一规范格式。求和时使用十进制运算或乘以 10^6
                                            转为整数，不使用浮点数。
                                        cap_usd:
                                          anyOf:
                                            - type: string
                                              pattern: >-
                                                ^(0|[1-9]\d*)\.(\d{2}|\d{2}\d{0,3}[1-9])$
                                              description: >-
                                                精确的美元十进制字符串，小数位数为
                                                2–6，采用唯一规范格式。求和时使用十进制运算或乘以 10^6
                                                转为整数，不使用浮点数。
                                            - type: 'null'
                                        partial_usd:
                                          type: string
                                          pattern: >-
                                            ^(0|[1-9]\d*)\.(\d{2}|\d{2}\d{0,3}[1-9])$
                                          description: >-
                                            精确的美元十进制字符串，小数位数为
                                            2–6，采用唯一规范格式。求和时使用十进制运算或乘以 10^6
                                            转为整数，不使用浮点数。
                                      required:
                                        - type
                                        - per_result_usd
                                        - cap_usd
                                      additionalProperties: false
                                    - type: object
                                      properties:
                                        type:
                                          type: string
                                          enum:
                                            - per_token
                                        per_million_input_tokens_usd:
                                          type: string
                                          pattern: >-
                                            ^(0|[1-9]\d*)\.(\d{2}|\d{2}\d{0,3}[1-9])$
                                          description: >-
                                            精确的美元十进制字符串，小数位数为
                                            2–6，采用唯一规范格式。求和时使用十进制运算或乘以 10^6
                                            转为整数，不使用浮点数。
                                        cap_usd:
                                          type: string
                                          pattern: >-
                                            ^(0|[1-9]\d*)\.(\d{2}|\d{2}\d{0,3}[1-9])$
                                          description: >-
                                            精确的美元十进制字符串，小数位数为
                                            2–6，采用唯一规范格式。求和时使用十进制运算或乘以 10^6
                                            转为整数，不使用浮点数。
                                      required:
                                        - type
                                        - per_million_input_tokens_usd
                                        - cap_usd
                                      additionalProperties: false
                                    - type: object
                                      properties:
                                        type:
                                          type: string
                                          enum:
                                            - base_plus_per_result
                                        base_usd:
                                          type: string
                                          pattern: >-
                                            ^(0|[1-9]\d*)\.(\d{2}|\d{2}\d{0,3}[1-9])$
                                          description: >-
                                            精确的美元十进制字符串，小数位数为
                                            2–6，采用唯一规范格式。求和时使用十进制运算或乘以 10^6
                                            转为整数，不使用浮点数。
                                        included_results:
                                          type: integer
                                          minimum: 0
                                        per_extra_result_usd:
                                          type: string
                                          pattern: >-
                                            ^(0|[1-9]\d*)\.(\d{2}|\d{2}\d{0,3}[1-9])$
                                          description: >-
                                            精确的美元十进制字符串，小数位数为
                                            2–6，采用唯一规范格式。求和时使用十进制运算或乘以 10^6
                                            转为整数，不使用浮点数。
                                        cap_usd:
                                          type: string
                                          pattern: >-
                                            ^(0|[1-9]\d*)\.(\d{2}|\d{2}\d{0,3}[1-9])$
                                          description: >-
                                            精确的美元十进制字符串，小数位数为
                                            2–6，采用唯一规范格式。求和时使用十进制运算或乘以 10^6
                                            转为整数，不使用浮点数。
                                        unit:
                                          type: string
                                      required:
                                        - type
                                        - base_usd
                                        - included_results
                                        - per_extra_result_usd
                                        - cap_usd
                                      additionalProperties: false
                                    - type: object
                                      properties:
                                        type:
                                          type: string
                                          enum:
                                            - metered
                                        base_usd:
                                          type: string
                                          pattern: >-
                                            ^(0|[1-9]\d*)\.(\d{2}|\d{2}\d{0,3}[1-9])$
                                          description: >-
                                            精确的美元十进制字符串，小数位数为
                                            2–6，采用唯一规范格式。求和时使用十进制运算或乘以 10^6
                                            转为整数，不使用浮点数。
                                        cap_usd:
                                          anyOf:
                                            - type: string
                                              pattern: >-
                                                ^(0|[1-9]\d*)\.(\d{2}|\d{2}\d{0,3}[1-9])$
                                              description: >-
                                                精确的美元十进制字符串，小数位数为
                                                2–6，采用唯一规范格式。求和时使用十进制运算或乘以 10^6
                                                转为整数，不使用浮点数。
                                            - type: 'null'
                                        base_kind:
                                          type: string
                                          enum:
                                            - starting
                                      required:
                                        - type
                                        - base_usd
                                        - cap_usd
                                      additionalProperties: false
                                    - type: object
                                      properties:
                                        type:
                                          type: string
                                          enum:
                                            - per_event
                                        events:
                                          type: object
                                          additionalProperties:
                                            type: object
                                            properties:
                                              usd:
                                                type: string
                                                pattern: >-
                                                  ^(0|[1-9]\d*)\.(\d{2}|\d{2}\d{0,3}[1-9])$
                                                description: >-
                                                  精确的美元十进制字符串，小数位数为
                                                  2–6，采用唯一规范格式。求和时使用十进制运算或乘以 10^6
                                                  转为整数，不使用浮点数。
                                              title:
                                                type: string
                                            required:
                                              - usd
                                              - title
                                            additionalProperties: false
                                        base_usd:
                                          type: string
                                          pattern: >-
                                            ^(0|[1-9]\d*)\.(\d{2}|\d{2}\d{0,3}[1-9])$
                                          description: >-
                                            精确的美元十进制字符串，小数位数为
                                            2–6，采用唯一规范格式。求和时使用十进制运算或乘以 10^6
                                            转为整数，不使用浮点数。
                                        cap_usd:
                                          type: string
                                          pattern: >-
                                            ^(0|[1-9]\d*)\.(\d{2}|\d{2}\d{0,3}[1-9])$
                                          description: >-
                                            精确的美元十进制字符串，小数位数为
                                            2–6，采用唯一规范格式。求和时使用十进制运算或乘以 10^6
                                            转为整数，不使用浮点数。
                                      required:
                                        - type
                                        - events
                                        - base_usd
                                        - cap_usd
                                      additionalProperties: false
                                    - type: object
                                      properties:
                                        type:
                                          type: string
                                      required:
                                        - type
                                      allOf:
                                        - type: object
                                          additionalProperties: {}
                                display:
                                  type: object
                                  properties:
                                    amount_usd:
                                      type: string
                                      pattern: >-
                                        ^(0|[1-9]\d*)\.(\d{2}|\d{2}\d{0,3}[1-9])$
                                      description: >-
                                        精确的美元十进制字符串，小数位数为
                                        2–6，采用唯一规范格式。求和时使用十进制运算或乘以 10^6
                                        转为整数，不使用浮点数。
                                    unit:
                                      type: string
                                    cap_usd:
                                      type: string
                                      pattern: >-
                                        ^(0|[1-9]\d*)\.(\d{2}|\d{2}\d{0,3}[1-9])$
                                      description: >-
                                        精确的美元十进制字符串，小数位数为
                                        2–6，采用唯一规范格式。求和时使用十进制运算或乘以 10^6
                                        转为整数，不使用浮点数。
                                  required:
                                    - amount_usd
                                    - unit
                                  additionalProperties: false
                                charges:
                                  type: object
                                  properties:
                                    NO_RESULT:
                                      type: string
                                      pattern: >-
                                        ^(0|[1-9]\d*)\.(\d{2}|\d{2}\d{0,3}[1-9])$
                                      description: >-
                                        精确的美元十进制字符串，小数位数为
                                        2–6，采用唯一规范格式。求和时使用十进制运算或乘以 10^6
                                        转为整数，不使用浮点数。
                                    PROVIDER_ERROR:
                                      type: string
                                      pattern: >-
                                        ^(0|[1-9]\d*)\.(\d{2}|\d{2}\d{0,3}[1-9])$
                                      description: >-
                                        精确的美元十进制字符串，小数位数为
                                        2–6，采用唯一规范格式。求和时使用十进制运算或乘以 10^6
                                        转为整数，不使用浮点数。
                                    TIMED_OUT:
                                      type: string
                                      pattern: >-
                                        ^(0|[1-9]\d*)\.(\d{2}|\d{2}\d{0,3}[1-9])$
                                      description: >-
                                        精确的美元十进制字符串，小数位数为
                                        2–6，采用唯一规范格式。求和时使用十进制运算或乘以 10^6
                                        转为整数，不使用浮点数。
                                    INTERNAL:
                                      type: string
                                      pattern: >-
                                        ^(0|[1-9]\d*)\.(\d{2}|\d{2}\d{0,3}[1-9])$
                                      description: >-
                                        精确的美元十进制字符串，小数位数为
                                        2–6，采用唯一规范格式。求和时使用十进制运算或乘以 10^6
                                        转为整数，不使用浮点数。
                                  required:
                                    - NO_RESULT
                                    - PROVIDER_ERROR
                                    - TIMED_OUT
                                    - INTERNAL
                                  additionalProperties: false
                              required:
                                - rule
                                - display
                                - charges
                              additionalProperties: false
                              description: 此报价使用的价格。
                          required:
                            - provider
                            - endpoint
                            - endpoint_version
                            - hold_usd
                            - price
                          additionalProperties: false
                        - type: object
                          properties:
                            provider:
                              type: string
                            endpoint:
                              type: string
                            error:
                              type: object
                              properties:
                                code:
                                  type: string
                                  enum:
                                    - validation_failed
                                    - not_found
                                    - endpoint_not_permitted
                                    - endpoint_version_mismatch
                                message:
                                  type: string
                                control:
                                  anyOf:
                                    - type: string
                                    - type: 'null'
                                details:
                                  anyOf:
                                    - type: object
                                    - type: 'null'
                              required:
                                - code
                                - message
                              additionalProperties: false
                          required:
                            - provider
                            - endpoint
                            - error
                          additionalProperties: false
                    description: >-
                      每个请求对应一项，顺序相同。带 hold_usd 的项是报价；带 error
                      的项被拒绝，运行接口也会以同样的原因拒绝它。
                required:
                  - data
                additionalProperties: false
        '400':
          description: ValidationFailed
          content:
            application/json:
              schema:
                anyOf:
                  - $ref: '#/components/schemas/ValidationFailedEncoded'
                  - $ref: '#/components/schemas/ValidationFailedEncoded'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UnauthorizedEncoded'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ForbiddenEncoded'
        '429':
          description: RateLimited
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RateLimitedEncoded'
      security:
        - bearer: []
components:
  schemas:
    ValidationFailedEncoded:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              enum:
                - validation_failed
            message:
              type: string
            reason:
              anyOf:
                - type: string
                - type: 'null'
            control:
              anyOf:
                - type: string
                - type: 'null'
            retry_after_ms:
              anyOf:
                - anyOf:
                    - type: integer
                    - type: 'null'
                - type: 'null'
            details:
              anyOf:
                - type: object
                - type: 'null'
          required:
            - code
            - message
          additionalProperties: false
        request_id:
          type: string
      required:
        - error
        - request_id
      additionalProperties: false
    UnauthorizedEncoded:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              enum:
                - unauthorized
            message:
              type: string
            reason:
              anyOf:
                - type: string
                - type: 'null'
            control:
              anyOf:
                - type: string
                - type: 'null'
            retry_after_ms:
              anyOf:
                - anyOf:
                    - type: integer
                    - type: 'null'
                - type: 'null'
            details:
              anyOf:
                - type: object
                - type: 'null'
          required:
            - code
            - message
          additionalProperties: false
        request_id:
          type: string
      required:
        - error
        - request_id
      additionalProperties: false
    ForbiddenEncoded:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              enum:
                - forbidden
            message:
              type: string
            reason:
              anyOf:
                - type: string
                - type: 'null'
            control:
              anyOf:
                - type: string
                - type: 'null'
            retry_after_ms:
              anyOf:
                - anyOf:
                    - type: integer
                    - type: 'null'
                - type: 'null'
            details:
              anyOf:
                - type: object
                - type: 'null'
          required:
            - code
            - message
          additionalProperties: false
        request_id:
          type: string
      required:
        - error
        - request_id
      additionalProperties: false
    RateLimitedEncoded:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              enum:
                - rate_limited
            message:
              type: string
            reason:
              anyOf:
                - type: string
                - type: 'null'
            control:
              anyOf:
                - type: string
                - type: 'null'
            retry_after_ms:
              anyOf:
                - anyOf:
                    - type: integer
                    - type: 'null'
                - type: 'null'
            details:
              anyOf:
                - type: object
                - type: 'null'
          required:
            - code
            - message
          additionalProperties: false
        request_id:
          type: string
      required:
        - error
        - request_id
      additionalProperties: false
  securitySchemes:
    bearer:
      type: http
      scheme: Bearer

````

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