Kong · Schema

MeteringAndBillingPluginConfig

API GatewayAI GatewayAI ConnectivityAgent GatewayEvent GatewayMCP RegistryService MeshLLMKafkaKonnectOpen Source

Properties

Name Type Description
config object
consumer object If set, the plugin will activate only for requests where the specified has been authenticated. (Note that some plugins can not be restricted to consumers this way.). Leave unset for the plugin to acti
name object
protocols array A set of strings representing protocols.
route object If set, the plugin will only activate when receiving requests via the specified route. Leave unset for the plugin to activate regardless of the route being used.
service object If set, the plugin will only activate when receiving requests via one of the routes belonging to the specified Service. Leave unset for the plugin to activate regardless of the Service being matched.
View JSON Schema on GitHub

JSON Schema

kong-meteringandbillingpluginconfig-schema.json Raw ↑
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "#/components/schemas/MeteringAndBillingPluginConfig",
  "title": "MeteringAndBillingPluginConfig",
  "x-speakeasy-entity": "PluginMeteringAndBilling",
  "properties": {
    "config": {
      "type": "object",
      "properties": {
        "api_token": {
          "description": "Bearer token for authenticating with the ingest endpoint.",
          "type": "string",
          "x-encrypted": true,
          "x-referenceable": true
        },
        "attributes": {
          "description": "Capture custom properties to the usage event data payload for pricing dimensions or reporting. Attributes add dimensions like provider, department or project that your billing model needs for tiered or per-dimension pricing.",
          "type": "array",
          "items": {
            "properties": {
              "event_property_name": {
                "description": "The property name in the usage event data payload.",
                "type": "string"
              },
              "look_up_value_in": {
                "description": "The header name or query parameter that contains the value, e.g 'x-department-id'",
                "type": "string"
              },
              "source": {
                "description": "Where to find this attribute in the request.",
                "type": "string",
                "enum": [
                  "header",
                  "query"
                ]
              }
            },
            "required": [
              "event_property_name",
              "look_up_value_in",
              "source"
            ],
            "type": "object"
          }
        },
        "ingest_endpoint": {
          "description": "The HTTP endpoint where usage events are sent.",
          "type": "string",
          "x-referenceable": true
        },
        "keepalive": {
          "description": "How long in milliseconds an idle connection to the ingest endpoint is kept open before being closed.",
          "type": "number",
          "default": 60000
        },
        "meter_ai_token_usage": {
          "description": "Emit events for LLM input and output tokens on AI Gateway requests.",
          "type": "boolean",
          "default": true
        },
        "meter_api_requests": {
          "description": "Emit a usage event for each API Gateway request.",
          "type": "boolean",
          "default": true
        },
        "queue": {
          "type": "object",
          "properties": {
            "concurrency_limit": {
              "description": "The number of of queue delivery timers. -1 indicates unlimited.",
              "type": "integer",
              "default": 1,
              "enum": [
                -1,
                1
              ]
            },
            "initial_retry_delay": {
              "description": "Time in seconds before the initial retry is made for a failing batch.",
              "type": "number",
              "default": 0.01,
              "maximum": 1000000,
              "minimum": 0.001
            },
            "max_batch_size": {
              "description": "Maximum number of entries that can be processed at a time.",
              "type": "integer",
              "default": 1,
              "maximum": 1000000,
              "minimum": 1
            },
            "max_bytes": {
              "description": "Maximum number of bytes that can be waiting on a queue, requires string content.",
              "type": "integer"
            },
            "max_coalescing_delay": {
              "description": "Maximum number of (fractional) seconds to elapse after the first entry was queued before the queue starts calling the handler.",
              "type": "number",
              "default": 1,
              "maximum": 3600,
              "minimum": 0
            },
            "max_entries": {
              "description": "Maximum number of entries that can be waiting on the queue.",
              "type": "integer",
              "default": 10000,
              "maximum": 1000000,
              "minimum": 1
            },
            "max_retry_delay": {
              "description": "Maximum time in seconds between retries, caps exponential backoff.",
              "type": "number",
              "default": 60,
              "maximum": 1000000,
              "minimum": 0.001
            },
            "max_retry_time": {
              "description": "Time in seconds before the queue gives up calling a failed handler for a batch.",
              "type": "number",
              "default": 60
            }
          }
        },
        "ssl_verify": {
          "description": "Verify the TLS certificate presented by the ingest endpoint.",
          "type": "boolean",
          "default": true
        },
        "subject": {
          "description": "The subject identifies who gets billed for each request. Choose where the plugin should look for the customer identifier.",
          "type": "object",
          "properties": {
            "field": {
              "description": "The header name, query parameter, consumer field, or application field that contains the customer identifier, e.g. 'x-customer-id'",
              "type": "string"
            },
            "look_up_value_in": {
              "description": "Where to find the customer identifier in the request.",
              "type": "string",
              "default": "consumer",
              "enum": [
                "application",
                "consumer",
                "header",
                "query"
              ]
            }
          }
        },
        "timeout": {
          "description": "Maximum time in milliseconds to wait for a response from the ingest endpoint.",
          "type": "number",
          "default": 10000
        }
      },
      "required": [
        "api_token",
        "ingest_endpoint"
      ]
    },
    "consumer": {
      "description": "If set, the plugin will activate only for requests where the specified has been authenticated. (Note that some plugins can not be restricted to consumers this way.). Leave unset for the plugin to activate regardless of the authenticated Consumer.",
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string"
        }
      }
    },
    "name": {
      "const": "metering-and-billing"
    },
    "protocols": {
      "description": "A set of strings representing protocols.",
      "type": "array",
      "items": {
        "description": "A string representing a protocol, such as HTTP or HTTPS.",
        "enum": [
          "grpc",
          "grpcs",
          "http",
          "https",
          "tcp",
          "tls",
          "tls_passthrough",
          "udp",
          "ws",
          "wss"
        ],
        "type": "string"
      },
      "format": "set",
      "default": [
        "grpc",
        "grpcs",
        "http",
        "https"
      ]
    },
    "route": {
      "description": "If set, the plugin will only activate when receiving requests via the specified route. Leave unset for the plugin to activate regardless of the route being used.",
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string"
        }
      }
    },
    "service": {
      "description": "If set, the plugin will only activate when receiving requests via one of the routes belonging to the specified Service. Leave unset for the plugin to activate regardless of the Service being matched.",
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string"
        }
      }
    }
  },
  "required": [
    "config"
  ]
}