AI Model, AI MCP Server, AI Agent, and AI Policy entities need conversion, since each one generates Kong Gateway Services, Routes, or plugins. AI Consumers, AI Consumer Groups, and AI Vaults convert with only field renames (for example, a Consumer’s name becomes username), since they’re already shaped like their native Kong Gateway equivalents.
decK’s file ai2kong, ai sync, and ai dump all translate the same AI Gateway 2.x configuration between its entity-model representation and its self-hosted plugin representation. They don’t change versions, only where the config runs. kongctl convert ai-gateway does something different: it upgrades an older AI Gateway running on Kong Gateway plugin configuration to the 2.x entity model, for Konnect.
|
Command
|
Direction
|
Use case
|
deck file ai2kong
|
AI Gateway 2.x entity file → self-hosted config file
|
Convert an ai.yaml file to a kong.yaml file without touching a live gateway, so you can review the output or apply it separately.
|
deck ai sync
|
AI Gateway 2.x entity file → live self-hosted Kong Gateway
|
Convert and apply in one step. Equivalent to running deck file ai2kong followed by deck gateway sync.
|
deck ai dump
|
Live self-hosted Kong Gateway → AI Gateway 2.x entity file
|
Export configuration previously created with deck ai sync (tagged managed_by:deck-ai) back into the entity model, for backup or review.
|
kongctl convert ai-gateway
|
Pre-2.0 AI Gateway plugin config → AI Gateway 2.x entity file, for Konnect
|
One-time version upgrade: move an existing AI Gateway running on Kong Gateway configuration to a Konnect AI Gateway 2.x control plane. See Migrate to AI Gateway 2.x.
|
The rest of this section uses deck file ai2kong to show exactly what config each entity generates.
Every example that follows uses the same two-step conversion, shown once here. Write your AI Gateway 2.0 entity configuration to ai.yaml, then:
-
Convert it to Kong Gateway 3.x config:
deck file ai2kong --source ai.yaml --output-file kong.yaml
-
Sync the converted config to your self-hosted Kong Gateway:
deck gateway sync kong.yaml
To skip the intermediate file, run deck ai sync ai.yaml instead of both steps.
The following sections show what ai.yaml and the resulting kong.yaml look like for each entity type.
The following AI Model, gpt-5-2, exposes the generate capability on /ai and routes to a single target backed by the openai-prod AI Model Provider:
# ai.yaml (AI Gateway 2.0 entity model)
models:
- name: gpt-5-2
capabilities:
- generate
formats:
- type: openai
config:
route:
paths:
- /ai
model:
body_param: model
values: ["gpt-5.2"]
targets:
- name: gpt-5.2
provider: openai-prod
config:
type: openai
temperature: 1.0
max_tokens: 1024
model_providers:
- name: openai-prod
type: openai
config:
auth:
type: basic
headers:
- name: Authorization
value: "{vault://ai/openai-token}"
Converting it generates a Service, a Route, and an ai-proxy-advanced plugin on that Route:
# kong.yaml (self-hosted Kong Gateway 3.x)
_format_version: "3.0"
_info:
select_tags:
- 'managed_by:deck-ai'
ai_models:
- name: gpt-5-2
plugins:
- config:
body_path: model
max_request_body_size: 8388608
source: body
name: ai-model-selector
route: openai-chat
- config:
balancer:
algorithm: round-robin
genai_category: text/generation
llm_format: openai
targets:
- auth:
header_name: Authorization
header_value: '{vault://ai/openai-token}'
description: gpt-5.2
logging:
log_payloads: false
log_statistics: true
model:
model_alias: 'gpt-5.2'
name: gpt-5.2
options:
max_tokens: 1024
temperature: 1
provider: openai
route_type: llm/v1/chat
model: gpt-5-2
name: ai-proxy-advanced
route: openai-chat
services:
- name: ai-gateway
routes:
- methods:
- POST
name: openai-chat
paths:
- /ai/chat/completions
strip_path: false
url: http://ai-gateway.upstream.local
The AI Model Provider generates no object of its own. Its type becomes the target’s model.provider, and its auth is materialized into the same ai-proxy-advanced target.
The converted output uses the model_alias field name from the self-hosted ai-proxy-advanced plugin schema. This is distinct from config.route.model on the AI Gateway entity shown in the input; deck file ai2kong handles the translation between the two.
The following AI MCP Server, demo-mcp, uses conversion-listener mode to expose a single get-item tool that proxies a REST GET request:
# ai.yaml (AI Gateway 2.0 entity model)
mcp_servers:
- ref: demo-mcp
name: demo-mcp
display_name: "Demo MCP Server"
type: conversion-listener
enabled: true
access:
acl_attribute_type: consumer
config:
url: https://mock.example.com
route:
paths:
- /demo-mcp
tools:
- name: get-item
description: Fetch an item by id
annotations:
title: Fetch an item by id
method: GET
path: /items/{itemId}
parameters:
- name: itemId
in: path
description: The item id
required: true
schema:
type: string
Converting it generates a Service, a Route, and an ai-mcp-proxy plugin carrying the tool definition:
# kong.yaml (self-hosted Kong Gateway 3.x)
_format_version: "3.0"
_info:
select_tags:
- 'managed_by:deck-ai'
services:
- host: localhost
name: demo-mcp
routes:
- name: demo-mcp-route
paths:
- /demo-mcp
plugins:
- config:
acl_attribute_type: consumer
include_consumer_groups: true
logging:
log_audits: false
log_payloads: false
log_statistics: true
mode: conversion-listener
tools:
- annotations:
title: Fetch an item by id
description: Fetch an item by id
method: GET
name: get-item
parameters:
- description: The item id
in: path
name: itemId
required: true
schema:
type: string
path: /items/{itemId}
name: ai-mcp-proxy
The following AI Agent, demo-agent, proxies Agent-to-Agent traffic to an upstream agent:
# ai.yaml (AI Gateway 2.0 entity model)
agents:
- ref: demo-agent
name: demo-agent
type: a2a
display_name: "Demo Agent"
enabled: true
labels:
team: demo
config:
url: https://agent.example.com
route:
paths:
- /agents/demo
logging:
max_payload_size: 524288
Converting it generates a Service, a Route, and an ai-a2a-proxy plugin on that Route:
# kong.yaml (self-hosted Kong Gateway 3.x)
_format_version: "3.0"
_info:
select_tags:
- 'managed_by:deck-ai'
services:
- name: demo-agent
routes:
- name: demo-agent-route
paths:
- /agents/demo
plugins:
- config:
logging:
log_payloads: false
log_statistics: true
max_payload_size: 524288
name: ai-a2a-proxy
tags:
- team:demo
url: https://agent.example.com
An AI Agent with type: http converts the same way, minus the ai-a2a-proxy plugin: just the Service and Route.
An AI Policy generates no object of its own. It must be attached to another entity, such as an AI Model, AI Agent, or AI MCP Server, and converts into the Kong Gateway plugin named by the policy type, scoped to that entity’s Route.
The following ai.yaml defines a minimal chat model, gpt-5-2, with an ai-gw-prompt-guard policy attached:
# ai.yaml (AI Gateway 2.0 entity model)
models:
- name: gpt-5-2
capabilities:
- generate
formats:
- type: openai
config:
route:
paths:
- /ai
model:
body_param: model
values: ["gpt-5.2"]
policies:
- ai-gw-prompt-guard
targets:
- name: gpt-5.2
provider: openai-prod
config:
type: openai
model_providers:
- name: openai-prod
type: openai
config:
auth:
type: basic
headers:
- name: Authorization
value: "{vault://ai/openai-token}"
policies:
- ref: ai-gw-prompt-guard
name: ai-gw-prompt-guard
display_name: "AI Prompt Guard"
type: ai-prompt-guard
enabled: true
config:
deny_patterns:
- ".*(W|w)ar.*"
Converting it generates the same Service, Route, ai-model-selector, and ai-proxy-advanced plugins as converting an AI Model, plus an ai-prompt-guard plugin on the same Route, scoped to the gpt-5-2 model:
# kong.yaml (self-hosted Kong Gateway 3.x)
- config:
deny_patterns:
- .*(W|w)ar.*
model: gpt-5.2
name: ai-prompt-guard
route: openai-chat
The model and route fields on the plugin scope it to that AI Model’s traffic instead of applying globally.