Tickd.ai
← The Tickd Guide

Tutorials & Guides

How to Build a Multi-Model Prompt Playground in the Browser Using Claude 3.5 Sonnet and Gemini 1.5 Flash

Tired of switching tabs to compare LLM outputs? Build a local, side-by-side prompt evaluation sandbox running on Claude 3.5 Sonnet and Gemini 1.5 Flash.

Updated 10/29/2026

Why Every Builder Needs a Local Playground

When you are building AI applications, your prompt is your code. Yet, many developers are still testing their system prompts by copying and pasting text across the Anthropic Console, Google AI Studio, and various browser tabs. It is a disjointed workflow that hides how different models evaluate instructions.

Claude 3.5 Sonnet and Gemini 1.5 Flash have drastically different reasoning styles. Claude prioritises strict semantic boundaries and excels at complex technical output. Gemini, on the other hand, is built for scale, speed, and massive context windows. To discover which model works best for your production workflows, you need to see them compete side-by-side on the same prompt input.

We are going to build a clean, local-first HTML-and-Node.js playground. Using this tool, you can punch in a single system instruction, run your query, and view the raw outputs side-by-side, complete with execution times and latency metrics.

Which AI should I use for this?

Tickd is independent and not affiliated with any AI company.

The Architecture

To keep things lightweight, we will avoid heavy frontend frameworks like React or Next.js. We will build our system using: A simple Express API backend* to securely handle API keys, make network requests, and bypass CORS limits. A Tailwind CSS frontend dashboard* that visualises our queries side-by-side in real-time.

Project Initialisation

Create a new directory for your prompt environment and set up your npm workspace:

`bash mkdir prompt-sandbox && cd prompt-sandbox npm init -y npm install express @anthropic-ai/sdk @google/generative-ai dotenv cors npm install --save-dev @types/express @types/node ts-node typescript npx tsc --init `

Create a .env file in the root to hold your API keys securely:

`env ANTHROPIC_API_KEY=your_anthropic_api_key GEMINI_API_KEY=your_gemini_api_key PORT=3000 `

Step 1: Building the Express Proxy Server

Because calling AI models directly from the browser throws cross-origin errors and exposes your API secrets, we will write a tiny proxy runner. Create a file called server.ts:

`typescript import express, { Request, Response } from 'express'; import cors from 'cors'; import dotenv from 'dotenv'; import Anthropic from '@anthropic-ai/sdk'; import { GoogleGenAI } from '@google/generative-ai';

dotenv.config();

const app = express(); app.use(cors()); app.use(express.json());

const anthropicClient = new Anthropic({ apiKey: process.env.ANTHROPIC_API_KEY }); const geminiClient = new GoogleGenAI({ apiKey: process.env.GEMINI_API_KEY });

app.post('/api/run', async (req: Request, res: Response): Promise<void> => { const { systemPrompt, userPrompt } = req.body;

if (!userPrompt) { res.status(400).json({ error: 'User prompt is required.' }); return; }

// Execute calls in parallel to preserve latency benchmarks const [claudeResult, geminiResult] = await Promise.all([ runClaude(systemPrompt, userPrompt), runGemini(systemPrompt, userPrompt) ]);

res.json({ claude: claudeResult, gemini: geminiResult }); });

async function runClaude(system: string, user: string) { const start = Date.now(); try { const response = await anthropicClient.messages.create({ model: 'claude-3-5-sonnet-20241022', max_tokens: 2000, system: system || undefined, messages: [{ role: 'user', content: user }] }); const duration = (Date.now() - start) / 1000; // Safely extract text content const text = response.content[0].type === 'text' ? response.content[0].text : ''; return { success: true, text, duration }; } catch (error: any) { return { success: false, text: error.message, duration: 0 }; } }

async function runGemini(system: string, user: string) { const start = Date.now(); try { const model = geminiClient.getGenerativeModel({ model: 'gemini-1.5-flash', systemInstruction: system || undefined }); const response = await model.generateContent(user); const duration = (Date.now() - start) / 1000; return { success: true, text: response.response.text(), duration }; } catch (error: any) { return { success: false, text: error.message, duration: 0 }; } }

const PORT = process.env.PORT || 3000; app.listen(PORT, () => { console.log(Sandbox backend active at http://localhost:${PORT}); }); `

Step 2: Creating the Frontend Interface

To serve the interface, create an index.html file inside your project directory. We will pull Tailwind directly from a CDN to speed up prototyping. This workspace gives you clear views of what makes both systems tick under the hood.

