usage-events

Report usage events

Changed on

Pre-release Endpoint This endpoint is currently in beta and is subject to change.

Reports usage from AI model calls that didn't pass through the gateway, such as the model calls of an agent tool. Each event is an ai.usage.v1 event without source. The service assigns source as //principals/{uuid} for the reporting principal. If an event includes source, the request fails with 400.

  • The service validates the whole request before it accepts anything. If any event is invalid, the request fails with 400 and no event is accepted.
  • The service responds only after every event is queued for storage. It then stores the events asynchronously. They appear in the event list, where filter[source]=//principals/{uuid} selects them, and they count toward budgets like gateway usage.
  • If the service can't confirm every event in time, the request fails with a server error, and some events may already be accepted. Retrying the same request is safe, because a repeated event collapses into the stored one. The reporting principal's source, the event's id, and its time identify a stored event. A retry that changes id or time stores a second event, and a retry that changes only other data replaces the stored event with whichever copy is stored last.
  • An event that reaches the service more than 1 hour after its time is accepted, and filter[arrival]=late selects it.
post/v1/ai-cost-management/events

Request

  • Base URL
    https://global.api.konghq.com
  • Auth
    • HTTP bearer
    • or HTTP bearer
    • or HTTP bearer
    • or HTTP bearer

Request body

object required
data, object[] required

The usage events to report. Each is an ai.usage.v1 event without source, which the service assigns.

1 to 100 events. Each id can appear only once in the request. Each time is no more than 72 hours before the request arrives and no more than 5 minutes after it.

Response

Every event was accepted for storage. The body lists each event's id and source, in request order.

object required
data, object[] required

The id and source of each accepted event, in request order. Together they identify the event once it's stored.

Changes