AI 프롬프트 압축기 정책 설정 레퍼런스
AI 프롬프트 압축기 정책 설정 레퍼런스 (AI Prompt Compressor Policy Configuration Reference)
이 문서는 AI Gateway에서 프롬프트를 압축해 토큰 사용량을 줄여 주는 AI Prompt Compressor 정책의 설정 항목을 스키마 형태로 정리한 참고 자료예요. provider 항목으로 Kong 기본 압축 서비스와 Headroom 백엔드 중 하나를 선택하는 방법과, Headroom 사용 시 필요한 프록시 토큰이나 세션 식별 헤더 같은 전용 옵션을 설명해 줘요. 타임아웃처럼 두 백엔드가 공유하는 공통 설정이 어떻게 동작하는지도 함께 확인할 수 있어요
출처: 문서
본문
{
"properties": {
"config": {
"type": "object",
"properties": {
"provider": {
"type": "string",
"enum": [
"headroom",
"kong"
],
"description": "Which compression backend the policy talks to. 'kong' (default) is the Kong compressor service driven by 'compressor_type' and 'compression_ranges'; 'headroom' is a Headroom instance that decides the compression itself. Connection settings ('compressor_url', 'timeout', 'keepalive_timeout', 'stop_on_error', 'log_text_data', 'proxy_config') are shared by both. A field that does not apply to the selected provider is ignored, with a warning in the error log.",
"default": "kong"
},
"headroom": {
"type": "object",
"properties": {
"proxy_token": {
"type": "string",
"description": "HEADROOM_PROXY_TOKEN, sent both as `X-Headroom-Proxy-Token` and as `Authorization: Bearer`. Required unless `compressor_url` is a loopback address (localhost, 127.0.0.0/8, ::1). A wrong token surfaces as 401.",
"x-encrypted": true,
"x-referenceable": true
},
"ssl_verify": {
"type": "boolean",
"description": "Verify TLS certificate of the Headroom endpoint (for https endpoints).",
"default": true
},
"session_id_headers": {
"type": "array",
"items": {
"type": "string"
},
"description": "Names of request headers that identify the conversation. Every configured header present on the request goes into the session id, concatenated in order, so several ids narrow the session instead of replacing it. Use headers that stay stable across turns: one that rotates per request stops the cache from hitting, and a caller id (installation, machine) collapses that caller's conversations onto one session. An empty array derives the id from the content.",
"default": [
"session-id",
"thread-id",
"x-claude-code-agent-id",
"x-claude-code-session-id",
"x-session-id"
]
}
},
"description": "Headroom-specific settings, read only when `provider` is `headroom`. Point the policy-wide `compressor_url` at the Headroom `/v1/compress` endpoint, and keep the policy-wide `timeout` above the Headroom-side turn lock plus compression timeout. Headroom keeps its sessions in memory on one process, so point Kong at a single instance and not at a load-balanced set.",
"default": {}
},
"timeout": {
"type": "number",
"description": "Connection timeout with the compressor",
"default": 10000
},
"stop_on_error": {
"type": "boolean",
"description": "Stop processing if an error occurs",
"default": true
},
"message_type": {
"type": "array",
"items": {
"type": "string",
"enum": [
"assistant",
"system",
"user"
]
},
"default": [
"user"
]
},
"compressor_type": {
"type": "string",
"enum": [
"rate",
"target_token"
],
"description": "What compression type to use to compress with",
"default": "rate"
},
"proxy_config": {
"type": "object",
"properties": {
"proxy_scheme": {
"type": "string",
"enum": [
"http"
],
"description": "The proxy scheme to use when connecting. Only `http` is supported.",
"default": "http"
},
"auth_username": {
"type": "string",
"description": "The username to authenticate with, if the forward proxy is protected by basic authentication.",
"x-referenceable": true
},
"auth_password": {
"type": "string",
"description": "The password to authenticate with, if the forward proxy is protected by basic authentication.",
"x-referenceable": true,
"x-encrypted": true
},
"no_proxy": {
"type": "string",
"description": "Comma-separated list of hosts that should not be proxied."
},
"http_proxy_host": {
"type": "string",
"description": "A string representing a host name, such as example.com."
},
"http_proxy_port": {
"type": "integer",
"maximum": 65535,
"minimum": 0,
"description": "An integer representing a port number between 0 and 65535, inclusive."
},
"https_proxy_host": {
"type": "string",
"description": "A string representing a host name, such as example.com."
},
"https_proxy_port": {
"type": "integer",
"maximum": 65535,
"minimum": 0,
"description": "An integer representing a port number between 0 and 65535, inclusive."
}
}
},
"compression_ranges": {
"type": "array",
"items": {
"type": "object",
"properties": {
"min_tokens": {
"type": "integer"
},
"max_tokens": {
"type": "integer"
},
"value": {
"type": "number"
}
},
"required": [
"max_tokens",
"min_tokens",
"value"
]
},
"description": "What value to be used to compress with. The 'value' is interpreted as rate or target_token depending on compressor_type. Required when 'provider' is 'kong', ignored otherwise."
},
"compressor_url": {
"type": "string",
"description": "The url of the compressor",
"default": "http://localhost:8080"
},
"keepalive_timeout": {
"type": "number",
"description": "The keepalive timeout for the established http connnection",
"default": 60000
},
"log_text_data": {
"type": "boolean",
"description": "Log the text data",
"default": false
}
}
}
}
}
관련 리소스
더 알아보기 (Learn more)
- 이 정책 설정이 담기는 AI Policy 엔티티의 전체 구조를 이해할 수 있어요 — AI Policy entity
- 프롬프트 압축으로 줄어든 토큰 비용을 관리하는 방법을 살펴 볼 수 있어요 — Model cost management
- 함께 쓸 수 있는 또 다른 AI 게이트웨이 정책의 설정을 참고할 수 있어요 — AI RAG Injector Policy
- 외부 압축 서비스와 연결할 때 포워드 프록시 설정 방법을 알 수 있어요 — Forward proxy support