The Request Parameters Check is a BASIC deterministic guardrail that inspects the incoming request body and enforces allow/block rules on:Documentation Index
Fetch the complete documentation index at: https://docs.portkey.ai/docs/llms.txt
Use this file to discover all available pages before exploring further.
- Tools declared in the request (
tools[].type,tools[].function.name,tools[].name) - Top-level request parameter keys (e.g.
stream,temperature,tools,logprobs) - Values for specific top-level parameters (e.g.
model=gpt-4o,stream=true)
beforeRequestHook).
Using Request Parameters Check in Portkey
1. Add the Request Parameters Check
-
Navigate to the
Guardrailspage and click theCreatebutton -
Search for “Request Parameters Check” in the BASIC category and click
Add -
Configure the check (all fields are optional - leave a list empty to skip that constraint):
Tools
- Allowed Types - strict allow list of tool
typevalues (e.g.function,web_search_preview,web_search,file_search,code_interpreter,computer_use,mcp) - Blocked Types - tool
typevalues to reject - Allowed Function Names - strict allow list for
tool.function.name/tool.name - Blocked Function Names - function names to reject
- Allowed Keys - strict allow list of top-level keys in the request body
- Blocked Keys - top-level keys to reject
- Values - per-parameter rules. For each parameter (e.g.
model,stream,temperature) you can setallowedValuesand/orblockedValues. Values must be primitives (string, number, or boolean).
- Allowed Types - strict allow list of tool
-
Set any
actionsyou want on your check, and create the Guardrail!
Guardrail Actions let you orchestrate your guardrail’s behaviour (deny, feedback, etc.). Learn more about them here.
| Check Name | Description | Parameters | Supported Hooks |
|---|---|---|---|
| Request Parameters Check | Allow/block tools, top-level request keys, and specific parameter values | tools (object), params (object) | beforeRequestHook |
2. Add Guardrail ID to a Config and Make Your Request
- When you save the Guardrail, you’ll get an associated Guardrail ID - add this ID to the
input_guardrailsparam in your Portkey Config - Create the Config in the Portkey UI, save it, and attach its Config ID to your requests. More here.
- NodeJS
- Python
- OpenAI NodeJS
- OpenAI Python
- cURL
Configuration reference
The guardrail accepts the following parameter shape. Every field is optional; an empty config is a no-op. Values in<...> are placeholders describing the expected type, not literal strings.
tool.function?.name || tool.name || tool.type, so both OpenAI-style ({ type: 'function', function: { name: 'getWeather' } }) and Responses-API-style ({ type: 'web_search_preview' }) tools work consistently.
Allow vs. block behaviour
| List | Behaviour |
|---|---|
blocked* | Deny list. Matching items are flagged. |
allowed* | Strict allow list. If the list is non-empty, items not in it are flagged. If empty or omitted, there is no allow-list constraint on that axis (it does not mean “block everything”). |
type_blocked and name_not_allowed).
Scope
- Only top-level keys of the request JSON are inspected for params - nested objects and arrays are not walked.
- Only entries in the request’s
toolsarray are inspected for tool rules. - Value comparisons use strict equality and are intended for primitives (
string,number,boolean).
If the same entry appears in both a blocked and an allowed list (e.g. in
blockedTypes and allowedTypes), the guardrail returns a configuration conflict error. Remove the duplicate from either list.Common recipes
Allow only function calling, block web/code/computer tools
Your security policy forbids auto-browsing, file uploads, code interpreter, and computer-use agents.Block specific sensitive functions
Your agents expose many tools but some (shell execution, DB writes, payments) must be off-limits for this consumer / virtual key.Allow list a fixed toolset for a regulated workflow
Only a small, audited set of functions is permitted.Force non-streaming responses
Your proxy, logging, or guardrail pipeline cannot handle SSE, sostream: true must never reach the provider.
Block Anthropic fast-mode (speed: "fast")
Anthropic’s fast-mode beta exposes a top-level speed parameter (e.g. "speed": "fast" alongside the anthropic-beta: fast-mode-… header). Block the value to stop it from reaching the provider while still allowing standard requests through:
blockedKeys instead:
thinking, safety_identifier, service_tier, etc.
Pin the model to an approved list
Only approved, contracted models are allowed on this key.Enforce safety settings
Prevent callers from loosening safety, sampling, or privacy knobs.Strict parameter allow list (zero-trust body)
Callers can only send a minimal, audited set of fields - anything extra is rejected until explicitly approved.Block dangerous parameter keys
Disable experimental or high-risk fields without enumerating everything you do allow.Cap output length via an allowed-tier list
blockedValues and allowedValues operate on exact primitives, so true numeric ranges must be modeled as an enumeration.
For arbitrary numeric ranges (e.g.
max_tokens <= 2048), pair this guardrail with a custom plugin or upstream validation. Range comparisons are not supported natively.Combining tool and param rules
Tools and params are evaluated independently in the same verdict.Verdict payload
When the guardrail denies a request, the failure payload inhook_results contains:
blockedToolsFound- tools that violated a rule, each withtype,name, and one or morereasonsblockedParamsFound- params that violated a rule, each withparam,value(if any), and one or morereasonsexplanation- a human-readable summary, e.g.Blocked tools: "executeShell" (function name is blocked). Blocked params: "stream"=true (value is blocked)
Reason codes
| Category | Code | Meaning |
|---|---|---|
| Tool | type_blocked | tool.type is in tools.blockedTypes |
| Tool | name_blocked | tool.function.name / tool.name is in tools.blockedFunctionNames |
| Tool | type_not_allowed | tools.allowedTypes is set and tool.type is not in it |
| Tool | name_not_allowed | tools.allowedFunctionNames is set and the name is not in it |
| Param | key_blocked | Top-level key is in params.blockedKeys |
| Param | key_not_allowed | params.allowedKeys is set and the key is not in it |
| Param | value_blocked | Value is in params.values[key].blockedValues |
| Param | value_not_allowed | params.values[key].allowedValues is set and the value is not in it |
Decision matrix
blocked* present | allowed* present | Result |
|---|---|---|
| No | No | No constraint on this axis |
| Yes | No | Everything passes except blocked entries |
| No | Yes | Only entries in the allow list pass |
| Yes | Yes | Entries must be in the allow list and not in the block list |

