# Validates Anthropic Messages JSON envelopes before forwarding
#
# Rejects empty, malformed, or non-object JSON request bodies.
# Anthropic API semantics such as required fields and parameter
# ranges are left to the inference backend.

listeners:
  - name: anthropic-gateway
    address: "127.0.0.1:8080"
    filter_chains: [anthropic-validate]

filter_chains:
  - name: anthropic-validate
    filters:
      # anthropic_messages_request owns the create-message body: the Messages
      # registry decides the operation from the request head, then the body is
      # deserialized once for envelope validation and routing facts.
      - filter: anthropic_messages_request
        on_invalid: reject
        max_body_bytes: 1048576

      - filter: router
        routes:
          - path: "/v1/messages"
            cluster: "anthropic-backend"

      - filter: load_balancer
        clusters:
          - name: "anthropic-backend"
            endpoints:
              - "127.0.0.1:3001"

insecure_options:
  allow_private_endpoints: true # example proxies to local backends
