A purely-browser playground π that lets any OpenAI-compatible LLM π§ generate complete Wokwi simulation projects π οΈ (diagram.json, firmware/source, supporting files) from natural-language prompts π¬, and runs them live in an embedded Wokwi simulator β‘.
The LLM is fully user-supplied π§βπ»: you provide a base URL, API key π, and model id - works with OpenAI, OpenRouter, Groq, Ollama, vLLM, LM Studio, Together, DeepInfra, Fireworks, and anything else that speaks /chat/completions π£οΈ.
It's a static site - no build step π.
git clone https://github.com/PythonicVarun/llm-circuit-builder.git
cd llm-circuit-builder
python3 -m http.server 8000
# open http://localhost:8000Or with any static server (npx serve ., caddy file-server, etc.) π».
β οΈ Open overhttp://localhost(notfile://), otherwise the Wokwi iframe can'tpostMessageback π.
- The Wokwi iframe πΌοΈ (
wokwi.com/experimental/embed) posts aMessagePortπͺ to the parent on load. - We wrap that port in
WokwiClientπ¦ (the protocol from wokwi/wokwi-embed-example). - The LLM π§ is instructed to reply with a fenced
```wokwi-projectJSON block π§±:{ "explanation": "β¦", "files": { "diagram.json": "β¦", "sketch.ino": "β¦" }, "start": { "firmware": "sketch.ino", "elf": "sketch.ino" } } - Each file is uploaded via
file:uploadπ€, thensim:startπ¬ kicks off the simulation. - Serial output is streamed back into the on-page monitor πΊ.
- Every generated file is kept in an on-page file explorer ποΈ with nested-folder support (so the LLM is free to organise output into
src/,lib/, etc.). One click downloads the whole project as a.zipπ¦, or you can save any single file.
Click Settings βοΈ in the top right. Fields:
| Field | Example |
|---|---|
| π API base URL | https://api.openai.com/v1 |
| π API key | sk-β¦ |
| π€ Model ID | gpt-4o-mini |
Presets are included for OpenAI, OpenRouter, Groq, and Ollama ποΈ. Values are stored in localStorage only π - nothing leaves your browser except the chat-completion calls themselves π‘οΈ.
- π
index.html- layout - π¨
styles.css- phosphor-on-slate UI - π§
app.js- orchestrator (LLM β Wokwi β DOM) - π€
llm.js- OpenAI-compatible streaming client + system prompt - ποΈ
zip.js- zero-dep STORE-method ZIP builder + path-to-tree grouping - π
wokwi-client.js,message-port-transport.js,base64.js- Wokwi embed protocol (MIT, CodeMagic LTD)
Wokwi embed protocol from https://github.com/wokwi/wokwi-embed-example (MIT, Β© 2025 CodeMagic LTD) β¨.
This project is licensed under the MIT License. βοΈ