FAQ & Troubleshooting
This section addresses common questions and provides solutions for typical issues you might encounter when using Cloakr.ai.
General Questions
Q: What is Cloakr.ai?
A: Cloakr.ai is a privacy-first enterprise AI gateway that provides end-to-end encryption, PII protection, and intelligent routing for your LLM infrastructure. It acts as a secure intermediary between your applications and AI models, ensuring data privacy and compliance.
Q: How does Cloakr.ai differ from direct API calls?
A: Cloakr.ai adds several layers of security and optimization:
- Encryption: All data is encrypted in transit and at rest
- PII Protection: Automatic detection and redaction of sensitive data
- Intelligent Routing: Optimizes model selection based on cost and performance
- Audit Logging: Complete audit trail for compliance
- Rate Limiting: Prevents abuse and manages costs
Q: What models does Cloakr.ai support?
A: Cloakr.ai supports all major LLM providers:
- OpenAI: GPT-4o, GPT-4o-mini, GPT-4-turbo, GPT-3.5-turbo
- Anthropic: Claude-3-Opus, Claude-3-Sonnet, Claude-3-Haiku
- Internal: Cloakr-optimized models with enhanced security
Authentication & Setup
Q: How do I get an API key?
A:
- Visit the Cloakr Dashboard
- Create an account or sign in
- Navigate to the API Keys section
- Generate a new API key
- Copy the key and store it securely
Q: I'm getting "Invalid API key" errors. What should I do?
A:
- Check the key format: API keys should start with
cloakr_
- Verify environment variables: Ensure
CLOAKR_API_KEY
is set correctly - Check for typos: Copy the key exactly as shown in the dashboard
- Regenerate if needed: If the key is compromised, generate a new one
# Check your environment variable
echo $CLOAKR_API_KEY
# Set it if missing
export CLOAKR_API_KEY="your-api-key-here"
Q: Can I use multiple API keys?
A: Yes, you can use multiple API keys for different purposes:
// Different keys for different environments
const devClient = new CloakrClient({
apiKey: process.env.CLOAKR_DEV_API_KEY
});
const prodClient = new CloakrClient({
apiKey: process.env.CLOAKR_PROD_API_KEY
});
Rate Limiting & Quotas
Q: I'm getting "Rate limit exceeded" errors. What does this mean?
A: This means you've exceeded your plan's rate limits. Here's how to handle it:
// Implement retry logic with exponential backoff
async function handleRateLimit(client, request) {
try {
return await client.chat(request);
} catch (error) {
if (error.code === 'rate_limit_exceeded') {
const retryAfter = error.retryAfter || 60;
console.log(`Rate limited. Retrying in ${retryAfter} seconds...`);
await new Promise(resolve => setTimeout(resolve, retryAfter * 1000));
return await client.chat(request);
}
throw error;
}
}
Q: How do I check my current usage?
A: You can check your usage through the dashboard or API:
// Get usage information
const usage = await client.getUsage({
period: 'current_month'
});
console.log('Current usage:', {
requests: usage.requests,
tokens: usage.tokens,
cost: usage.cost
});
Q: How can I upgrade my plan?
A:
- Visit the Cloakr Dashboard
- Go to the Billing section
- Select a higher plan
- Update your payment information
- Your new limits will be active immediately
Encryption & Security
Q: How does encryption work in Cloakr.ai?
A: Cloakr.ai uses AES-256-GCM encryption:
// Data is encrypted client-side before transmission
const encryptedPrompt = client.encrypt("sensitive data");
const response = await client.chat({
model: 'gpt-4o',
prompt: encryptedPrompt
});
// Response is decrypted client-side
const decryptedResponse = client.decrypt(response.choices[0].text);
Q: Can I use my own encryption keys?
A: Yes, enterprise customers can use Bring Your Own Key (BYOK):
const client = new CloakrClient({
apiKey: process.env.CLOAKR_API_KEY,
encryption: {
keyId: process.env.CLOAKR_KEY_ID,
keyMaterial: process.env.CLOAKR_ENCRYPTION_KEY,
rotation: true
}
});
Q: Is my data stored on Cloakr.ai servers?
A: Cloakr.ai follows a zero-knowledge architecture:
- Encrypted data: All sensitive data is encrypted
- Temporary storage: Data is only stored temporarily for processing
- Automatic deletion: Data is automatically deleted after processing
- Audit logs: Only metadata is retained for compliance
PII Protection
Q: What types of PII does Cloakr.ai detect?
A: Cloakr.ai automatically detects:
- Personal identifiers: Names, SSNs, driver's licenses
- Contact information: Email addresses, phone numbers
- Financial data: Credit card numbers, bank accounts
- Medical information: Health records, insurance numbers
- Custom patterns: Company-specific identifiers
Q: Can I customize PII detection rules?
A: Yes, you can create custom detection rules:
const customRules = [
{
type: 'custom_pattern',
pattern: /CUSTOMER-\d{6}/g,
replacement: '[REDACTED_CUSTOMER_ID]'
},
{
type: 'email',
domains: ['internal.com', 'test.com']
}
];
client.setPIIRedactor(new PIIRedactor({ rules: customRules }));
Q: How accurate is PII detection?
A: Cloakr.ai uses a hybrid approach:
- NER models: 95%+ accuracy for standard PII
- Regex patterns: 99%+ accuracy for structured data
- Custom rules: 100% accuracy for known patterns
- False positive rate: < 1%
Performance & Optimization
Q: How can I improve response times?
A: Several strategies to improve performance:
// 1. Use streaming for immediate feedback
const stream = await client.chat({
model: 'gpt-4o',
prompt: 'Write a story',
stream: true
});
// 2. Use smaller models for faster responses
const fastResponse = await client.chat({
model: 'gpt-3.5-turbo', // Faster than GPT-4
prompt: 'Simple question',
maxTokens: 100
});
// 3. Implement caching
const cachedResponse = await getCachedResponse(model, prompt);
Q: How do I handle large volumes of requests?
A: Use batch processing and connection pooling:
// Batch processing
async function batchProcess(prompts, batchSize = 5) {
const results = [];
for (let i = 0; i < prompts.length; i += batchSize) {
const batch = prompts.slice(i, i + batchSize);
const batchResults = await Promise.all(
batch.map(prompt => client.chat({ model: 'gpt-4o', prompt }))
);
results.push(...batchResults);
}
return results;
}
// Connection pooling
const client = new CloakrClient({
apiKey: process.env.CLOAKR_API_KEY,
connectionPool: {
maxConnections: 20,
keepAlive: true
}
});
Q: How can I reduce costs?
A: Several cost optimization strategies:
// 1. Use appropriate models
const costEffectiveResponse = await client.chat({
model: 'gpt-3.5-turbo', // Cheaper than GPT-4
prompt: 'Simple task',
maxTokens: 100 // Limit response length
});
// 2. Implement caching
const cache = new CacheManager({ ttl: 3600 });
const client = new CloakrClient({
apiKey: process.env.CLOAKR_API_KEY,
cache: cache
});
// 3. Use streaming to control costs
let totalTokens = 0;
for await (const chunk of stream) {
if (totalTokens > 500) break; // Stop at token limit
totalTokens += chunk.usage?.completionTokens || 0;
}
Error Handling
Q: How do I handle API errors properly?
A: Implement comprehensive error handling:
async function robustChat(client, request) {
try {
return await client.chat(request);
} catch (error) {
switch (error.code) {
case 'rate_limit_exceeded':
console.log(`Rate limited. Retry after ${error.retryAfter} seconds`);
await new Promise(resolve => setTimeout(resolve, error.retryAfter * 1000));
return await client.chat(request);
case 'invalid_api_key':
console.error('Invalid API key. Check your configuration.');
throw error;
case 'content_policy_violation':
console.error('Content violates usage policies:', error.details);
throw error;
case 'model_unavailable':
console.log('Model unavailable, trying alternative...');
return await client.chat({ ...request, model: 'gpt-3.5-turbo' });
default:
console.error('Unexpected error:', error.message);
throw error;
}
}
}
Q: What do different error codes mean?
A: Common error codes and their meanings:
Error Code | Meaning | Solution |
---|---|---|
invalid_api_key | API key is invalid or expired | Check your API key |
rate_limit_exceeded | Too many requests | Wait and retry |
quota_exceeded | Monthly quota exceeded | Upgrade plan |
invalid_model | Model doesn't exist | Check available models |
content_policy_violation | Content violates policies | Review and modify content |
pii_detection_failed | PII detection failed | Remove sensitive data |
Q: How do I debug API issues?
A: Enable detailed logging:
const client = new CloakrClient({
apiKey: process.env.CLOAKR_API_KEY,
debug: true, // Enable debug logging
logLevel: 'verbose'
});
// Monitor requests and responses
client.on('request', (data) => {
console.log('Request:', data);
});
client.on('response', (data) => {
console.log('Response:', data);
});
client.on('error', (error) => {
console.error('Error:', error);
});
Compliance & Security
Q: Is Cloakr.ai SOC 2 compliant?
A: Yes, Cloakr.ai maintains SOC 2 Type II compliance with annual audits covering:
- Security: Protection against unauthorized access
- Availability: System availability and performance
- Processing Integrity: Accurate and complete processing
- Confidentiality: Protection of confidential information
- Privacy: Protection of personal information
Q: How does GDPR compliance work?
A: Cloakr.ai provides GDPR compliance features:
// Right to be forgotten
await client.deleteUserData({
userId: 'user_123',
dataTypes: ['chat_history', 'personal_info']
});
// Data portability
const userData = await client.exportUserData({
userId: 'user_123',
format: 'json'
});
// Consent management
await client.updateConsent({
userId: 'user_123',
consentType: 'data_processing',
granted: true
});
Q: What about HIPAA compliance?
A: Cloakr.ai provides HIPAA-compliant features for healthcare:
const hipaaClient = new CloakrClient({
apiKey: process.env.CLOAKR_API_KEY,
compliance: {
hipaa: true,
phiDetection: true,
auditTrail: true
}
});
Integration Questions
Q: How do I integrate Cloakr.ai with my existing application?
A: Integration is straightforward:
// 1. Install the SDK
npm install @cloakrai/sdk
// 2. Initialize the client
const client = new CloakrClient({
apiKey: process.env.CLOAKR_API_KEY
});
// 3. Replace direct API calls
// Before: OpenAI API call
// const response = await openai.chat.completions.create({...});
// After: Cloakr.ai call
const response = await client.chat({
model: 'gpt-4o',
prompt: 'Your prompt here'
});
Q: Can I use Cloakr.ai with my existing OpenAI integration?
A: Yes, Cloakr.ai is designed to be a drop-in replacement:
// Replace OpenAI client
// const openai = new OpenAI({ apiKey: process.env.OPENAI_API_KEY });
// With Cloakr client
const client = new CloakrClient({
apiKey: process.env.CLOAKR_API_KEY
});
// Same API interface
const response = await client.chat({
model: 'gpt-4o',
prompt: 'Hello world'
});
Q: How do I migrate from direct API calls?
A: Follow this migration guide:
- Install SDK:
npm install @cloakrai/sdk
- Update imports: Replace OpenAI imports with Cloakr imports
- Update client initialization: Use CloakrClient instead of OpenAI
- Update API calls: Replace
openai.chat.completions.create
withclient.chat
- Test thoroughly: Verify all functionality works as expected
Support & Resources
Q: Where can I get help?
A: Multiple support channels are available:
- Documentation: This comprehensive guide
- Dashboard: Cloakr Dashboard
- Email Support: support@cloakr.ai
- Community: Discord Server
- GitHub: GitHub Issues
Q: How do I report a bug?
A: Report bugs through:
- GitHub Issues: Create an issue with detailed information
- Email: Send detailed bug report to support@cloakr.ai
- Dashboard: Use the feedback form in the dashboard
Include:
- Error message and stack trace
- Steps to reproduce
- Environment details (SDK version, language, etc.)
- Expected vs actual behavior
Q: Can I request new features?
A: Yes, feature requests are welcome:
- GitHub Issues: Create a feature request issue
- Email: Send feature request to support@cloakr.ai
- Discord: Discuss with the community
Next Steps
- Quickstart - Get started quickly
- API Reference - Complete API documentation
- SDK Tutorials - Integration examples
- Security & Compliance - Security features