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

# 查询中断请求

> 客户端中断请求的增量明细（`finish_reason = 'client_disconnected'`），按摄入时间正序、近实时可查，适合增量轮询（无 `data_not_ready` 门）。

> [!NOTE]
>
> 本接口要求 Admin Key 具备 `billing:read` 作用域。
>
> 账单类端点（日账单、产品账单、请求明细）在当天出账完成前返回 `400 data_not_ready`；本接口不受此限制：当天数据随写入即可查，`end` 超过当前时间时返回截至当前已写入的行。

> [!NOTE]
>
> 用 `X-Msh-Client-Request-Id` 精确对行：调用推理 API 时在请求头带上你自己系统的请求 ID（`X-Msh-Client-Request-Id: <你的请求ID>`），我方计费明细会把该值落表记录为 `client_request_id`。对账时拉取本 feed，用你的 request\_id 与记录里的 `client_request_id` 精确对行——这笔有没有记、记成什么样（tokens 量、是否闲时命中），逐笔可核，无需按「时间 + tokens」推断。断连核实请改用中断请求专用 feed（`interrupted_requests`）；金额核对以日账单/产品账单为准（本 feed 只给 token 量、不含金额），用 `client_request_id` 可在两类接口间精确关联。例：「我们网关 request\_id=abc123 的这笔请求被扣费了，为什么？」→ 用该 ID 在 request\_details 里查 `client_request_id=abc123` 的记录确认 token 量，再到日账单核对当日金额。


## OpenAPI

````yaml GET /v1/admin/organizations/billings/interrupted_requests
openapi: 3.0.3
info:
  title: Kimi Admin API
  version: 2026-10-20-beta
  description: >-
    ## 概览


    Kimi Admin API 让组织管理员通过接口管理成员、邀请、项目与推理 API 密钥，并查询账单、用量与审计日志——无需登录控制台。它是管理面
    API：Admin API 凭证不能调用任何推理端点，推理 API key 也不能调用本 API。


    服务地址为 `https://api.moonshot.cn/v1`。


    <Note>

    Admin API 当前处于 **Beta** 阶段，面向已完成企业认证的组织开放。在「控制台 → 组织管理 →
    组织认证」完成企业认证后，组织管理员即可在「组织管理 → Admin API Keys」自助创建 Admin Key。

    </Note>


    ## 身份验证


    以 Bearer 方式发送 Admin API secret（`sk-admin-*`）：


    ```sh

    curl https://api.moonshot.cn/v1/admin/organizations \
      --header "Authorization: Bearer $MOONSHOT_ADMIN_KEY"
    ```


    每个 Admin API 密钥 固定绑定一个组织；组织永远从 key 推导——结构上不可能跨组织访问。key 的持有者退出组织或被注销后，key 在
    30 秒内失效。secret 仅在创建或轮换时展示一次，请妥善保存。


    ## 作用域（scope）


    每个 Admin API 密钥 在创建时选定权限域：


    | scope | 类型 | 覆盖范围 |

    | --- | --- | --- |

    | `billing:read` | 只读 | 日/产品账单、请求明细、中断请求、账户余额、用量聚合 |

    | `org:read` | 只读 | 成员、邀请、项目、项目成员、推理 API 密钥 元数据、项目支出限额、组织速率限制 |

    | `org:write` | 写 | 成员/邀请/项目/推理 API 密钥 写操作（隐含 `org:read`，无需单独授权） |

    | `audit:read` | 只读 | 审计日志事件 |

    | `all` | 读+写 | 以上全部；未来新增权限域自动覆盖 |


    写端点额外要求 key 持有者在调用时仍是组织管理员，且适用更严格的限流（见下）。


    ## 速率限制


    | 类别 | 限制 |

    | --- | --- |

    | 读端点 | 60 次/分钟/组织 |

    | 写端点 | 20 次/分钟/组织 |

    | 请求明细、中断请求、用量聚合 | 5 并发/组织 |


    限流按「组织 × 端点」计数：同一组织下的所有 Admin Key 共享限额，多把 key 不会获得更高配额。超限返回 `429
    rate_limit_exceeded` / `concurrency_limit_exceeded`。


    ## 分页


    分页端点（日/产品账单、请求明细、中断请求、用量聚合、审计日志）使用游标分页：响应携带 `has_more` 与 `next`；将 `next` 作为
    `cursor` 查询参数传回即可翻页。页大小按端点：日/产品账单与用量聚合默认 100、最大 1000；请求明细与中断请求默认 100、最大
    10000；审计日志默认 20、最大 100。游标只携带页位置——翻页时请原样重复全部过滤参数。


    组织集合端点（成员、邀请、项目、项目成员、推理 API 密钥）一次性全量返回，无分页参数。协议之外的查询参数（如
    `page_size`）会被静默忽略，请核对参数名。


    ## 错误格式


    错误响应遵循统一格式：


    ```json

    {
      "error": {
        "type": "invalid_request_error",
        "code": "invalid_date_range",
        "message": "end must be greater than start.",
        "param": "end",
        "request_id": "..."
      }
    }

    ```


    `data_not_ready` 专用于账单类端点的数据就绪规则：T 日数据于 T+1 日 07:00（UTC+8）起可查。


    ## 数据口径


    - 金额单位为毫分（1 元 = 100,000 毫分）。

    - 查询参数中的时间为 epoch 毫秒；响应体中的时间为 RFC 3339（另有说明除外）。

    - 时间窗左闭右开、按 CST 日界；查询参数中的时间为 epoch 毫秒，响应体中的时间为 RFC
    3339（另有说明除外）。按秒传入会返回空数据而非报错，请核对单位为毫秒。

    - 账单数据 T-1 就绪：当日数据次日早 7:00 CST 起可查，之前返回 `400
    data_not_ready`；中断请求明细不受此限（近实时可查）。

    - 数据留存与窗口：日/产品账单留存 365 天；请求明细与中断请求留存 90 天、单次窗口 ≤31 天；审计日志单次窗口 ≤31
    天；用量聚合窗口按粒度分档（`1m` ≤24 小时、`1h` ≤31 天、`1d` ≤93 天）。

    - 每个组织最多同时持有 10 把未删除 Admin Key。
