Setting up Deepseek Guardrails

Deepseek Guardrails

Use Portkey to enforce structured inputs, safe outputs, and usage policies across all Deepseek requests. Configure verdict actions like async checks, request denial, and feedback logging, according to your enforcement needs.

Deepseek Guardrails

DeepSeek provides powerful open-weight models optimized for reasoning, coding, and general-purpose tasks. But bringing them into production safely requires more than just model performance. With Portkey, you can apply guardrails to every DeepSeek request, ensuring safety, compliance, and consistency without modifying your application code.

DeepSeek’s lineup includes models like DeepSeek-VL, DeepSeek-Coder, and the newly released DeepSeek-LLM, used across tasks like chat, RAG, code generation, and multimodal inference. Whether you're calling DeepSeek APIs or hosting the models yourself, Portkey lets you apply guardrails, monitor usage, and route requests across providers with ease.

With Portkey, you can:

Portkey supports all Deepseek models out of the box and can be deployed in hours, not weeks, making it the easiest way to bring enterprise-grade control to your AI stack.

Guardrail checks you can apply to Deepseek

Portkey offers both deterministic and LLM-powered guardrails that work seamlessly with Deepseek's APIs. You can apply these checks to inputs, outputs, or both.

Input guardrails
Regex Match

Basic
Enforce patterns on input prompts

Sentence / Word / Character Count

Basic
Control verbosity

Lowercase Detection

Basic
Control verbosity

Ends With

Basic
Validate specific prompt endings

Webhook

Basic
Enforce custom business logic

JWT Token Validator

Basic
Verify token authenticity

Model Whitelist

Basic
Allow only approved models per route

Moderate Content

Pro
Block unsafe or harmful prompts

Check Language

Pro
Enforce language constraints

Detect PII

Pro
Prevent sensitive info in prompts

Detect Gibberish

Pro
Block incoherent or low-quality input

Output guardrails
Regex / Sentence / Word / Character Count

Basic
Ensure required words or phrases

JSON Schema / JSON Keys

Basic
Ensure required words or phrases

Valid URLs

Basic
Validate links in responses

Contains Code

Basic
Detect code in specific formats

Webhook

Basic
Post-process or validate output

Detect PII / Detect Gibberish

Basic
Ensure content meets criteria

How to add guardrails to Deepseek with Portkey

Adding Portkey Guardrails in production is just a 4-step process:

1

Create Guardrail Checks

2

Create Guardrail Actions

3

Enable Guardrail through Configs

4

Attach the Config to a Request

Guardrail action settings

Async (TRUE)

Run guardrails in parallel to the request.
→ No added latency. Best for logging-only scenarios.

Deny Request (TRUE)

Block the request or response if any guardrail fails.
→ Use when violations must stop execution.

Frequently Asked Questions

Do guardrails add latency to requests?
Can I block a request if a guardrail fails?
What happens if I don’t want to block, just observe?
What’s the difference between basic and pro guardrails?

Safeguard your Deepseek requests now.

Whether you're running production workloads, or scaling across teams, Portkey’s guardrails give you control without compromise.