A minimal Node app with AI provider and language selectors. The server launches Chromium for each request, asks the selected provider for code in the chosen language, and copies the detected code block into the output field.
npm install
npx playwright install chromium
npm startFor debugging the live Duck.ai page:
KEEP_BROWSER_OPEN_AFTER_RESPONSE=true npm startOpen http://localhost:3000.
PORT— HTTP port, default3000.AI_PROVIDER— default provider (duck,lumo, ormistral), defaultduck.MISTRAL_AI_URL— Mistral Le Chat URL, defaulthttps://chat.mistral.ai/chat.DUCK_AI_URL— Duck.ai URL, defaulthttps://duck.ai/.LUMO_AI_URL— Proton Lumo URL, defaulthttps://lumo.proton.me/guest.PROMPT_TIMEOUT_MS— navigation/response timeout, default60000.HEADED_BROWSER=false— run Chromium headless. By default the browser is headed so it is visible during local debugging.KEEP_BROWSER_OPEN=true— legacy behavior that keeps the API request pending; avoid this during normal UI use.KEEP_BROWSER_OPEN_AFTER_RESPONSE=true— keep the browser open after the server has returned the response; useful for debugging without blocking the UI.
Supported languages are C++, Go, Java, Python, Rust, Swift, and Typescript.
Duck.ai’s DOM can change over time. The server first prefers accessible prompt and submit controls, then falls back to common textarea/form selectors. If the site changes substantially, update findPromptInput, submitPrompt, or readAssistantResponse in server.js.
This app is intended for local use. Add authentication, rate limiting, and request queuing before exposing it publicly. Duck.ai availability and any usage restrictions are outside this app’s control.