Skip to main content

VIN Masking

Automatically detect and mask Vehicle Identification Numbers (VINs) in both your prompts and model responses. Use this when you need to protect VINs specifically, independently of general PII.

How it works

The VIN guardrail uses Microsoft Presidio with a dedicated recognizer for 17-character VINs. When detected, the VIN is replaced with a type placeholder:

Input you send:

"Check if there is any blue car in your system with VIN WBAPH5C55BA272927 stored"

What the model receives:

"Check if there is any blue car in your system with VIN <VEHICLE_IDENTIFICATION_NUMBER> stored"

What the model outputs:

"Yes, there is a blue car in my system with VIN <VEHICLE_IDENTIFICATION_NUMBER> stored"

Output you receive:
Type placeholders are being mapped back to the original value.

"Yes, there is a blue car in my system with VIN WBAPH5C55BA272927 stored"

Quick start

curl -X POST 'https://llm.api.caip.bmw.cloud/v1/chat/completions' \
-H "Authorization: ******" \
-H 'Content-Type: application/json' \
-d '{
"model": "gpt-4o",
"messages": [{"role": "user", "content": "Is there a blue car with VIN WBAPH5C55BA272927 in the system?"}],
"guardrails": ["vin-masking-en"]
}'

Available languages

Guardrail nameLanguageUse when
vin-masking-enEnglishYour input is primarily in English
vin-masking-deGermanYour input is primarily in German

Choose the guardrail matching your input language for best detection accuracy.

Detected entities

Entity typePlaceholderExamples
VIN<VEHICLE_IDENTIFICATION_NUMBER>17-character Vehicle Identification Numbers

VIN detection is enhanced when certain context words are present, i.e.: VIN, vehicle identification, chassis, Fahrgestellnummer, Fahrzeug, vehicle id.

Behavior details

  • Action: MASK — the VIN is replaced with a placeholder. The request is never blocked outright.
  • Confidence threshold — only entities exceeding a minimum confidence score are masked, reducing false positives.
  • Both directions — masking runs on your input (pre-call) and the model's output (post-call).
  • Non-destructive — the original content is not logged or stored. Masking happens in-flight.

Limitations

  • Languages: Only English and German are supported. Other languages will pass through unscanned.
  • Confidence-based: Very short text or text lacking context may not be detected.
  • Latency: Adds a processing overhead (~0,01s-1s) depending on your input/output length.
  • Region: Currently available on RoW (llm.api.caip.bmw.cloud).

Reach out to the CAIP team for Technical Support or Consulting if you need additional language or region support.

Examples

Masking a VIN in German - curl

curl -X POST 'https://llm.api.caip.bmw.cloud/v1/chat/completions' \
-H "Authorization: ******" \
-H 'Content-Type: application/json' \
-d '{
"model": "gpt-4o",
"messages": [{"role": "user", "content": "Bitte prüfe die Fahrgestellnummer WBAPH5C55BA272927"}],
"guardrails": ["vin-masking-de"]
}'

Masking a VIN in English - OpenAI Python SDK

from openai import OpenAI

client = OpenAI(
base_url="https://llm.api.caip.bmw.cloud/v1",
api_key="your-api-key"
)

response = client.chat.completions.create(
model="claude-sonnet-4.6",
messages=[
{"role": "user", "content": "Summarize the service history for VIN WBAPH5C55BA272927"}
],
extra_body={"guardrails": ["vin-masking-en"]}
)