For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
ModelsChatRankingsDocs
DocsAPI ReferenceClient SDKsAgent SDKCookbookChangelog
DocsAPI ReferenceClient SDKsAgent SDKCookbookChangelog
    • Overview
    • Usage for Agents
  • TypeScript SDK
    • Overview
      • Analytics
      • APIKeys
      • Byok
      • Chat
      • Credits
      • Embeddings
      • Endpoints
      • Generations
      • Guardrails
        • Models
        • CreateGuardrailRequest
      • OAuth
      • Observability
      • Organization
      • Presets
      • Providers
      • Rerank
      • Beta.Responses
      • Transcriptions
      • Speech
      • VideoGeneration
      • Workspaces
  • Python SDK
    • Overview
  • Go SDK
  • DevTools
    • Overview
    • Migrating to @openrouter/agent
LogoLogo
ModelsChatRankingsDocs
On this page
  • Example Usage
  • Fields
TypeScript SDKAPI ReferenceModels

CreateGuardrailRequest - TypeScript SDK

CreateGuardrailRequest type definition
Was this page helpful?
Previous

OAuth - TypeScript SDK

OAuth method reference
Next
Built with

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

Example Usage

1import { CreateGuardrailRequest } from "@openrouter/sdk/models";
2
3let value: CreateGuardrailRequest = {
4 name: "My New Guardrail",
5};

Fields

FieldTypeRequiredDescriptionExample
allowedModelsstring[]➖Array of model identifiers (slug or canonical_slug accepted)[
“openai/gpt-5.2”,
“anthropic/claude-4.5-opus-20251124”,
“deepseek/deepseek-r1-0528:free”
]
allowedProvidersstring[]➖List of allowed provider IDs[
“openai”,
“anthropic”,
“deepseek”
]
contentFilterBuiltinsmodels.ContentFilterBuiltinEntry[]➖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"}
]
contentFiltersmodels.ContentFilterEntry[]➖Custom regex content filters to apply to request messages[
{"action": "redact","label": "[API_KEY]","pattern": "\\b(sk-[a-zA-Z0-9]{48})\b”
}
]
descriptionstring➖Description of the guardrailA guardrail for limiting API usage
enforceZdrboolean➖: 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
enforceZdrAnthropicboolean➖Whether to enforce zero data retention for Anthropic models. Falls back to enforce_zdr when not provided.false
enforceZdrGoogleboolean➖Whether to enforce zero data retention for Google models. Falls back to enforce_zdr when not provided.false
enforceZdrOpenaiboolean➖Whether to enforce zero data retention for OpenAI models. Falls back to enforce_zdr when not provided.false
enforceZdrOtherboolean➖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
ignoredModelsstring[]➖Array of model identifiers to exclude from routing (slug or canonical_slug accepted)[
“openai/gpt-4o-mini”
]
ignoredProvidersstring[]➖List of provider IDs to exclude from routing[
“azure”
]
limitUsdnumber➖Spending limit in USD50
namestring✔️Name for the new guardrailMy New Guardrail
resetIntervalmodels.GuardrailInterval➖Interval at which the limit resets (daily, weekly, monthly)monthly
workspaceIdstring➖The workspace to create the guardrail in. Defaults to the default workspace if not provided.0df9e665-d932-5740-b2c7-b52af166bc11