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

> 读取 Run 当前状态、结果和费用，用于查询未完成 Run 或获取以前的结果。

使用 `output` 前，检查 `status` 和 `provider_response`。`COMPLETED` 状态的 Run 可能包含数据提供商错误；`FAILED` 状态的 Run 仍可能收费。


## OpenAPI

````yaml /openapi.zh.json get /v1/runs/{runId}
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: Balance
paths:
  /v1/runs/{runId}:
    get:
      tags:
        - Runs
      summary: 获取 Run
      description: >-
        读取 Run 当前状态、结果和费用，用于查询未完成 Run 或获取以前的结果。


        使用 output 前，检查 status 和 provider_response。COMPLETED 可能包含数据提供商错误；FAILED
        Run 仍可能产生费用。
      operationId: runs-get
      parameters:
        - name: runId
          in: path
          schema:
            type: string
            pattern: >-
              ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|[fF]{8}-[fF]{4}-[fF]{4}-[fF]{4}-[fF]{12})$
            format: uuid
          required: true
      responses:
        '200':
          description: 成功
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                  run_url:
                    type: string
                    description: 在控制台打开 Run，需要工作空间成员权限。
                  provider:
                    type: string
                    pattern: ^[a-z0-9][a-z0-9-]*$
                  endpoint:
                    type: string
                    pattern: ^\/.+$
                  endpoint_version:
                    type: integer
                    exclusiveMinimum: 0
                  status:
                    type: string
                    enum:
                      - QUEUED
                      - RUNNING
                      - COMPLETED
                      - FAILED
                      - STOPPED
                    description: >-
                      QUEUED 或 RUNNING 表示仍在执行。COMPLETED 表示已有数据提供商响应，包括非 2xx
                      响应。FAILED 请读取 failure。STOPPED 表示分派前停止。charge_usd 与状态分别检查。
                  failure:
                    anyOf:
                      - type: object
                        properties:
                          kind:
                            type: string
                            enum:
                              - TIMED_OUT
                              - INTERNAL
                          message:
                            type: string
                        required:
                          - kind
                          - message
                        additionalProperties: false
                      - type: 'null'
                    description: Run 失败原因，仅在 status 为 FAILED 时非 null。
                  input:
                    type: object
                  output: {}
                  provider_response:
                    anyOf:
                      - type: object
                        properties:
                          http_status:
                            type: integer
                            minimum: 100
                            maximum: 599
                            description: 数据提供商返回的 HTTP 状态，即使 Run 为 COMPLETED 也应检查。
                          error:
                            anyOf:
                              - {}
                              - type: 'null'
                        required:
                          - http_status
                        additionalProperties: false
                      - type: 'null'
                    description: |-
                      仅在 status 为 COMPLETED 时非 null。

                      - 2xx 响应：output 为任意结构的数据提供商原生 JSON；正文为空时为 null。
                      - 非 2xx 响应：error 包含数据提供商错误正文，output 为 null。

                      两种正文均会移除敏感字段。
                  charge_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'
                    description: >-
                      最终费用，精确的美元十进制字符串。QUEUED 或 RUNNING 时为 null。FAILED 状态的 Run
                      仍可能按接口定价产生非零费用。
                  charge_basis:
                    anyOf:
                      - type: object
                        properties:
                          clause:
                            type: string
                            enum:
                              - rule
                              - NO_RESULT
                              - PROVIDER_ERROR
                              - TIMED_OUT
                              - INTERNAL
                          quantity:
                            anyOf:
                              - type: integer
                                minimum: 0
                              - type: 'null'
                        required:
                          - clause
                          - quantity
                        additionalProperties: false
                      - type: 'null'
                    description: 计算费用所用的价格条款。结算前或未尝试调用数据提供商时为 null。
                  stoppable:
                    type: boolean
                    description: 当前是否可接受停止请求。不保证能在分派前停止 Run。
                  stop_requested_at:
                    anyOf:
                      - type: string
                        description: ISO 8601 UTC 时间戳。
                        format: date-time
                      - type: 'null'
                    description: 请求停止的时间。如果已开始分派，Run 仍可能继续。
                  created_at:
                    type: string
                    description: ISO 8601 UTC 时间戳。
                    format: date-time
                  started_at:
                    anyOf:
                      - type: string
                        description: ISO 8601 UTC 时间戳。
                        format: date-time
                      - type: 'null'
                  completed_at:
                    anyOf:
                      - type: string
                        description: ISO 8601 UTC 时间戳。
                        format: date-time
                      - type: 'null'
                  task_id:
                    anyOf:
                      - type: string
                      - type: 'null'
                  metadata:
                    type: object
                    additionalProperties:
                      type: string
                      minLength: 1
                      maxLength: 500
                    maxProperties: 20
                    propertyNames:
                      type: string
                      pattern: ^[a-z][a-z0-9_]{0,39}$
                    description: |-
                      已保存的追踪字段，可用于筛选 Run，不发送给数据提供商，不影响路由、价格或幂等。

                      - 最多 20 个键：小写字母、数字和下划线，以字母开头，最长 40 个字符。
                      - 值：长度为 1–500 的字符串。
                      - user_id：终端用户的不透明 ID，不得使用邮箱或姓名。
                required:
                  - id
                  - run_url
                  - provider
                  - endpoint
                  - endpoint_version
                  - status
                  - failure
                  - input
                  - output
                  - provider_response
                  - charge_usd
                  - charge_basis
                  - stoppable
                  - stop_requested_at
                  - created_at
                  - started_at
                  - completed_at
                  - task_id
                  - metadata
                additionalProperties: false
        '400':
          description: ValidationFailed
          content:
            application/json:
              schema:
                $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'
        '404':
          description: NotFound
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NotFoundEncoded'
        '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
    NotFoundEncoded:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              enum:
                - not_found
            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.