PromptShield

Environment Variables

Full reference for every variable PromptShield reads at startup.

Set these in your .env file or as real environment variables. The proxy reads them once at startup.

Core

VariableDefaultDescription
PROMPTSHIELD_PORT8080Port the proxy listens on
PROMPTSHIELD_PROVIDERgeminiUpstream provider: gemini | openai | openai-compatible | selfhosted
PROMPTSHIELD_UPSTREAM_URLprovider defaultOverride the upstream LLM base URL
PROMPTSHIELD_CHAT_ROUTE/v1/chat/completionsInbound route path on the proxy
PROMPTSHIELD_POLICY_PATHconfig/policy.yamlPath to the policy file

Detection engine

VariableDefaultDescription
PROMPTSHIELD_ENGINE_URLnoneURL of the detection engine (e.g. http://localhost:4321). Set to none or leave empty to run in gateway mode with no PII scanning.

Model selection

VariableDefaultDescription
PROMPTSHIELD_MODELGlobal model override — takes priority over everything below
PROMPTSHIELD_GEMINI_MODELgemini-2.0-flashModel used when provider is gemini
PROMPTSHIELD_OPENAI_MODELgpt-4o-miniModel used when provider is openai
PROMPTSHIELD_SELFHOSTED_MODELllama3.1:8bModel used when provider is selfhosted

API keys

VariableDefaultDescription
PROMPTSHIELD_UPSTREAM_API_KEYGlobal API key fallback (any provider)
GEMINI_API_KEYGemini API key
OPENAI_API_KEYOpenAI API key
SELFHOSTED_API_KEYSelf-hosted endpoint API key (optional)

TLS

Both variables must be set together or not at all. Setting only one is a startup error.

VariableDefaultDescription
PROMPTSHIELD_TLS_CERTPath to TLS certificate (PEM)
PROMPTSHIELD_TLS_KEYPath to TLS private key (PEM)

On this page