servers:
  - url: https://api.moonshot.cn
    description: 生产环境
security:
  - AdminBearerAuth: []
paths:
  /v1/admin/organizations/billings/interrupted_requests:
    get:
      tags:
        - 对账
      summary: 查询中断请求
      description: >-
        客户端中断请求的增量明细（`finish_reason =
        'client_disconnected'`），按摄入时间正序、近实时可查，适合增量轮询（无 `data_not_ready` 门）。
      operationId: listInterruptedRequestsV2
      parameters:
        - $ref: '#/components/parameters/Start'
        - $ref: '#/components/parameters/End'
        - $ref: '#/components/parameters/ProjectID'
        - $ref: '#/components/parameters/APIKey'
        - name: limit
          in: query
          required: false
          schema:
            type: integer
            minimum: 1
            maximum: 10000
            default: 100
          description: 页大小。交互式查询默认 100；批量拉取可调大（最高 10000）—— 大批量拉取可能增加单页延迟（非 SLA 承诺）。
        - name: cursor
          in: query
          required: false
          schema:
            type: string
          description: >-
            上一次响应 `next` 字段返回的游标。游标只携带页位置；每次翻页都需原样重复全部查询参数（`limit`
            除外），服务端不校验参数一致性。
      responses:
        '200':
          description: 中断请求。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InterruptedRequestsResponseV2'
        '400':
          description: 请求参数错误（时间窗非法/超留存期、枚举非法、limit/cursor 非法）。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BillingErrorResponse'
        '401':
          description: 身份验证失败（Admin API key 无效、已删除/已过期，或 key 持有者已失效）。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BillingErrorResponse'
        '403':
          description: 权限不足（Admin Key 缺少 billing:read 权限域）。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BillingErrorResponse'
        '404':
          description: 资源不存在（组织无数据）。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BillingErrorResponse'
        '429':
          description: 达到速率限制（每分钟请求数超限或并发超限）。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BillingErrorResponse'
        '500':
          description: 服务内部错误（联系支持团队并提供 request_id）。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BillingErrorResponse'
      security:
        - AdminBearerAuth: []
