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

# 读取用量汇总

> 返回按 UTC 统计的用量和分组。所有者具有 members.read 权限时 scope 为 workspace，否则为 user。监控读取另受每个所有者每分钟共 240 次限制。



## OpenAPI

````yaml /openapi.cn.json get /v1/manage/usage
openapi: 3.1.0
info:
  title: OmniRelay API
  version: 1.0.0
  description: 面向已核验真实文本模型的兼容 OpenAI 网关。访问按工作空间开通，使用自己的模型列表查询能力与客户价格。
servers:
  - url: https://api.omnirelay.ai
security:
  - bearerAuth: []
tags:
  - name: 服务
  - name: 模型
  - name: 对话
  - name: 管理 API
  - name: 响应
  - name: 向量
  - name: 图片
  - name: 视频
paths:
  /v1/manage/usage:
    get:
      tags:
        - 管理 API
      summary: 读取用量汇总
      description: >-
        返回按 UTC 统计的用量和分组。所有者具有 members.read 权限时 scope 为 workspace，否则为
        user。监控读取另受每个所有者每分钟共 240 次限制。
      operationId: managementReadUsageSummary
      parameters:
        - name: range
          in: query
          schema:
            type: string
            enum:
              - 24h
              - 7d
              - 30d
              - 90d
            default: 7d
        - name: step
          in: query
          schema:
            type: string
            enum:
              - hour
              - day
            default: day
          description: hour 仅适用于 range=24h 或 7d。
        - name: model
          in: query
          schema:
            type: string
        - name: provider
          in: query
          schema:
            type: string
        - name: key
          in: query
          schema:
            type: string
          description: API Key 的 ID，不是密钥正文。
        - name: member
          in: query
          schema:
            type: string
          description: 成员 ID，要求管理密钥所有者具有 members.read 权限。
        - name: tag_key
          in: query
          schema:
            type: string
        - name: tag_value
          in: query
          schema:
            type: string
        - name: tag_group
          in: query
          schema:
            type: string
        - name: status
          in: query
          schema:
            type: string
            enum:
              - ok
              - error
      responses:
        '200':
          description: 请求成功。
          content:
            application/json:
              schema:
                type: object
                properties:
                  range:
                    type: string
                  step:
                    type: string
                  since:
                    type: string
                  until:
                    type: string
                  scope:
                    type: string
                    enum:
                      - user
                      - workspace
                  timezone:
                    type: string
                  totals:
                    $ref: '#/components/schemas/ManagementUsageTotals'
                  previous:
                    $ref: '#/components/schemas/ManagementUsageTotals'
                  series:
                    type: array
                    items:
                      type: object
                      properties: {}
                  groups:
                    type: object
                    properties: {}
                  performance:
                    type: array
                    items:
                      type: object
                      properties: {}
                  options:
                    type: object
                    properties: {}
                  tag_group:
                    type: string
                    nullable: true
        '400':
          description: JSON、输入、标签、模型规则、到期时间或预算规则无效。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: unauthorized 或 management_key_required。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: insufficient_scope 或 forbidden。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: not_found：路径不存在或 Key 不属于调用者。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: rate_limited：每个管理密钥每分钟 120 次，还可能受所有者额外限流约束。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
        - managementAuth: []
components:
  schemas:
    ManagementUsageTotals:
      type: object
      properties:
        attempts:
          type: integer
        errors:
          type: integer
        input:
          type: integer
        output:
          type: integer
        cost:
          type: integer
    Error:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          required:
            - code
            - message
            - type
          properties:
            code:
              type: string
              example: model_unavailable
            message:
              type: string
              example: The model does not exist or is disabled.
              description: 用于日志和 SDK 异常的简短英文说明；措辞可能调整，请按 code 判断。
            type:
              type: string
              example: not_found_error
              description: >-
                按 HTTP
                状态划分的错误类别：invalid_request_error、authentication_error、insufficient_quota、permission_error、not_found_error、conflict_error、rate_limit_error、service_unavailable
                或 api_error。
            param:
              type: string
              maxLength: 200
              description: 可识别时返回被拒绝的请求字段路径，不包含参数值；Responses 使用原生字段名。
        request_id:
          type: string
          description: 在对话补全、Responses 和 Embeddings 出错时返回。
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: 在 OmniRelay 控制台创建的 API Key。所有者确认身份后可在控制台再次查看。
    managementAuth:
      type: http
      scheme: bearer
      description: 在控制台创建的管理密钥；read 可读取，write 还可修改 API Key。不接受推理 API Key。

````

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