Skip to content

Integeration with Kong API Gateway

About This Guide

This guide provides step-by-step instructions for integrating a custom Kong Gateway plugin into your existing Kong infrastructure. Whether you're setting up Kong Gateway for the first time or incorporating a new plugin into your current setup, this guide will assist you through the process.

Prerequisites

  • LLMInspect installed and configured on your system. If not installed, follow our Installation Guide
  • Kong API Gateway plugin ZIP file (provided by our team)

Installing the plugin

This guide focuses on installing the plugin in Kong Gateway API deployed using Docker / Docker Compose. If your deployment is not using Docker / Docker Compose refer to Kong's official documentation on how to install custom plugins in your deployment style Kong Custom Plugins

1. Plugin Setup

  1. Extract the installation media provided by EUNOMATIX support.

  2. Add the following environment variables to your Docker Compose file or Docker container configuration:

environment:
  KONG_LUA_PACKAGE_PATH: /tmp/custom_plugins/?.lua;;
  KONG_PLUGINS: bundled,kong-plugin-http-mirror
  1. Add the following volume mount to your Docker configuration:
volumes:
  - /path/to/extracted/plugin:/tmp/custom_plugins/kong/plugins/kong-plugin-http-mirror

Important: The mount path must match the KONG_LUA_PACKAGE_PATH setting. If you change the path in the environment variable, update the mount path accordingly.

2. Deploy Changes

  1. Restart your Kong API Gateway Docker deployment

  2. Verify Kong is running without errors:

docker logs <container-id>

3. Plugin Activation

Activate the plugin using Kong's Admin API:

Adjust the curl request according to your environment:

curl -X POST http://127.0.0.1:8001/plugins/ \
  --data "name=kong-plugin-http-mirror" \
  --data "config.mirror_request_body=true" \
  --data "config.mirror_endpoints=http://1.23.456.789:8088"

Configuration Parameters

Parameter Description
name Plugin name (must be kong-plugin-http-mirror)
config.mirror_request_body Enable/disable request body mirroring
config.mirror_endpoints Target endpoint(s) for mirrored requests

Put the LLMInspect endpoint(s) for mirrored requests so Kong API Gateway forward requests to LLMInspect which can inspect the request.

If you have installed on LLMInspect on a different machine, your config.mirror_endpoints will become https:/ip-of-llminspect:8116/v1/chat/completions

By default LLMInspect is listening on port 8116 and /v1/chat/completions is the route for inspecting the requests.

Make sure the Kong API Gateway can communicate with the LLMInspect deployment.

NOTE The plugin mirrors requests from inside the container ao Kong API Gateway's container should be able to ping / communicate with the LLMInspect's APISIX (running on port 8116).

4. Verification

  1. Check Kong Manager GUI:

  2. Navigate to: Workspace → Plugins → Installed Plugins

  3. Verify the plugin is enabled

  4. Confirm mirror request body is set to true

  5. Plugin settings can be modified through the GUI using the three-dot menu

Plugin Configuration Modes

Global Mode

  • Mirrors all requests hitting the Kong API Gateway

  • Recommended for comprehensive monitoring

Scoped Mode

  • Mirrors requests only for specific services/routes

  • Configuration requirements:

  • Gateway Service: Name of the target service

  • Route: Specific route name

Recommendation: Use Kong Manager GUI for easier plugin configuration and management.

Kong Plugin configuration

Support

For additional support or troubleshooting, please contact our support team or refer to the documentation.

Further Reading

If your Kong Gateway is not deployed using Docker Compose, refer to the official documentation for installation of custom plusings in alternative deployment methods:

For comprehensive details on plugin distribution and installation, consult the Kong Plugin Development Guide.