Azure OpenAI + SemanticGuard
Add intelligent caching to your Azure OpenAI deployment. Your prompts stay with Azure. Your committed spend goes further. One line of code.
import { createOpenAI } from "@ai-sdk/openai";import { withSemanticGuard } from "@semanticguard/ai-sdk";const azure = createOpenAI({apiKey: "your-azure-api-key",fetch: withSemanticGuard({gatewayUrl: "https://semanticguard.dev",apiKey: "sg-your-key-here",extraHeaders: {"x-sg-provider": "azure","x-sg-azure-resource": "your-resource-name","x-sg-azure-deployment": "gpt-4o",},}),});const result = await generateText({model: azure("gpt-4o"),prompt: "Summarize this quarterly report...",});
Requests route through your Azure OpenAI deployment. SemanticGuard caches responses so identical or similar prompts never hit the API twice.
Intelligent caching understands when two prompts mean the same thing. 100% measured correctness on our public benchmark — see /benchmark. Cache hits return in under 50ms.
Your prompts never leave your contracted provider. Entity extraction uses your deployment's own models. Full data residency compliance.
Add withSemanticGuard() with your Azure resource and deployment name. One line.
Your prompts go to your Azure deployment. SemanticGuard caches the responses using your Azure credentials.
Similar prompts return cached responses in under 50ms. Your Azure spend drops without sacrificing response quality — 100% measured correctness on our public benchmark.
Drop-in integration
One fetch wrapper. No API format changes. Works with the Vercel AI SDK or direct API calls.
Same-vendor routing
All auxiliary calls use your Azure deployment. No data shared with other providers.
Full visibility
Real-time cost dashboard shows spend by model, project, and request. See exactly what you save.
Zero lock-in
Remove the wrapper and you are back to direct Azure calls. No migration, no format changes.
Free tier includes 10K requests/mo with Shadow Mode. See your potential savings before enabling caching.