Skip to content

feat(ai-gateway): Request Tranformer + Request Tranformer Advanced policy overviews - #7275

Open
lmilan wants to merge 2 commits into
mainfrom
feat/requst-transformer-policies
Open

lmilan wants to merge 2 commits into
mainfrom
feat/requst-transformer-policies

Conversation

@lmilan

@lmilan lmilan commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

Description

Fixes #6406
Fixes #6407

Preview Links

Checklist

  • Tested how-to docs. If not, note why here.
  • All pages contain metadata.
  • Any new docs link to existing docs.
  • All autogenerated instructions render correctly (API, decK, Konnect, Kong Manager).
  • Style guide (capitalized gateway entities, placeholder URLs) implemented correctly.
  • Every page has a description entry in frontmatter.
  • Add new pages to the product documentation index (if applicable).

@lmilan lmilan self-assigned this Sep 17, 2026
@netlify

netlify Bot commented Sep 17, 2026

Copy link
Copy Markdown

Deploy Preview for kongdeveloper ready!

Name Link
🔨 Latest commit ec9af3d
🔍 Latest deploy log https://app.netlify.com/projects/kongdeveloper/deploys/6aabf968a95af20008621ba2
😎 Deploy Preview https://deploy-preview-7275--kongdeveloper.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@lmilan
lmilan marked this pull request as ready for review September 17, 2026 14:30
@lmilan
lmilan requested a review from a team as a code owner September 17, 2026 14:30

@cloudjumpercat cloudjumpercat left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just some nitpicks!

@@ -1,9 +1,74 @@
---
description: Use powerful regular expressions, variables, and templates to transform API requests

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
description: Use powerful regular expressions, variables, and templates to transform API requests

descriptions, tags, categories are already autogenerated from the plugin source

Image

Comment on lines +10 to +13
tags:
- transformations
categories:
- transformations

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
tags:
- transformations
categories:
- transformations

@@ -0,0 +1,8 @@
This Policy lets you configure simple transformations of requests before {{site.ai_gateway}} forwards them to the upstream provider. These transformations can be simple substitutions or complex ones matching portions of incoming requests using regular expressions, saving those matched strings into variables, and substituting those strings into transformed requests using flexible templates.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
This Policy lets you configure simple transformations of requests before {{site.ai_gateway}} forwards them to the upstream provider. These transformations can be simple substitutions or complex ones matching portions of incoming requests using regular expressions, saving those matched strings into variables, and substituting those strings into transformed requests using flexible templates.
This Policy lets you configure transformations of requests before {{site.ai_gateway}} forwards them to the upstream provider.
These transformations can be simple substitutions or complex ones.
For example, complex transformations can match portions of incoming requests using regular expressions, save those matched strings into variables, and substitute those strings into transformed requests using flexible templates.

@@ -0,0 +1,8 @@
This Policy lets you configure simple transformations of requests before {{site.ai_gateway}} forwards them to the upstream provider. These transformations can be simple substitutions or complex ones matching portions of incoming requests using regular expressions, saving those matched strings into variables, and substituting those strings into transformed requests using flexible templates.

This Policy operates on the raw HTTP request only: headers, query string, and body fields. To transform a request based on its meaning, using an LLM (for example, rewriting a prompt), use the [AI Request Transformer Policy](/ai-gateway/policies/ai-request-transformer/) instead.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
This Policy operates on the raw HTTP request only: headers, query string, and body fields. To transform a request based on its meaning, using an LLM (for example, rewriting a prompt), use the [AI Request Transformer Policy](/ai-gateway/policies/ai-request-transformer/) instead.
This Policy operates on the raw HTTP request only: headers, query string, and body fields. To transform a request based on its meaning using an LLM (for example, rewriting a prompt), use the [AI Request Transformer Policy](/ai-gateway/policies/ai-request-transformer/) instead.


{% include md/ai-gateway/v2/policies/request-response-transformer/templates.md %}

## Example

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
## Example
## Example: Remove Anthropic-specific beta fields


{% include md/ai-gateway/v2/policies/request-response-transformer/request-transformer-description.md %}

The Request Transformer Advanced Policy provides features that aren't available in the [Request Transformer Policy](/ai-gateway/policies/request-transformer/), including the ability to limit the list of allowed parameters in the request body with the [config.allow.body](./reference/#schema--config-allow-body) parameter.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The Request Transformer Advanced Policy provides features that aren't available in the [Request Transformer Policy](/ai-gateway/policies/request-transformer/), including the ability to limit the list of allowed parameters in the request body with the [config.allow.body](./reference/#schema--config-allow-body) parameter.
The Request Transformer Advanced Policy provides features that aren't available in the [Request Transformer Policy](/ai-gateway/policies/request-transformer/), including the ability to limit the list of allowed parameters in the request body with the [`config.allow.body`](./reference/#schema--config-allow-body) parameter.


Body transformations are only performed for requests where the `Content-Type` header is set to `application/json`.

## Example

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
## Example
## Example: Define JSON fields a client can send and move query parameters

1. [Rename](./reference/#schema--config-rename)
1. [Replace](./reference/#schema--config-replace)
1. [Add](./reference/#schema--config-add)
1. [Append](./reference/#schema--config-append)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
1. [Append](./reference/#schema--config-append)
1. [Append](./reference/#schema--config-append)
1. [Allow](./reference/#schema--config-allow)

Learned this from Hal https://kongstrong.slack.com/archives/C0B913DUBLP/p1789766639575629?thread_ts=1789766632.370589&cid=C0B913DUBLP

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add an overview page for the Request Transformer Advanced policy Add an overview page for the Request Transformer policy

2 participants