Skip to main content
Two ways in: send Gemini requests to the proxy in OpenAI’s format, or call init() and keep Google’s client as it is (auto-instrumentation patches both google-genai and the deprecated google-generativeai).

Proxy

Proxy Base URL: https://api.promptguard.co/api/v1Point your LLM SDK’s base_url / baseURL to this endpoint. Your existing provider API key goes in the Authorization header as usual; add your PromptGuard key via X-API-Key.
Every model id starting gemini- goes to Google’s Gemini API. You send an OpenAI-style chat completion; PromptGuard translates it into a Gemini generateContent call and translates the reply back into OpenAI’s shape, so any OpenAI client works. Google’s own SDKs do not speak this format, so for them use auto-instrumentation instead. Send your Google AI Studio API key in Authorization. PromptGuard forwards it to Google as the x-goog-api-key header Google expects.
The translation calls generateContent, Google’s non-streaming method, so send these requests without stream. To keep the Google key out of your application, store it as a provider key under gemini.

Auto-instrumentation

With google-genai a redact decision rewrites the prompt and the system instruction is scanned. With the deprecated google-generativeai neither is possible, so in enforce mode a redact decision blocks the call instead.