← klaro.services
SentinelConsentraKlaroShieldBundlesPricing
Providers

Google Gemini

Wrap @google/generative-ai's generateContent the same way -- retries and redaction apply before the request ever reaches Google.

← All recipes
import { Klaro, retries, pii } from "@klaroshield/sdk";
import { GoogleGenerativeAI } from "@google/generative-ai";

const genAI = new GoogleGenerativeAI(process.env.GEMINI_API_KEY!);
const model = genAI.getGenerativeModel({ model: "gemini-1.5-flash" });

const klaro = new Klaro()
  .use(retries({ max: 3 }))
  .use(pii({ mode: "mask" }));

const generate = klaro.wrap(model.generateContent.bind(model));

const result = await generate("Summarize this ticket: ...");

Checked against the shipped @klaroshield/sdk API. Full docs at klaro.services/klaroshield/docs.

More in Providers

OpenAI + exponential backoffAnthropic Claude with retries + secret maskingClaude fallback when GPT-5 is rate limitedOpenRouter (OpenAI-compatible endpoint)