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

# 获取会话的每日消耗量

> 获取 organization 内特定会话的每日 ACU 消耗量。

**时区说明**：计费周期以 PST（Pacific Standard Time，太平洋标准时间）午夜
作为每日分界点，对应 UTC 08:00:00。

<Note>
  所有套餐均可使用此组织级端点，包括团队和自助服务套餐。调用者须具备目标组织的 `ViewOrgConsumption` 权限。账户级的[企业消耗端点](/zh/api-reference/v3/consumption/consumption-daily-sessions)仅适用于 **Enterprise** 套餐。
</Note>

<h2 id="product-level-breakdown">
  产品级明细
</h2>

响应中的每个日期条目都包含一个 `acus_by_product` 对象，用于将 ACU 总用量按产品拆分为以下几项：`devin`、`automation`、`cascade`、`terminal` 和 `review` (Devin Review) 。借此，你可以查看每天的用量在各产品间的分布情况。当 `devin`、`cascade` 或 `terminal` 缺少产品级数据时，其值默认为 `0.0`。当 `automation` 和 `review` 缺少对应产品的用量数据时，其值为 `null`。

* `devin`：由用户或服务用户启动的会话，包括代码扫描会话和值班会话。
* `automation`：由[自动化](/zh/product-guides/automations)运行的会话和代码步骤。在此字段推出之前，这部分用量计入 `devin`。

<h2 id="permissions">
  权限
</h2>

需要一个在组织级别拥有 `ViewOrgConsumption` 权限的[服务用户](/zh/api-reference/v3/service-users/members-service-users)或[个人访问令牌](/zh/api-reference/personal-access-tokens)。


## OpenAPI

````yaml zh/v3-openapi.yaml GET /v3/organizations/{org_id}/consumption/daily/sessions/{session_id}
openapi: 3.1.0
info:
  description: 采用 Service User 身份验证和 RBAC 的 Devin v3 API
  title: Devin API v3
  version: 3.0.0
servers: []
security:
  - bearerAuth: []
paths:
  /v3/organizations/{org_id}/consumption/daily/sessions/{session_id}:
    get:
      tags:
        - consumption
      summary: 获取会话的每日消耗量
      description: |-
        获取 organization 内特定会话的每日 ACU 消耗量。

        **时区说明**：计费周期以 PST（Pacific Standard Time，太平洋标准时间）午夜
        作为每日分界点，对应 UTC 08:00:00。
      operationId: >-
        handle_get_session_consumption_daily_v3_organizations__org_id__consumption_daily_sessions__session_id__get
      parameters:
        - description: 会话 ID（前缀：devin-）。在消耗量端点中用作 devin_id 的别名。
          in: path
          name: session_id
          required: true
          schema:
            example: devin-abc123def456
            title: Session Id
            type: string
        - description: 组织 ID（前缀：org-）
          in: path
          name: org_id
          required: true
          schema:
            example: org-abc123def456
            title: Org Id
            type: string
        - in: query
          name: time_before
          required: false
          schema:
            anyOf:
              - type: integer
              - type: 'null'
            title: Time Before
        - in: query
          name: time_after
          required: false
          schema:
            anyOf:
              - type: integer
              - type: 'null'
            title: Time After
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ConsumptionResponse'
          description: 成功响应
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetail'
          description: 未授权
        '403':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetail'
          description: 禁止访问
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetail'
          description: 未找到
        '409':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetail'
          description: 冲突
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetail'
          description: 无法处理的内容
        '429':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetail'
          description: 请求过多
components:
  schemas:
    ConsumptionResponse:
      properties:
        consumption_by_date:
          items:
            $ref: '#/components/schemas/ConsumptionByDateResponse'
          title: Consumption By Date
          type: array
        total_acus:
          title: Total Acus
          type: number
      required:
        - total_acus
        - consumption_by_date
      title: ConsumptionResponse
      type: object
    ProblemDetail:
      description: >-
        v3 API 的 RFC 9457 application/problem+json 错误响应体。


        detail 沿用自旧版 {"detail": ...} 响应体，以保持向后兼容；其他成员字段为新增字段。errors
        包含字段级验证失败信息（仅 422）。
      properties:
        detail:
          anyOf:
            - type: string
            - type: 'null'
          description: 针对此次具体情况的、便于人理解的说明。
          title: Detail
        error_code:
          anyOf:
            - type: string
            - type: 'null'
          description: 因操作被阻止而拒绝请求时返回的机器可读代码（例如 "user_frozen"、"migrated_session"）。
          title: Error Code
        errors:
          anyOf:
            - items:
                additionalProperties: true
                type: object
              type: array
            - type: 'null'
          description: 字段级验证错误（仅适用于 422 响应）。
          title: Errors
        instance:
          anyOf:
            - type: string
            - type: 'null'
          description: 此次出现对应的 URI 引用（请求路径）。
          title: Instance
        status:
          description: HTTP 状态码。
          title: Status
          type: integer
        title:
          description: 对问题类型的简短、便于理解的概述。
          title: Title
          type: string
        type:
          default: about:blank
          description: 用于标识问题类型的 URI 引用。
          title: Type
          type: string
      required:
        - title
        - status
      title: ProblemDetail
      type: object
    ConsumptionByDateResponse:
      properties:
        acus:
          title: Acus
          type: number
        acus_by_product:
          $ref: '#/components/schemas/AcusByProduct'
        date:
          title: Date
          type: integer
      required:
        - date
        - acus
        - acus_by_product
      title: ConsumptionByDateResponse
      type: object
    AcusByProduct:
      description: |-
        一天内各产品的 ACU 用量；各类别用量之和等于当天的 ``acus``。

        ``devin`` 指个人或服务用户启动的 Devin 会话消耗的 ACU，
        包括代码扫描和值班会话。``automation`` 指自动化消耗的 ACU：
        包括自动化启动的会话，以及无需启动会话即可运行的
        代码步骤。无法提供按产品划分的用量时，
        ``automation`` 为 ``null``。
      properties:
        automation:
          anyOf:
            - type: number
            - type: 'null'
          title: Automation
        cascade:
          title: Cascade
          type: number
        devin:
          title: Devin
          type: number
        review:
          anyOf:
            - type: number
            - type: 'null'
          title: Review
        terminal:
          title: Terminal
          type: number
      required:
        - devin
        - cascade
        - terminal
      title: AcusByProduct
      type: object
  securitySchemes:
    bearerAuth:
      description: 服务用户凭据（前缀：cog_）
      scheme: bearer
      type: http

````

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