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

# 查询日账单

> 日账单（每自然日一行；project_id/key 为过滤维度；模型 × 计费项 × key 拆分见嵌套 model_details），游标分页（`has_more`/`next`）。金额为毫分；T 日数据于 T+1 日 07:00（UTC+8）起可查；此前返回 `400 data_not_ready`。

> [!NOTE]
>
> 本接口要求 Admin Key 具备 `billing:read` 作用域。

> [!NOTE]
>
> 就绪与金额口径：T 日数据于 T+1 日 07:00（UTC+8）起可查；此前返回 `400 data_not_ready`。金额分列为现金（`recharge_fee`）与代金券（`voucher_fee`）两部分，合计为 `total_fee`（实收金额）。时间窗左闭右开、按 CST 日界。


## OpenAPI

````yaml GET /v1/admin/organizations/billings/daily_bills
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/daily_bills:
    get:
      tags:
        - 对账
      summary: 查询日账单
      description: >-
        日账单（每自然日一行；project_id/key 为过滤维度；模型 × 计费项 × key 拆分见嵌套
        model_details），游标分页（`has_more`/`next`）。金额为毫分；T 日数据于 T+1 日
        07:00（UTC+8）起可查；此前返回 `400 data_not_ready`。
      operationId: listDailyBillsV2
      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: 1000
            default: 100
          description: 页大小。默认 100，最大 1000。行数受请求的时间窗口限制，每个自然日一行，通常一页即可覆盖整个窗口。
        - name: cursor
          in: query
          required: false
          schema:
            type: string
          description: >-
            上一次响应 `next` 字段返回的游标。游标只携带页位置；每次翻页都需原样重复全部查询参数（`limit`
            除外），服务端不校验参数一致性。
      responses:
        '200':
          description: 日账单。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DailyBillsResponseV2'
        '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:
    DailyBillsResponseV2:
      type: object
      required:
        - data
        - has_more
        - next
      additionalProperties: false
      properties:
        data:
          type: array
          description: 日账单行（每自然日一行；模型 × 计费项 × key 拆分见 model_details）。
          items:
            $ref: '#/components/schemas/DailyBillV2'
        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'
    DailyBillV2:
      type: object
      required:
        - date
        - total_fee
        - recharge_fee
        - voucher_fee
        - model_details
      additionalProperties: false
      properties:
        date:
          type: string
          example: '2026-06-30'
          description: 账单日期（自然日）。
        total_fee:
          type: integer
          format: int64
          minimum: 0
          description: 总费用（毫分）。
        recharge_fee:
          type: integer
          format: int64
          minimum: 0
          description: 充值账户扣费（毫分）。
        voucher_fee:
          type: integer
          format: int64
          minimum: 0
          description: 代金券账户扣费（毫分）。
        model_details:
          type: array
          description: >-
            当日按模型 × token 计费项 × API key 拆分的明细，按 model_id → token_type → key
            排序。只含 token 计费项； cache-call、tool_call、cache storage 等非 token 费用与
            BatchAPI 等业务类型费用只计入外层汇总，故外层 total_fee − 明细费用合计 =
            上述其他费用。无模型推理消费时返回空数组 []。
          items:
            $ref: '#/components/schemas/DailyBillModelDetailV2'
    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
    DailyBillModelDetailV2:
      type: object
      required:
        - model_id
        - token_type
        - tokens
        - key
        - total_fee
        - recharge_fee
        - voucher_fee
      additionalProperties: false
      properties:
        model_id:
          type: string
          example: kimi-k2.6
          description: 模型 ID。
        token_type:
          type: string
          enum:
            - prompt
            - completion
            - auto-caching
            - cache-write-5m
            - cache-write-1h
          description: token 计费项，与底层产品同名。未来新增 token 计费类型会扩展本枚举。
        tokens:
          type: integer
          format: int64
          description: 本计费项的计费 token 数。prompt 不含缓存命中 token； auto-caching 为缓存命中 token 数。
        key:
          type: string
          description: 推理 API 密钥 ID。
        total_fee:
          type: integer
          format: int64
          minimum: 0
          description: 本行合计费用（毫分；= recharge_fee + voucher_fee）。
        recharge_fee:
          type: integer
          format: int64
          minimum: 0
          description: 现金账户扣减（毫分）。
        voucher_fee:
          type: integer
          format: int64
          minimum: 0
          description: 代金券账户扣减（毫分）。
  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」创建。

````