I built this to solve a small problem of my own: I wanted a fast, opinionated AI assistant that could generate code and SVG art in one place, without switching between tabs.
What it is:
A chat interface deployed on Vercel. The backend is a single serverless function (/api/groq) that proxies requests to Groq's OpenAI-compatible API using openai/gpt-oss-20b. The API key lives in a Vercel environment variable, never in the client.
What's interesting about the implementation:
Serverless proxy pattern. The frontend never sees the API key. The function accepts a POST with
{ messages }, truncates the system prompt and user message to stay within token limits, and forwards to Groq.Custom markdown-ish formatter. The model is instructed to use
[b]…[/b]and[i]…[/i]instead of standard markdown, and the frontend parses both custom and standard markdown so replies render cleanly. Code blocks get language labels and a copy button.Rate-limit handling with a countdown. On a 429 from Groq, the UI shows a live countdown instead of a dead error, and re-enables the input when the window passes.
Paste handling. Pasted text is normalized (CRLF → LF, tabs → spaces) before it enters the textarea, so code snippets don't break the layout.
What I'd like feedback on:
The proxy function currently builds a fresh
messagesarray from only the system prompt and the latest user message. Multi-turn context is not preserved. Is there a clean pattern for keeping a bounded conversation history server-side without trusting the client to send it back?package.jsonstill pinsnode-fetch@2.6.7. On Vercel's Node 18+ runtime the globalfetchis available, so this dependency could be dropped. Any reason to keep it?
Link: https://sparrow-hawk-code-art-generator.vercel.app/ Repo: https://github.com/reyrove/Sparrow-Hawk-CodeArt-Generator
Happy to hear what you'd change.