The Metering & Billing plugin allows you to meter API requests and AI token usage for usage-based billing for both Kong Gateway on-prem and Konnect deployments. The plugin supports flexible customer identification, custom pricing dimensions, and fine-grained traffic filtering.
If you’re using Kong Gateway on-prem and want to meter traffic, you must use the Metering & Billing plugin.
For Konnect, you can either use the built-in Metering & Billing event ingestion that uses events from Advanced Analytics or use the Metering & Billing plugin.
Event duplication: Do not use both the Metering & Billing plugin and the Konnect built-in event ingestion in Konnect at the same time. This can result in duplicate events.
The following table can help you determine which to use based on your use case:
|
Use case |
Konnect built-in |
Metering & Billing plugin |
|---|---|---|
| How do you want to set up event ingestion? | Enabled with one click in the Konnect UI. | Manual plugin configuration. |
| Who do you want to bill? | Consumer or application. |
Consumer, Consumer Group, application, or any request header (for example, x-customer-id or x-tenant-id).
|
| Do you want to bill based on custom dimensions, like department or priority tier? | Not available. | Yes. Attach any request header or query parameter as a dimension on the event (for example, department, project, priority tier). |
| How do you want to filter traffic for events? | At the Gateway control plane-level only (all Routes and Services in a control plane). | Filter by Route, Service, or header. |
| Are you running a self-managed Kong Gateway? | Not available. | You must use the plugin, the built-in service isn’t available. |