Examples

Request Validate

Rejects empty, malformed, or non-object JSON request bodies

Praxis AI v0.12.1 (alpha) 2 min read

Category: Setup-dependent integration
Task: Rejects empty, malformed, or non-object JSON request bodies

Prerequisites: The external service, credentials, or certificates referenced by this configuration.

Run it: Use ghcr.io/praxis-proxy/ai:0.12.1 and follow the container quickstart to mount and start the configuration.

This configuration comes from the selected release. The example has not been run here; external services are not bundled.

Download the source file.

# 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.
#
# API version and credentials: the chain sets no `anthropic-version` and
# forwards the caller's version and credential unchanged (`x-api-key` from
# Anthropic SDK v1, `Authorization: Bearer` from SDK v2). Version-specific
# rules, such as `2026-10-21` rejecting sampling fields, are left to the
# 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