Simple Integration
Integrate Cypher into your existing workflow in just a few lines of code.
import { Cypher } from 'cypher';
import OpenAI from 'openai';
// Initialize Cypher with your API key
const cypher = new Cypher({
apiKey: 'YOUR_CYPHER_API_KEY'
});
// Initialize your AI client
const openai = new OpenAI({
apiKey: 'YOUR_OPENAI_API_KEY'
});
async function getSecureCompletion() {
const userPrompt = "What are the quarterly earnings for Q3?";
try {
// Encrypt the prompt before sending
const encryptedPrompt = await cypher.encrypt(userPrompt);
// Securely call the AI model
const completion = await openai.chat.completions.create({
messages: [{ role: 'user', content: encryptedPrompt }],
model: 'gpt-4-turbo',
});
const encryptedResponse = completion.choices[0].message.content;
// Decrypt the response for your use
const decryptedResponse = await cypher.decrypt(encryptedResponse);
console.log('Secure Response:', decryptedResponse);
} catch (error) {
console.error("Error:", error);
}
}
getSecureCompletion();