A React + Express example demonstrating dynamic model selection with the useChat hook.
-
Install dependencies:
pnpm install
-
Create environment file:
cp .env.example .env
-
Add your Dedalus API key to
.env:DEDALUS_API_KEY=your-api-key-here -
Run both the server and client:
pnpm start
Or run them separately:
# Terminal 1 - Express server pnpm run server # Terminal 2 - Vite dev server pnpm run dev
-
Open http://localhost:5173 in your browser.
- Dropdown to select between GPT-4o, GPT-4o Mini, and Claude Sonnet 4.5
- Uses
transport.bodyto dynamically send the selected model with each request
react-express-model-select/
├── App.tsx # Chat UI with model selector
├── main.tsx # React entry point
├── index.html # HTML template
├── server.ts # Express server with model parameter support
├── .env.example
├── package.json
├── tsconfig.json
└── vite.config.ts