CreateGuardrailRequest - TypeScript SDK
CreateGuardrailRequest - TypeScript SDK
CreateGuardrailRequest type definition
The TypeScript SDK and docs are currently in beta. Report issues on GitHub.
Example Usage
1 import { CreateGuardrailRequest } from "@openrouter/sdk/models"; 2 3 let value: CreateGuardrailRequest = { 4 name: "My New Guardrail", 5 };
Fields
| Field | Type | Required | Description | Example |
|---|---|---|---|---|
allowedModels | string[] | ➖ | Array of model identifiers (slug or canonical_slug accepted) | [ “openai/gpt-5.2”, “anthropic/claude-4.5-opus-20251124”, “deepseek/deepseek-r1-0528:free” ] |
allowedProviders | string[] | ➖ | List of allowed provider IDs | [ “openai”, “anthropic”, “deepseek” ] |
contentFilterBuiltins | models.ContentFilterBuiltinEntry[] | ➖ | Builtin content filters to apply. Use slug “regex-prompt-injection” with action “block”, “flag”, or “redact” to enable heuristic prompt injection detection. | [{"action": "block","slug": "regex-prompt-injection"}] |
contentFilters | models.ContentFilterEntry[] | ➖ | Custom regex content filters to apply to request messages | [{"action": "redact","label": "[API_KEY]","pattern": "\\b(sk-[a-zA-Z0-9]{48})\b”} ] |
description | string | ➖ | Description of the guardrail | A guardrail for limiting API usage |
enforceZdr | boolean | ➖ | Whether to enforce zero data retention | false |
ignoredModels | string[] | ➖ | Array of model identifiers to exclude from routing (slug or canonical_slug accepted) | [ “openai/gpt-4o-mini” ] |
ignoredProviders | string[] | ➖ | List of provider IDs to exclude from routing | [ “azure” ] |
limitUsd | number | ➖ | Spending limit in USD | 50 |
name | string | ✔️ | Name for the new guardrail | My New Guardrail |
resetInterval | models.GuardrailInterval | ➖ | Interval at which the limit resets (daily, weekly, monthly) | monthly |
workspaceId | string | ➖ | The workspace to create the guardrail in. Defaults to the default workspace if not provided. | 0df9e665-d932-5740-b2c7-b52af166bc11 |