Topic selected: Option A – Purely Technical: "Building a Secure AI Proxy for Browser Tools A developer demonstrates how to build a secure AI proxy using Cloudflare Workers to protect API keys when calling Groq or OpenAI from browser-based tools. The guide covers scaffolding a worker, storing keys as environment variables, and implementing request validation and CORS handling. This is the strongest choice. It teaches a tangible, highly demanded skill API key security with actual code, making the backlink to AfriWidget feel like a natural, neutral citation rather than a sales pitch. Here is the article, rewritten to be strictly technical, objective, and genuinely useful for dev.to readers. Stop Exposing Your AI API Keys: Build a Secure Proxy with Cloudflare Workers We have all seen it. You open the browser's DevTools on a "cutting-edge" AI startup's landing page, check the Network tab, and find a direct POST request to api.openai.com containing a plaintext API key in the headers. It is one of the most common—and dangerous—mistakes in modern web development. Exposing your LLM API key client-side is an open invitation for abuse, leading to stolen credits, hefty bills, and potential account suspension. The standard solution is the Backend-for-Frontend BFF proxy pattern. But how do you implement it practically, cheaply, and securely without spinning up a heavy Express server? In this guide, I will walk you through building a lightweight, serverless AI proxy using Cloudflare Workers to securely call Groq or OpenAI APIs from your browser-based calculators and tools. The Architecture: How It Works Instead of your frontend talking directly to the AI provider, we introduce a stateless middleware layer: Browser App → Cloudflare Worker Proxy → Groq/OpenAI API ↑ ↑ No API Key API Key stored securely in Worker env vars The Worker's responsibilities: Step 1: Scaffolding the Cloudflare Worker We will use the new create-cloudflare CLI. Make sure you have Node.js installed. npm create cloudflare@latest ai-proxy Choose "Hello World" worker and TypeScript. Once inside the directory, install the Groq SDK: npm install groq-sdk Step 2: Securing the API Key Never hardcode keys. Cloudflare Workers expose environment variables securely. Update your wrangler.toml: name = "ai-proxy" main = "src/index.ts" compatibility date = "2024-12-18" vars GROQ API KEY = "your-secret-key-here" Replace, but prefer using wrangler secret for production For production, set it as an actual secret to hide it from the dashboard: npx wrangler secret put GROQ API KEY Step 3: Writing the Worker Logic We need an endpoint that accepts POST requests, validates the input, calls Groq, and returns the result. Here is the full src/index.ts implementation: js import { Groq } from "groq-sdk"; export interface Env { GROQ API KEY: string; } export default { async fetch request: Request, env: Env : Promise