---
title: "Update a AiRequestTransformer plugin"
method: PUT
path: "/plugins/{PluginId}#AiRequestTransformer"
tags: ["Plugins"]
---

# Update a AiRequestTransformer plugin

`PUT /plugins/{PluginId}#AiRequestTransformer`

Update a AiRequestTransformer plugin

## Request body

- CreateAiRequestTransformerPlugin
  - `config` object — The configuration properties for the Plugin which can be found on the plugins documentation page in the [Kong Hub](https://docs.konghq.com/hub/).
    - `http_proxy_host` string — A string representing a host name, such as example.com.
    - `http_proxy_port` integer — An integer representing a port number between 0 and 65535, inclusive.
    - `http_timeout` integer — Timeout in milliseconds for the AI upstream service.
    - `https_proxy_host` string — A string representing a host name, such as example.com.
    - `https_proxy_port` integer — An integer representing a port number between 0 and 65535, inclusive.
    - `https_verify` boolean — Verify the TLS certificate of the AI upstream service.
    - `llm` object
      - `auth` object
        - `allow_override` boolean — If enabled, the authorization header or parameter can be overridden in the request by the value configured in the plugin.
        - `aws_access_key_id` string — Set this if you are using an AWS provider (Bedrock) and you are authenticating using static IAM User credentials. Setting this will override the AWS_ACCESS_KEY_ID environment variable for this plugin instance.
        - `aws_secret_access_key` string — Set this if you are using an AWS provider (Bedrock) and you are authenticating using static IAM User credentials. Setting this will override the AWS_SECRET_ACCESS_KEY environment variable for this plugin instance.
        - `azure_client_id` string — If azure_use_managed_identity is set to true, and you need to use a different user-assigned identity for this LLM instance, set the client ID.
        - `azure_client_secret` string — If azure_use_managed_identity is set to true, and you need to use a different user-assigned identity for this LLM instance, set the client secret.
        - `azure_tenant_id` string — If azure_use_managed_identity is set to true, and you need to use a different user-assigned identity for this LLM instance, set the tenant ID.
        - `azure_use_managed_identity` boolean — Set true to use the Azure Cloud Managed Identity (or user-assigned identity) to authenticate with Azure-provider models.
        - `gcp_service_account_json` string — Set this field to the full JSON of the GCP service account to authenticate, if required. If null (and gcp_use_service_account is true), Kong will attempt to read from environment variable `GCP_SERVICE_ACCOUNT`.
        - `gcp_use_service_account` boolean — Use service account auth for GCP-based providers and models.
        - `header_name` string — If AI model requires authentication via Authorization or API key header, specify its name here.
        - `header_value` string — Specify the full auth header value for 'header_name', for example 'Bearer key' or just 'key'.
        - `param_location` 'query' | 'body' — Specify whether the 'param_name' and 'param_value' options go in a query string, or the POST form/JSON body.
        - `param_name` string — If AI model requires authentication via query parameter, specify its name here.
        - `param_value` string — Specify the full parameter value for 'param_name'.
      - `logging` object
        - `log_payloads` boolean — If enabled, will log the request and response body into the Kong log plugin(s) output.
        - `log_statistics` boolean — If enabled and supported by the driver, will add model usage and token metrics into the Kong log plugin(s) output.
      - `model` object
        - `name` string — Model name to execute.
        - `options` object — Key/value settings for the model
          - `anthropic_version` string — Defines the schema/API version, if using Anthropic provider.
          - `azure_api_version` string — 'api-version' for Azure OpenAI instances.
          - `azure_deployment_id` string — Deployment ID for Azure OpenAI instances.
          - `azure_instance` string — Instance name for Azure OpenAI hosted models.
          - `bedrock` object
            - `aws_region` string — If using AWS providers (Bedrock) you can override the `AWS_REGION` environment variable by setting this option.
          - `gemini` object
            - `api_endpoint` string — If running Gemini on Vertex, specify the regional API endpoint (hostname only).
            - `location_id` string — If running Gemini on Vertex, specify the location ID.
            - `project_id` string — If running Gemini on Vertex, specify the project ID.
          - `input_cost` number — Defines the cost per 1M tokens in your prompt.
          - `llama2_format` 'raw' | 'openai' | 'ollama' — If using llama2 provider, select the upstream message format.
          - `max_tokens` integer — Defines the max_tokens, if using chat or completion models.
          - `mistral_format` 'openai' | 'ollama' — If using mistral provider, select the upstream message format.
          - `output_cost` number — Defines the cost per 1M tokens in the output of the AI.
          - `temperature` number — Defines the matching temperature, if using chat or completion models.
          - `top_k` integer — Defines the top-k most likely tokens, if supported.
          - `top_p` number — Defines the top-p probability mass, if supported.
          - `upstream_path` string — Manually specify or override the AI operation path, used when e.g. using the 'preserve' route_type.
          - `upstream_url` string — Manually specify or override the full URL to the AI operation endpoints, when calling (self-)hosted models, or for running via a private endpoint.
        - `provider` 'openai' | 'azure' | 'anthropic' | 'cohere' | 'mistral' | 'llama2' | 'gemini' | 'bedrock' — AI provider request format - Kong translates requests to and from the specified backend compatible formats.
      - `route_type` 'llm/v1/chat' | 'llm/v1/completions' | 'preserve' — The model's operation implementation, for this provider. Set to `preserve` to pass through without transformation.
    - `max_request_body_size` integer — max allowed body size allowed to be introspected
    - `prompt` string — Use this prompt to tune the LLM system/assistant message for the incoming proxy request (from the client), and what you are expecting in return.
    - `transformation_extract_pattern` string — Defines the regular expression that must match to indicate a successful AI transformation at the request phase. The first match will be set as the outgoing body. If the AI service's response doesn't match this pattern, it is marked as a failure.
  - `created_at` integer — Unix epoch when the resource was created.
  - `enabled` boolean — Whether the plugin is applied.
  - `id` string
  - `instance_name` string
  - `name` 'ai-request-transformer' — The name of the Plugin that's going to be added. Currently, the Plugin must be installed in every Kong instance separately.
  - `ordering` object
    - `after` object
      - `access` string[]
    - `before` object
      - `access` string[]
  - `protocols` string[] — A list of the request protocols that will trigger this plugin. The default value, as well as the possible values allowed on this field, may change depending on the plugin type. For example, plugins that only work in stream mode will only support `"tcp"` and `"tls"`.
  - `tags` string[] — An optional set of strings associated with the Plugin for grouping and filtering.
  - `updated_at` integer — Unix epoch when the resource was last updated.
  - `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 activate regardless of the authenticated Consumer.
    - `id` string
  - `consumer_group` object
    - `id` string
  - `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.
    - `id` string
  - `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.
    - `id` string

## Response `200`

AiRequestTransformer plugin

- AiRequestTransformerPlugin
  - `config` object — The configuration properties for the Plugin which can be found on the plugins documentation page in the [Kong Hub](https://docs.konghq.com/hub/).
    - `http_proxy_host` string — A string representing a host name, such as example.com.
    - `http_proxy_port` integer — An integer representing a port number between 0 and 65535, inclusive.
    - `http_timeout` integer — Timeout in milliseconds for the AI upstream service.
    - `https_proxy_host` string — A string representing a host name, such as example.com.
    - `https_proxy_port` integer — An integer representing a port number between 0 and 65535, inclusive.
    - `https_verify` boolean — Verify the TLS certificate of the AI upstream service.
    - `llm` object
      - `auth` object
        - `allow_override` boolean — If enabled, the authorization header or parameter can be overridden in the request by the value configured in the plugin.
        - `aws_access_key_id` string — Set this if you are using an AWS provider (Bedrock) and you are authenticating using static IAM User credentials. Setting this will override the AWS_ACCESS_KEY_ID environment variable for this plugin instance.
        - `aws_secret_access_key` string — Set this if you are using an AWS provider (Bedrock) and you are authenticating using static IAM User credentials. Setting this will override the AWS_SECRET_ACCESS_KEY environment variable for this plugin instance.
        - `azure_client_id` string — If azure_use_managed_identity is set to true, and you need to use a different user-assigned identity for this LLM instance, set the client ID.
        - `azure_client_secret` string — If azure_use_managed_identity is set to true, and you need to use a different user-assigned identity for this LLM instance, set the client secret.
        - `azure_tenant_id` string — If azure_use_managed_identity is set to true, and you need to use a different user-assigned identity for this LLM instance, set the tenant ID.
        - `azure_use_managed_identity` boolean — Set true to use the Azure Cloud Managed Identity (or user-assigned identity) to authenticate with Azure-provider models.
        - `gcp_service_account_json` string — Set this field to the full JSON of the GCP service account to authenticate, if required. If null (and gcp_use_service_account is true), Kong will attempt to read from environment variable `GCP_SERVICE_ACCOUNT`.
        - `gcp_use_service_account` boolean — Use service account auth for GCP-based providers and models.
        - `header_name` string — If AI model requires authentication via Authorization or API key header, specify its name here.
        - `header_value` string — Specify the full auth header value for 'header_name', for example 'Bearer key' or just 'key'.
        - `param_location` 'query' | 'body' — Specify whether the 'param_name' and 'param_value' options go in a query string, or the POST form/JSON body.
        - `param_name` string — If AI model requires authentication via query parameter, specify its name here.
        - `param_value` string — Specify the full parameter value for 'param_name'.
      - `logging` object
        - `log_payloads` boolean — If enabled, will log the request and response body into the Kong log plugin(s) output.
        - `log_statistics` boolean — If enabled and supported by the driver, will add model usage and token metrics into the Kong log plugin(s) output.
      - `model` object
        - `name` string — Model name to execute.
        - `options` object — Key/value settings for the model
          - `anthropic_version` string — Defines the schema/API version, if using Anthropic provider.
          - `azure_api_version` string — 'api-version' for Azure OpenAI instances.
          - `azure_deployment_id` string — Deployment ID for Azure OpenAI instances.
          - `azure_instance` string — Instance name for Azure OpenAI hosted models.
          - `bedrock` object
            - `aws_region` string — If using AWS providers (Bedrock) you can override the `AWS_REGION` environment variable by setting this option.
          - `gemini` object
            - `api_endpoint` string — If running Gemini on Vertex, specify the regional API endpoint (hostname only).
            - `location_id` string — If running Gemini on Vertex, specify the location ID.
            - `project_id` string — If running Gemini on Vertex, specify the project ID.
          - `input_cost` number — Defines the cost per 1M tokens in your prompt.
          - `llama2_format` 'raw' | 'openai' | 'ollama' — If using llama2 provider, select the upstream message format.
          - `max_tokens` integer — Defines the max_tokens, if using chat or completion models.
          - `mistral_format` 'openai' | 'ollama' — If using mistral provider, select the upstream message format.
          - `output_cost` number — Defines the cost per 1M tokens in the output of the AI.
          - `temperature` number — Defines the matching temperature, if using chat or completion models.
          - `top_k` integer — Defines the top-k most likely tokens, if supported.
          - `top_p` number — Defines the top-p probability mass, if supported.
          - `upstream_path` string — Manually specify or override the AI operation path, used when e.g. using the 'preserve' route_type.
          - `upstream_url` string — Manually specify or override the full URL to the AI operation endpoints, when calling (self-)hosted models, or for running via a private endpoint.
        - `provider` 'openai' | 'azure' | 'anthropic' | 'cohere' | 'mistral' | 'llama2' | 'gemini' | 'bedrock' — AI provider request format - Kong translates requests to and from the specified backend compatible formats.
      - `route_type` 'llm/v1/chat' | 'llm/v1/completions' | 'preserve' — The model's operation implementation, for this provider. Set to `preserve` to pass through without transformation.
    - `max_request_body_size` integer — max allowed body size allowed to be introspected
    - `prompt` string — Use this prompt to tune the LLM system/assistant message for the incoming proxy request (from the client), and what you are expecting in return.
    - `transformation_extract_pattern` string — Defines the regular expression that must match to indicate a successful AI transformation at the request phase. The first match will be set as the outgoing body. If the AI service's response doesn't match this pattern, it is marked as a failure.
  - `created_at` integer — Unix epoch when the resource was created.
  - `enabled` boolean — Whether the plugin is applied.
  - `id` string
  - `instance_name` string
  - `name` 'ai-request-transformer' — The name of the Plugin that's going to be added. Currently, the Plugin must be installed in every Kong instance separately.
  - `ordering` object
    - `after` object
      - `access` string[]
    - `before` object
      - `access` string[]
  - `protocols` string[] — A list of the request protocols that will trigger this plugin. The default value, as well as the possible values allowed on this field, may change depending on the plugin type. For example, plugins that only work in stream mode will only support `"tcp"` and `"tls"`.
  - `tags` string[] — An optional set of strings associated with the Plugin for grouping and filtering.
  - `updated_at` integer — Unix epoch when the resource was last updated.
  - `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 activate regardless of the authenticated Consumer.
    - `id` string
  - `consumer_group` object
    - `id` string
  - `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.
    - `id` string
  - `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.
    - `id` string

## Other responses

- `401` — Unauthorized

## Changes

> 3 revisions in range; 1 not diffed.

- **2024-09-11** `5bd52189d290` — 1 info
  - endpoint added

[Change history](https://skmtc.dev/kong/apis/kong-enterprise-admin-api/changes/plugins/:PluginId#AiRequestTransformer/put.md)

---

[API](https://skmtc.dev/kong/apis/kong-enterprise-admin-api.md) · [All operations](https://skmtc.dev/kong/apis/kong-enterprise-admin-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/kong/kong-enterprise-admin-api/revisions/5bd52189d290/schema)
