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

# 上报计费事件

> Report a billable event. Profy charges the user's credits based on the meter pricing configured in Studio.



## OpenAPI

````yaml POST /openapi/v1/events
openapi: 3.0.0
info:
  title: Profy App API
  version: 1.0.0
  description: OAuth 2.0 and Events API for Profy App integrations.
servers:
  - url: https://app.profy.cn
    description: Production
security: []
paths:
  /openapi/v1/events:
    post:
      tags:
        - Events
      summary: Report custom billing event (PER_USE)
      description: >-
        Report a billable event. Profy charges the user's credits based on the
        meter pricing configured in Studio.
      operationId: postCustomEvent
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                event:
                  type: string
                  maxLength: 100
                  example: generate_report
                  description: Event name matching a configured billing meter
                idempotency_key:
                  type: string
                  maxLength: 128
                  example: order-12345
                  description: Prevents duplicate charges
                metadata:
                  type: object
                  additionalProperties:
                    type: string
                  description: Arbitrary key-value pairs for tracking
              required:
                - event
                - idempotency_key
      responses:
        '200':
          description: Event processed successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  charged:
                    type: number
                  balance_remaining:
                    type: number
                  idempotent_replay:
                    type: boolean
                required:
                  - charged
                  - balance_remaining
        '400':
          description: Invalid request or unknown event
        '401':
          description: OAuth token required
        '402':
          description: Insufficient balance
        '429':
          description: Daily spending limit exceeded
      security:
        - Bearer: []
components:
  securitySchemes:
    Bearer:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: OAuth2 access token issued via POST /oauth/token

````