cookbook/Architectural Patterns
Multi-Model Deliberation & Voting
Query Claude Sonnet and DeepSeek R1 concurrently and synthesize the best output.
Deliberation Implementation
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://unlockedai.net/v1",
apiKey: process.env.UNLOCKED_API_KEY,
});
async function deliberate(problemPrompt: string) {
// 1. Query Claude Sonnet and DeepSeek R1 concurrently
const [claudeRes, deepseekRes] = await Promise.all([
client.chat.completions.create({
model: "claude-sonnet-5.5",
messages: [{ role: "user", content: problemPrompt }],
}),
client.chat.completions.create({
model: "deepseek-r1",
messages: [{ role: "user", content: problemPrompt }],
}),
]);
const solA = claudeRes.choices[0].message.content;
const solB = deepseekRes.choices[0].message.content;
// 2. Synthesize using OpenAI o3
const synthesis = await client.chat.completions.create({
model: "o3",
messages: [
{
role: "system",
content: "You are an impartial judge. Compare Solution A and Solution B and produce the optimal unified solution.",
},
{
role: "user",
content: `Problem: ${problemPrompt}\n\nSolution A (Claude):\n${solA}\n\nSolution B (DeepSeek):\n${solB}`,
},
],
});
return synthesis.choices[0].message.content;
}Need an Unlocked AI Key or Credits?
Generate secret API keys backed by non-expiring pay-as-you-go credits starting at $5. No monthly minimums.