attribution-plugins

Install or replace an attribution plugin

Changed on

Installs the latest attribution plugin version on an AI Gateway with this configuration, or replaces the installed plugin and its configuration, and returns the installation.

  • The plugin becomes a streaming custom policy named ai-cost-attribution and a global policy that turns it on. The request writes both through the AI Gateway API as the caller, so the caller also needs the AI Gateways Admin role on the gateway.
  • Every request installs the latest version, so a PUT of the stored configuration updates an outdated installation.
  • The plugin tags requests only on data planes that run AI Gateway 2.3 or later. Each data plane must run with KONG_CUSTOM_PLUGIN_STREAMING_ENABLED=on. A data plane with streaming off refuses the gateway's whole configuration while the plugin is installed.
  • If the gateway doesn't have the plugin yet and a data plane the AI Gateway API lists reports streaming off, or doesn't report the setting because it runs an older release, the request fails with 409, names those data planes, and changes nothing. The API lists a data plane for five minutes after its last ping, so a data plane replaced in that time can still be named. A data plane that connects later isn't checked, and neither is a gateway that already has the plugin.
  • If the request fails partway, repeating it finishes the installation.
  • If the body is invalid, the request fails with 400. A header mapping that names a credential header, or repeats a header or tag key, counts as invalid.
  • If the gateway already has a custom policy or policy of this name that this product didn't install, the request fails with 409 and changes nothing.
  • If another change to the gateway's plugin is running, the request fails with 409 and changes nothing. Repeat it once that change has finished.
put/v1/ai-cost-management/ai-gateways/{gatewayId}/attribution-plugin

Request

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

Path parameters

gatewayIdstring uuid required

The ID of the AI Gateway.

Request body

integrationsAICostAttributionPluginIntegration[] required

The integrations whose headers the plugin reads. Any other tool's headers are ignored.

operator_tagsobject

Tags the plugin adds to every request, as a map of tag key to value. A key has at most 128 characters: lowercase letters and digits in words joined by single hyphens.

group_patternsstring[]

PCRE regular expressions that choose which groups the plugin keeps from the caller's token. A group is kept when any pattern matches its name, case-insensitively and anywhere in the name unless the pattern anchors itself. An empty list keeps every group, and each pattern appears once.

Response

The installation after the replacement.

gateway_idstring uuid required

The ID of the AI Gateway the plugin is installed on.

versionstring required

The plugin version installed on the gateway.

latest_versionstring required

The newest plugin version. When it differs from version, a PUT of the stored configuration installs it.

integrationsAICostAttributionPluginIntegration[] required

The integrations whose headers the plugin reads.

operator_tagsobject required

Tags the plugin adds to every request.

group_patternsstring[] required

PCRE regular expressions that choose which groups the plugin keeps from the caller's token.

created_atstring date-time required

An ISO-8601 timestamp representation of entity creation date.

updated_atstring date-time required

An ISO-8601 timestamp representation of entity update date.

Example response

{
  "created_at": "2022-11-04T20:10:06.927Z",
  "updated_at": "2022-11-04T20:10:06.927Z"
}

Changes