This guide walks you through making your first API request to PromptGuard. You’ll send a chat completion request using OpenAI or Anthropic models and see how PromptGuard protects your AI application.
Prerequisites
- A PromptGuard API key (get one here)
- A terminal or code editor
- 2 minutes
Basic Chat Completion
Let’s start with a simple “Hello, world!” request:Expected Response
Success! If you see a response like this, PromptGuard is working correctly and your AI requests are now protected.
Testing Security Protection
Now let’s test PromptGuard’s security features with a potentially malicious prompt:What Happens?
PromptGuard will likely:- Detect the prompt injection attempt (“ignore all previous instructions”)
- Redact the PII (credit card number) →
4532-****-****-9012 - Log the security event in your dashboard
- Return a safe response or block the request entirely
Response Headers
PromptGuard adds helpful headers to every response:| Header | Description |
|---|---|
X-PromptGuard-Event-ID | Unique identifier for tracking this request |
X-PromptGuard-Decision | allow, block, or redact |
X-PromptGuard-Latency | Processing time in milliseconds |
X-PromptGuard-Version | PromptGuard version used |
Supported Models
PromptGuard works with all OpenAI and Anthropic models:OpenAI Models
| Model Family | Models | Support |
|---|---|---|
| GPT-5 | gpt-5, gpt-5.1 | ✅ Full |
| GPT-4o | gpt-4o, gpt-4o-mini | ✅ Full |
| o1 Reasoning | o1, o1-mini, o1-preview | ✅ Full |
| GPT-4 | gpt-4-turbo | ✅ Full |
| Embeddings | text-embedding-3-small, text-embedding-3-large | ✅ Full |
| DALL-E | dall-e-3 | ✅ Full |
Anthropic Models
| Model Family | Models | Support |
|---|---|---|
| Claude 4 | claude-opus-4.5, claude-4-sonnet | ✅ Full |
| Claude 3.5 | claude-3-5-sonnet-latest, claude-3-5-haiku-latest | ✅ Full |
| Claude 3 | claude-3-opus, claude-3-sonnet, claude-3-haiku | ✅ Full |
Groq Models
| Model Family | Models | Support |
|---|---|---|
| Llama 4 | llama-4-scout, llama-4-maverick | ✅ Full |
| Llama 3.3 | llama-3.3-70b-versatile | ✅ Full |
| Llama 3.1 | llama-3.1-8b-instant, llama-3.1-70b | ✅ Full |
Model availability on Groq changes frequently. See Groq’s models page for current availability.
Google Models
| Model Family | Models | Support |
|---|---|---|
| Gemini 3 | gemini-3-deep-think | ✅ Full |
| Gemini 2.0 | gemini-2.0-flash, gemini-2.0-flash-exp | ✅ Full |
| Gemini 1.5 | gemini-1.5-pro, gemini-1.5-flash | ✅ Full |
Coming Soon
| Provider | Models | Status |
|---|---|---|
| Cohere | Command R+, Embed | 🚧 Planned |
| Together AI | Various open source models | 🚧 Planned |
PromptGuard automatically forwards your requests to the appropriate provider (OpenAI, Anthropic, or Groq) using your API keys. You don’t need to change model names or parameters.
Streaming Responses
PromptGuard fully supports streaming responses:Error Handling
PromptGuard uses standard HTTP status codes:| Status | Meaning | Action |
|---|---|---|
200 | Success | Request processed normally |
400 | Bad Request | Check request format |
401 | Unauthorized | Verify API key |
403 | Forbidden | Check permissions |
429 | Rate Limited | Implement backoff |
500 | Server Error | Retry with backoff |
Handling Security Blocks
When PromptGuard blocks a request, handle it gracefully:Monitoring Your Requests
After making requests, check your dashboard:- Open app.promptguard.co
- Navigate to Analytics > Activity
- See your requests, security events, and performance metrics
📊 View in Dashboard: Open app.promptguard.co → Analytics > Activity to see your requests, security events, and performance metrics in real-time.
Performance Benchmarking
Test PromptGuard’s performance impact:Next Steps
Integration Guides
Language and framework-specific guides
Security Configuration
Customize protection for your use case
Monitoring & Alerts
Set up notifications and tracking
Migration Guide
Move existing applications to PromptGuard
Troubleshooting
Having issues? Check these common solutions:Authentication Error
Authentication Error
- Verify your API key starts with
pg_live_orpg_test_ - Check for extra spaces or special characters
- Ensure the key hasn’t been deleted or revoked
Network/Timeout Error
Network/Timeout Error
- Check your internet connection
- Verify the base URL:
https://api.promptguard.co/api/v1 - Try increasing timeout settings in your HTTP client
Unexpected Response
Unexpected Response
- Check the
X-PromptGuard-Decisionheader - Look for security events in your dashboard
- Verify you’re using supported model names