`html <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Local LLM Playground</title> <script src="https://cdn.tailwindcss.com"></script> </head> <body class="bg-zinc-950 text-zinc-100 min-h-screen flex flex-col font-sans">

<header class="border-b border-zinc-800 p-4 bg-zinc-900"> <h1 class="text-xl font-bold tracking-tight text-indigo-400">Local LLM Playground</h1> </header>

<main class="flex-1 max-w-7xl w-full mx-auto p-6 flex flex-col gap-6"> <!-- Inputs Section --> <div class="bg-zinc-900 p-5 rounded-lg border border-zinc-800 flex flex-col gap-4"> <div> <label class="block text-xs uppercase tracking-wider text-zinc-400 mb-1">System Instructions (Optional)</label> <textarea id="system-prompt" rows="2" placeholder="e.g. You are an API mapping assistant. Respond only with structured Markdown tables..." class="w-full bg-zinc-950 border border-zinc-800 rounded p-3 text-sm focus:outline-none focus:border-indigo-500"></textarea> </div> <div> <label class="block text-xs uppercase tracking-wider text-zinc-400 mb-1">User Input Prompt</label> <textarea id="user-prompt" rows="3" placeholder="Type your primary query prompt here..." class="w-full bg-zinc-950 border border-zinc-800 rounded p-3 text-sm focus:outline-none focus:border-indigo-500"></textarea> </div> <button id="run-btn" class="bg-indigo-600 hover:bg-indigo-500 text-white font-semibold py-2 px-4 rounded text-sm transition self-end"> Execute Comparison </button> </div>

<!-- Parallel Output Grids --> <div class="grid grid-cols-1 md:grid-cols-2 gap-6 flex-1"> <!-- Claude 3.5 Sonnet Container --> <div class="bg-zinc-900 rounded-lg border border-zinc-800 flex flex-col overflow-hidden"> <div class="bg-zinc-800/50 p-3 border-b border-zinc-800 flex justify-between items-center"> <span class="font-semibold text-orange-400">Claude 3.5 Sonnet</span> <span id="claude-time" class="text-xs text-zinc-400">Waiting...</span> </div> <pre id="claude-output" class="p-4 text-sm text-zinc-300 overflow-auto flex-1 whitespace-pre-wrap leading-relaxed min-h-[300px]">Run an execution call to see Claude's breakdown.</pre> </div>

<!-- Gemini 1.5 Flash Container --> <div class="bg-zinc-900 rounded-lg border border-zinc-800 flex flex-col overflow-hidden"> <div class="bg-zinc-800/50 p-3 border-b border-zinc-800 flex justify-between items-center"> <span class="font-semibold text-blue-400">Gemini 1.5 Flash</span> <span id="gemini-time" class="text-xs text-zinc-400">Waiting...</span> </div> <pre id="gemini-output" class="p-4 text-sm text-zinc-300 overflow-auto flex-1 whitespace-pre-wrap leading-relaxed min-h-[300px]">Run an execution call to see Gemini's breakdown.</pre> </div>

</div> </main>

<script> const runBtn = document.getElementById('run-btn'); const systemInput = document.getElementById('system-prompt'); const userInput = document.getElementById('user-prompt'); const claudeOutput = document.getElementById('claude-output'); const claudeTime = document.getElementById('claude-time'); const geminiOutput = document.getElementById('gemini-output'); const geminiTime = document.getElementById('gemini-time');

runBtn.addEventListener('click', async () => { const systemPrompt = systemInput.value; const userPrompt = userInput.value;

if (!userPrompt.trim()) { alert('Please fill out the user prompt field.'); return; }

runBtn.innerText = 'Comparing Models...'; runBtn.disabled = true; claudeOutput.innerText = 'Streaming response...'; geminiOutput.innerText = 'Streaming response...'; claudeTime.innerText = 'Calculating...'; geminiTime.innerText = 'Calculating...';

try { const response = await fetch('http://localhost:3000/api/run', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ systemPrompt, userPrompt }) });

const data = await response.json();

// Update Claude's Column if (data.claude.success) { claudeOutput.innerText = data.claude.text; claudeTime.innerText = ${data.claude.duration}s; } else { claudeOutput.innerText = Error: ${data.claude.text}; claudeTime.innerText = 'Failed'; }

// Update Gemini's Column if (data.gemini.success) { geminiOutput.innerText = data.gemini.text; geminiTime.innerText = ${data.gemini.duration}s; } else { geminiOutput.innerText = Error: ${data.gemini.text}; geminiTime.innerText = 'Failed'; }

} catch (err) { alert('Unable to connect to the local API proxy. Did you run the ts-node backend server?'); } finally { runBtn.innerText = 'Execute Comparison'; runBtn.disabled = false; } }); </script> </body> </html> `

Running the Multi-Model Environment

In your terminal, boot up the Express server:

`bash npx ts-node server.ts `

Now, double-click or run index.html inside your browser. Type an instruction in the system box, formulate your question, and click Execute Comparison.

Practical Experiments to Run: * **Logic Test**: Ask both models to solve a spatial geometry riddle without reasoning chains. Compare Sonnet's precision against Gemini's immediate top-line conclusion. * **Code Output Consistency**: Paste a JSON payload into the input block and request a custom parsable format. This lets you observe how they handle strict structuring requests. * **Troubleshooting**: If either window returns an auth or rate limit code block, check out our [/platforms/claude/articles](Claude developer guide) and [/platforms/gemini/articles](Gemini troubleshooting logs) for deep resolution steps.

Now you have a zero-maintenance benchmark dashboard running completely on your own machine. For more prompting strategies you can test inside this sandbox, visit our custom /prompts.

claudegeminiprompt-engineeringjavascripttooling

Keep going

Build something with the prompt generator, decode the jargon in the glossary, or compare the tools on our platform deep-dives.