# Anthropic Messages Protocol Headers
#
# Routes Anthropic Messages API requests to a native `/v1/messages`
# backend. The `anthropic_messages_protocol` filter provides a
# centralized default `anthropic-version` header for internal or
# non-SDK callers when the header is absent.
#
# No request or response body transformation. Use this when the
# backend natively supports `/v1/messages`.
#
# API version: `default_version: "2023-06-01"` applies only when the caller
# sends no `anthropic-version`. A caller's version passes through unchanged,
# so Anthropic SDK v1 clients reach the backend with `2023-06-01` and SDK v2
# clients with `2026-10-21`. Praxis does not enforce version-specific body
# rules. Under `2026-10-21`, the backend rejects sampling fields, assistant
# `document` blocks, and non-empty citations on user text blocks.
#
# Credentials: this chain forwards the caller's credential unchanged:
# `x-api-key` from SDK v1 or `Authorization: Bearer` from SDK v2. Use it when
# each client brings its own backend key. When the gateway owns the upstream
# credential, remove both headers and inject the gateway's key (see
# `docs/anthropic-messages.md`, "SDK credentials and gateway authentication").

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

filter_chains:
  - name: anthropic-native
    filters:
      - filter: anthropic_messages_request
        on_invalid: continue

      - filter: anthropic_messages_protocol
        default_version: "2023-06-01"

      - filter: router
        routes:
          - path_prefix: "/"
            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