components:
  parameters:
    Start:
      name: start
      in: query
      required: true
      schema:
        type: integer
        format: int64
        minimum: 0
      description: 起始时间（epoch 毫秒），含边界。例如 `1790784000000`（2026-10-01 00:00 CST）。
      example: 1790784000000
    End:
      name: end
      in: query
      required: true
      schema:
        type: integer
        format: int64
        minimum: 0
      description: 结束时间（epoch 毫秒），不含边界。例如 `1792598400000`（2026-10-22 00:00 CST）。
      example: 1792598400000
    ProjectID:
      name: project_id
      in: query
      required: false
      schema:
        type: array
        items:
          type: string
      style: form
      explode: true
      description: 项目 ID 列表。每个项目都必须属于当前认证组织。
    APIKey:
      name: key
      in: query
      required: false
      schema:
        type: array
        items:
          type: string
      style: form
      explode: true
      description: 推理 API 密钥 ID 列表。每个 key 都必须属于当前认证组织。
  schemas:
    InterruptedRequestsResponseV2:
      type: object
      required:
        - data
        - has_more
        - next
      additionalProperties: false
      properties:
        data:
          type: array
          description: 中断请求行（每个客户端断开的请求一行）。
          items:
            $ref: '#/components/schemas/RequestDetailV2'
        has_more:
          type: boolean
          description: 是否还有下一页。
        next:
          type: string
          nullable: true
          description: 下一页游标。翻页时将其原样作为 `cursor` 参数传回。
    BillingErrorResponse:
      type: object
      required:
        - error
      additionalProperties: false
      properties:
        error:
          $ref: '#/components/schemas/BillingErrorBody'
    RequestDetailV2:
      type: object
      required:
        - id
        - time
        - model_id
        - key
        - key_name
        - project_id
        - project_name
        - prompt_tokens
        - completion_tokens
        - cached_tokens
        - is_off_peak
        - off_peak_ratio
        - client_request_id
      additionalProperties: false
      properties:
        id:
          type: string
          description: 请求 ID。
        time:
          type: string
          format: date-time
          description: 请求时间。行按服务端写入时间排序，而非按本字段排序。
        model_id:
          type: string
          description: 模型 ID。
        key:
          type: string
          description: 发起请求的推理 API 密钥 ID。
        key_name:
          type: string
          nullable: true
          description: 推理 API 密钥 名称；未命名为 null。
        project_id:
          type: string
          description: 项目 ID。
        project_name:
          type: string
          nullable: true
          description: 项目名称。
        prompt_tokens:
          type: integer
          format: int64
          minimum: 0
          description: 输入 token 数。
        completion_tokens:
          type: integer
          format: int64
          minimum: 0
          description: 输出 token 数。
        cached_tokens:
          type: integer
          format: int64
          minimum: 0
          description: >-
            缓存命中的输入 token 数（含在 prompt_tokens 内；prompt 计费量 = prompt_tokens −
            cached_tokens。与 cache_write_*（缓存创建量）分开计量，不重复）。
        is_off_peak:
          type: boolean
          description: >-
            请求在其写入时间桶（向下取整到 10
            分钟，Asia/Shanghai）是否命中该组织与该模型生效中的低谷折扣窗口。每行均返回本字段；未命中低谷规则时为 false。
        off_peak_ratio:
          type: string
          nullable: true
          description: >-
            计费比例（price multiplier，`is_off_peak` 为 true 时应用），十进制字符串（例如 "0.3"
            表示收取刊例价的 30%，即优惠 70%）；`is_off_peak` 为 false 时为 null。
        cache_write_5m_tokens:
          type: integer
          format: int64
          minimum: 0
          description: >-
            缓存写入 token 数（5 分钟 TTL 档）。仅当请求的缓存写入按 TTL
            分档计量时返回数值；分档计量上线前的历史请求与未分档的请求不返回该字段（缺省，非 null）。
        cache_write_1h_tokens:
          type: integer
          format: int64
          minimum: 0
          description: >-
            缓存写入 token 数（1 小时 TTL 档）。仅当请求的缓存写入按 TTL
            分档计量时返回数值；分档计量上线前的历史请求与未分档的请求不返回该字段（缺省，非 null）。
        client_request_id:
          type: string
          description: 客户端经 X-Msh-Client-Request-Id 头传入的请求 id（对账精确匹配用）；未传递时为空串。
    BillingErrorBody:
      type: object
      required:
        - type
        - code
        - message
        - request_id
      additionalProperties: false
      properties:
        type:
          type: string
          example: invalid_request_error
        code:
          type: string
          description: 对账域错误码（子集）。
          enum:
            - invalid_request
            - invalid_date_range
            - date_range_too_large
            - date_range_out_of_retention
            - data_not_ready
            - invalid_cursor
            - invalid_api_key
            - api_key_inactive
            - insufficient_scope
            - resource_not_found
            - rate_limit_exceeded
            - concurrency_limit_exceeded
            - internal_server_error
        message:
          type: string
        param:
          type: string
          nullable: true
        request_id:
          type: string
  securitySchemes:
    AdminBearerAuth:
      type: http
      scheme: bearer
      bearerFormat: Admin API Secret (sk-admin-*)
      description: >-
        Authorization 请求头携带 Admin API secret 作为 Bearer 令牌，格式为 `Bearer
        sk-admin-***`。Admin Key 可在「控制台 → 组织管理 → Admin API Keys」创建。

````