Customize your pipeline
A pipeline is an ordered list of modules. Modules run in order, each one gets the chance to mutate the request, short-circuit with a cached response, or attach metadata. The provider call sits in the middle. Post-pipeline modules then run on the response.
[ pre ] ──▶ [ pre ] ──▶ [ pre ] ──▶ provider ──▶ [ post ] ──▶ [ post ]Three ways to set the pipeline
Configuration sources, in priority (highest wins):
| # | Source | Use when |
|---|---|---|
| 1 | Per-request header x-prxy-pipe | A single call needs different behavior. |
| 2 | API key config (set in dashboard) | Different keys for different services. |
| 3 | PRXY_PIPE env var | Process-wide default in local mode. |
| 4 | config.yaml | Local mode, parameterized configs. |
| 5 | Built-in default | Nothing else set. |
The built-in default is:
mcp-optimizer,semantic-cache,patternsComma list (env var, header, dashboard)
Simplest. Module names separated by commas:
PRXY_PIPE=exact-cache,semantic-cache,cost-guard,patternsOr per-request:
curl -H "x-prxy-pipe: exact-cache,patterns" ...YAML (config file, dashboard advanced view)
When you need to pass options to a module:
pipeline:
- mcp-optimizer:
relevanceThreshold: 0.6
preserveTools: ['read_file', 'write_file']
- semantic-cache:
similarity: 0.92
ttlSeconds: 3600
- cost-guard:
perRequest: 0.10
perDay: 5.00
- patterns:
maxInjected: 5
minSuccessRate: 0.7Order matters
A few rules of thumb:
- Caches first. A cache hit short-circuits the pipeline — no point running a 3-step optimizer pipeline before checking if you’ve answered this exact question already.
- Cost guards before optimizers. Reject before optimizing.
- Optimizers before injection. Strip tokens before adding more.
- Injection before routing. The router picks a model based on what’s actually being sent.
The provider call happens after the last pre hook. Then post hooks run on the response (these don’t block your client — they’re side effects: cache writes, pattern forging, usage tracking).
The usage-tracker module is appended automatically in cloud mode. You can list it explicitly to control its position, but you can’t disable it in cloud — usage tracking IS billing.
Recipes for common shapes
Don’t compose from scratch — start with a recipe:
Inspect what’s actually running
curl https://api.prxy.monster/v1/pipeline \
-H "Authorization: Bearer $ANTHROPIC_API_KEY"Returns the resolved pipeline for your key including version of each module. See API → /v1/pipeline.