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

# call統計



## OpenAPI

````yaml /ja/weave/reference/service-api/openapi.json post /calls/stats
openapi: 3.1.0
info:
  title: FastAPI
  version: 0.1.0
servers: []
security: []
paths:
  /calls/stats:
    post:
      tags:
        - Calls
      summary: call統計
      operationId: call_stats_calls_stats_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CallStatsReq'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CallStatsRes'
          description: 正常なレスポンス
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
          description: 検証エラー
      security:
        - HTTPBasic: []
        - HTTPBearer: []
components:
  schemas:
    CallStatsReq:
      additionalProperties: false
      description: 一定期間における集計済みcall統計のリクエスト。
      properties:
        call_metrics:
          anyOf:
            - items:
                $ref: '#/components/schemas/CallMetricSpec'
              type: array
            - type: 'null'
          description: 計算するcallレベルのメトリクス（レイテンシ、件数）。Timestampごとにのみグループ化されます。
          title: Call Metrics
        end:
          anyOf:
            - format: date-time
              type: string
            - type: 'null'
          description: 終了時刻（この時刻は含まない）（UTC、ISO 8601）。省略した場合は現在時刻がデフォルトです。
          title: End
        filter:
          anyOf:
            - $ref: '#/components/schemas/CallsFilter'
            - type: 'null'
        granularity:
          anyOf:
            - type: integer
            - type: 'null'
          description: >-
            bucketサイズ（秒単位）（例:
            1時間の場合は3600）。省略した場合は、期間に基づいて自動的に選択されます。10,000個を超えるbucketが生成される場合は調整されます。
          title: Granularity
        project_id:
          title: Project Id
          type: string
        start:
          description: 開始時刻（この時刻を含む）（UTC、ISO 8601）。
          format: date-time
          title: Start
          type: string
        timezone:
          default: UTC
          description: 'bucketの整列に使用するIANAタイムゾーン（例: ''America/New_York''）'
          title: Timezone
          type: string
        usage_metrics:
          anyOf:
            - items:
                $ref: '#/components/schemas/UsageMetricSpec'
              type: array
            - type: 'null'
          description: 計算するUsageメトリクス（トークン、コスト）。Timestampとモデルごとにグループ化されます。
          title: Usage Metrics
      required:
        - project_id
        - start
      title: CallStatsReq
      type: object
    CallStatsRes:
      description: 時系列のcall統計を含むレスポンス。
      properties:
        call_buckets:
          default: []
          description: callレベルのメトリクス。各bucketには 'timestamp' と集計済みメトリクス値が含まれます。
          items:
            additionalProperties: true
            type: object
          title: Call Buckets
          type: array
        end:
          description: 解決後の終了時刻（UTC）
          format: date-time
          title: End
          type: string
        granularity:
          description: 使用されたbucketサイズ（秒単位）
          title: Granularity
          type: integer
        start:
          description: 解決後の開始時刻（UTC）
          format: date-time
          title: Start
          type: string
        timezone:
          description: bucketの整列に使用されたタイムゾーン
          title: Timezone
          type: string
        usage_buckets:
          default: []
          description: モデルごとのUsageメトリクス。各bucketには 'timestamp'、'model'、および集計済みメトリクス値が含まれます。
          items:
            additionalProperties: true
            type: object
          title: Usage Buckets
          type: array
      required:
        - start
        - end
        - granularity
        - timezone
      title: CallStatsRes
      type: object
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          title: Detail
          type: array
      title: HTTPValidationError
      type: object
    CallMetricSpec:
      additionalProperties: false
      description: 集計対象のcallレベルのメトリクスの仕様（モデルごとにはグループ化しない）。
      properties:
        aggregations:
          default:
            - sum
          description: 適用する基本的な集計関数
          items:
            $ref: '#/components/schemas/AggregationType'
          title: Aggregations
          type: array
        metric:
          description: 集計するメトリクス。
          enum:
            - latency_ms
            - call_count
            - error_count
          title: Metric
          type: string
        percentiles:
          default: []
          description: '計算するパーセンタイル値（0～100）。例: p50、p95、p99 の場合は [50, 95, 99]'
          items:
            type: number
          title: Percentiles
          type: array
      required:
        - metric
      title: CallMetricSpec
      type: object
    CallsFilter:
      additionalProperties: false
      properties:
        call_ids:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Call Ids
        input_refs:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Input Refs
        op_names:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Op Names
        output_refs:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Output Refs
        parent_ids:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Parent Ids
        thread_ids:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Thread Ids
        trace_ids:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Trace Ids
        trace_roots_only:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Trace Roots Only
        turn_ids:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Turn Ids
        wb_run_ids:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Wb Run Ids
        wb_user_ids:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Wb User Ids
      title: CallsFilter
      type: object
    UsageMetricSpec:
      additionalProperties: false
      description: 集約する使用量メトリクスの仕様（モデルごとにグループ化）。
      properties:
        aggregations:
          default:
            - sum
          description: 適用する基本的な集約関数
          items:
            $ref: '#/components/schemas/AggregationType'
          title: Aggregations
          type: array
        metric:
          description: 集約するメトリクス。token メトリクスはプロバイダー間で正規化されます。
          enum:
            - input_tokens
            - output_tokens
            - total_tokens
            - cache_read_input_tokens
            - cache_creation_input_tokens
            - input_cost
            - output_cost
            - total_cost
          title: Metric
          type: string
        percentiles:
          default: []
          description: '計算するパーセンタイル値（0～100）。例: p50、p95、p99 の場合は [50, 95, 99]'
          items:
            type: number
          title: Percentiles
          type: array
      required:
        - metric
      title: UsageMetricSpec
      type: object
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          title: Location
          type: array
        msg:
          title: Message
          type: string
        type:
          title: Error Type
          type: string
      required:
        - loc
        - msg
        - type
      title: ValidationError
      type: object
    AggregationType:
      description: フィードバックおよび Call 統計メトリクスでサポートされる集約関数。
      enum:
        - sum
        - avg
        - min
        - max
        - count
        - count_true
        - count_false
      title: AggregationType
      type: string
  securitySchemes:
    HTTPBasic:
      scheme: basic
      type: http
    HTTPBearer:
      scheme: bearer
      type: http

````