Chapter 5: Calling the OpenAI API in Code
In the previous chapter, we looked at calling the OpenAI API using Postman. In this chapter, you'll learn how to start using the API in code. Since the OpenAI API can be used with virtually any programming language, we'll take a look at two popular languages, JavaScript and Python. If you're not a programmer, no problem. We'll be using an online environment that makes getting started with code super simple. Plus, easy-to-follow code examples are provided in both JavaScript and Python so you can choose the language that is most comfortable for you. Also, for clarity, the examples are purposely written with as little code as possible. So, the examples may not always follow coding best practices, but the goal is to make following along easy!
The topics we'll cover in this chapter are as follows:
- Choosing your programming language
- Introducing replit.com
- Using the OpenAI API with Node.js/JavaScript ...