Skip to main content
Reference

Gateway configuration reference

The gateway configuration file controls how keep-llm-gateway proxies LLM API traffic, evaluates policy on decomposed message blocks, and logs audit events. Pass the file path with --config.

Top-level fields

FieldTypeRequiredDefaultDescription
listenstringYesAddress and port to listen on (e.g., ":8080", "127.0.0.1:8080").
rules_dirstringYesPath to the directory containing Keep rule files.
profiles_dirstringNo""Path to the directory containing profile YAML files.
packs_dirstringNo""Path to the directory containing starter pack files.
providerstringYesLLM provider name. Currently accepted: "anthropic".
upstreamstringYesBase URL of the LLM provider API (e.g., "https://api.anthropic.com").
scopestringYesScope name matching a scope declared in your rule files.
decomposeobjectNoSee belowControls which message block types the gateway decomposes for evaluation.
logobjectNoSee belowLog format and output configuration.

decompose

The gateway decomposes LLM requests and responses into individual blocks (tool use, tool result, text, summaries) and evaluates each against Keep rules. The decompose section controls which block types are evaluated.

FieldTypeRequiredDefaultDescription
tool_useboolNotrueEvaluate tool-use blocks in LLM responses.
tool_resultboolNotrueEvaluate tool-result blocks in requests.
textboolNofalseEvaluate text blocks in messages.
request_summaryboolNotrueEvaluate a summary call for each inbound request.
response_summaryboolNotrueEvaluate a summary call for each outbound response.

See LLM decomposition for how the gateway maps message blocks to Keep calls.

log

FieldTypeRequiredDefaultDescription
formatstringNo"json"Log format.
outputstringNo"stdout"Output destination. A file path writes audit logs to that file.

Complete example

listen: ":8080"
rules_dir: "./rules"
profiles_dir: "./profiles"
packs_dir: "./packs"
provider: anthropic
upstream: "https://api.anthropic.com"
scope: anthropic-gateway

decompose:
  tool_use: true
  tool_result: true
  text: false
  request_summary: true
  response_summary: true

log:
  format: json
  output: stdout

This configuration proxies Anthropic API traffic on port 8080. The gateway decomposes tool-use and tool-result blocks for policy evaluation but skips plain text blocks. Audit events are written to stdout in JSON format.