Syntax - Tasty Web Development Treats
Syntax - Tasty Web Development Treats

Coding with the Open AI / Chat GPT API

In this Hasty Treat, Scott and Wes talk about what can be done with the OpenAI API, how to get started with it, pricing, tuning your model, and gotchas for getting started with the OpenAI API. Sentry - Sponsor If you want to know what’s happening with your code, track errors and monitor performance

Featured Speakers

Wes Bos & Scott Tolinski - Full Stack JavaScript Web Developers HostScott Tolinski Guest

Topics Discussed

Episode Summary

Executive Summary: The episode explains how to use the OpenAI API from a JavaScript perspective, focusing on practical coding, pricing, token limits, and real-world workflows like podcast summarization. Wes and Scott discuss chat completions, image generation, speech-to-text, moderation, embeddings, and LangChain, emphasizing how cheap and flexible the APIs are while noting prompt engineering, context limits, and safety restrictions as important caveats.

Main Topics: OpenAI API basics and developer experience: The hosts outline how easy it is to sign up, get an API key, and start using the Node.js SDK with strong TypeScript support, clear errors, and simple methods for chat completion. Token-based pricing and cost considerations: They explain that OpenAI charges based on input and output tokens, making small projects inexpensive but raising concern for larger-scale business use. Summarization workflows and transcript processing: A major use case discussed is feeding podcast transcripts into OpenAI to summarize topics, generate timestamps, and compress long text recursively to fit token limits. Model options, limits, and rapid product changes: The episode compares GPT-3.5 Turbo and GPT-4, noting token limits, price differences, and how quickly OpenAI updates models and pricing. Other OpenAI APIs and use cases: They survey image generation/editing, Whisper speech-to-text, moderation, and embeddings, describing how each can support different product features. Prompt engineering and safety constraints: The hosts discuss how prompts need careful tuning for tone, first-person voice, and formatting, and how the model refuses certain illegal or harmful requests. LangChain and multi-model orchestration: They briefly cover LangChain as a JavaScript library for working with multiple LLMs and utilities like recursive text splitting and summarization.

Key Arguments: OpenAI’s API is unusually easy to start using compared with many developer platforms, especially because the Node SDK is straightforward and well-documented. Token-based pricing makes experimentation affordable, with a 25-minute podcast costing only a few cents to process, but repeated summarization and production-scale workloads can add up. Recursive summarization is a practical way to handle long inputs that exceed token limits, though it increases total cost because the model is called multiple times. Chat-based APIs require the full conversation history to be resent each time, so context is maintained by the client rather than stored in the model. GPT-4 is more expensive than GPT-3.5 Turbo, but the hosts argue that model upgrades can justify the cost because of higher quality and larger context windows. OpenAI’s ecosystem already supports multiple valuable workflows beyond chat, including image generation, transcription, moderation, and semantic search via embeddings. Prompt engineering matters a lot: the output style, persona, and formatting can be significantly improved by iterating on instructions. The APIs are powerful enough to support real product features like automated show-note generation, related-content recommendations, and AI-assisted developer tools.

Data Points: Podcast length used for cost example: 25 minutes - Used as an example transcript for summarization and token-cost estimation Token-to-word approximation: 1,000 tokens ≈ 750 words - Rule of thumb provided for estimating usage and pricing GPT-3.5 Turbo input cost: $0.002 per 1,000 tokens - Described as one-fifth of a cent per 1,000 tokens Estimated cost to summarize a 25-minute podcast: 3 cents - Approximate input cost to process one 25-minute transcript Estimated total cost including output: 3–4 cents - Input plus short output such as bullet points or hashtags GPT-4 context window: 8,000 tokens - Mentioned as four times larger than the earlier limit Extended GPT-4 context option: 32,000 tokens - Available at a higher per-token cost 3.5 Turbo vs prior version: 10x cheaper - Price drop that made experimentation more practical GPT-4 relative price: 15x more expensive - Compared with the then-current GPT-3.5 Turbo pricing Estimated fine-tuning cost for full catalog: About $400 - Back-of-the-napkin estimate to train on roughly 30,000 minutes of audio Podcast archive size for fine-tuning estimate: 30,000 minutes - Represents the back catalog of episodes discussed in the example

Pivotal Quotes: "Here's how you actually code it with JavaScript." — Wes Bos: Describing the episode’s practical focus compared with a previous high-level discussion "You are paying based on how much text you send it and how much text is returned from you." — Scott Tolinski: Explaining the token-based pricing model "As a machine, I cannot do the first person." — ChatGPT (reported by Scott): An example of the model resisting a requested writing style during prompt tuning

Implications: The episode suggests AI APIs are now cheap and accessible enough for practical product experimentation, but developers must manage token limits, context handling, safety constraints, and prompt quality. Expect rapid model changes and expanding use cases across content, search, and dev tooling.

🔓 Sign Up for Unlimited Episode Search

About Syntax - Tasty Web Development Treats

View all episodes from Syntax - Tasty Web Development Treats