Live coding a streaming ChatGPT proxy with Swift OpenAPI—from scratch!
summary
Builds a type-safe ChatGPT client and a Linux proxy server from scratch and demonstrates they work live: generated code via Swift OpenAPI Generator, URLSession on macOS and AsyncHTTPClient on Linux, Vapor for the proxy. Streams upstream SSE into JSON Lines as an async sequence with no buffering upstream responses, maps chat payloads to a simplified API, and fixes stale model output by injecting roster data into the system prompt.
AI-written summary · about
chapters (14)
- 0:00Introduction
- 1:47Proxy server for ChatGPT
- 3:14Chant GPT use case
- 4:36Swift OpenAPI client
- 7:30Streaming CLI client
- 10:27Fixing CLI client
- 11:52Enhancing prompts
- 12:37Proxy server setup
- 14:25Proxy server logic
- 15:49Streaming responses
- 16:54Testing proxy with curl
- 17:37Proxy client for CLI
- 18:42CLI with proxy
- 19:24Final demo
related talks
39mFull Stack Swift Development
36mChatGPT with Laravel & beyond
15mSwift Chatbots for Fun! and Profit
07mServer-Side Swift Live Coding
25mChatGPT Unleashed: From Code Wizards To Silly Shenanigans!
05mChatGPT is poorly designed. So I fixed it
57mSmart Chat App with Vue, AI and Serverless Function Solution LIVE
28mScrew the Browser! Build ChatGPT via SMS
