Examples

Token Quota

PPE evaluates a weighted quota over the final normalized token usage snapshot. token_count supplies trusted usage; the policy document selects the quota plugin and formula; downstream filters consume PPE output

Praxis AI v0.12.1 (alpha) 2 min read

Category: Setup-dependent integration
Task: PPE evaluates a weighted quota over the final normalized token usage snapshot. token_count supplies trusted usage; the policy document selects the quota plugin and formula; downstream filters consume PPE output

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

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

Download the source file.

Companion resources from the same snapshot:

# Token quota policy
#
# PPE evaluates a weighted quota over the final normalized token usage snapshot.
# `token_count` supplies trusted usage; the policy document selects the quota
# plugin and formula; downstream filters consume PPE output.
#
# Run from the repository root with:
#   cargo run -p praxis-ai-proxy --features token-quota-filter -- \
#     -c examples/configs/token-quota.yaml

listeners:
  - name: default
    address: "127.0.0.1:8080"
    filter_chains: [main]

filter_chains:
  - name: main
    filters:
      - filter: router
        routes:
          - path_prefix: "/"
            cluster: backend

      - filter: model_to_header

      # Response hooks run in reverse: token_count -> policy/PPE.
      - filter: policy
        config_path: examples/configs/token-quota.ppe.yaml
        body_access: read_only

      - filter: token_count
        provider: openai

      - filter: access_log

      - filter: load_balancer
        clusters:
          - name: backend
            endpoints: ["127.0.0.1:3000"]

insecure_options:
  allow_private_endpoints: true