Back to Documentation

Input Scanning

Scan all inputs for prompt injection, jailbreak attempts, and malicious content.

Enable Input Scanning

const response = await client.gateway.chat({
  model: "gpt-4",
  messages: [{ role: "user", content: userInput }],
  security: {
    scanInput: true,
    inputPolicy: "strict",
    blockOnThreat: true
  }
});

Threat Detection

Prompt Injection

Detect attempts to override system instructions.

Jailbreak Attempts

Identify attempts to bypass safety measures.

Malicious Code

Scan for code injection and XSS attempts.

Handle Blocked Requests

try {
  const response = await client.gateway.chat({...});
} catch (error) {
  if (error.code === 'INPUT_BLOCKED') {
    console.log('Threat detected:', error.threatType);
    console.log('Confidence:', error.confidence);
  }
}