CreateGuardrailRequest - Python SDK

CreateGuardrailRequest method reference

The Python SDK and docs are currently in beta. Report issues on GitHub.

Fields

FieldTypeRequiredDescriptionExample
allowed_modelsList[str]Array of model identifiers (slug or canonical_slug accepted)[
“openai/gpt-5.2”,
“anthropic/claude-4.5-opus-20251124”,
“deepseek/deepseek-r1-0528:free”
]
allowed_providersList[str]List of allowed provider IDs[
“openai”,
“anthropic”,
“deepseek”
]
content_filter_builtinsList[components.ContentFilterBuiltinEntryInput]Builtin content filters to apply. The “flag” action is only supported for “regex-prompt-injection”; PII slugs (email, phone, ssn, credit-card, ip-address, person-name, address) accept “block” or “redact” only.[
{"action": "block","slug": "regex-prompt-injection"}
]
content_filtersList[components.ContentFilterEntry]Custom regex content filters to apply to request messages[
{"action": "redact","label": "[API_KEY]","pattern": "\\b(sk-[a-zA-Z0-9]{48})\b”
}
]
descriptionOptionalNullable[str]Description of the guardrailA guardrail for limiting API usage
enforce_zdrOptionalNullable[bool]: warning: ** DEPRECATED **: This will be removed in a future release, please migrate away from it as soon as possible.

Deprecated. Use enforce_zdr_anthropic, enforce_zdr_openai, enforce_zdr_google, and enforce_zdr_other instead. When provided, its value is copied into any of those per-provider fields that are not explicitly specified on the request.
false
enforce_zdr_anthropicOptionalNullable[bool]Whether to enforce zero data retention for Anthropic models. Falls back to enforce_zdr when not provided.false
enforce_zdr_googleOptionalNullable[bool]Whether to enforce zero data retention for Google models. Falls back to enforce_zdr when not provided.false
enforce_zdr_openaiOptionalNullable[bool]Whether to enforce zero data retention for OpenAI models. Falls back to enforce_zdr when not provided.false
enforce_zdr_otherOptionalNullable[bool]Whether to enforce zero data retention for models that are not from Anthropic, OpenAI, or Google. Falls back to enforce_zdr when not provided.false
ignored_modelsList[str]Array of model identifiers to exclude from routing (slug or canonical_slug accepted)[
“openai/gpt-4o-mini”
]
ignored_providersList[str]List of provider IDs to exclude from routing[
“azure”
]
limit_usdOptionalNullable[float]Spending limit in USD50
namestr✔️Name for the new guardrailMy New Guardrail
reset_intervalOptionalNullable[components.GuardrailInterval]Interval at which the limit resets (daily, weekly, monthly)monthly
workspace_idOptional[str]The workspace to create the guardrail in. Defaults to the default workspace if not provided.0df9e665-d932-5740-b2c7-b52af166bc11