[2024] How to use ChatGPT API with Curl

KASATA - TechVoyager
5 min readAug 20, 2024

▼Introduction

There’s a very active ChatGPT conversation going on all over the internet!

In addition, OpenAI has been publishing an API of ChatGPT

The model is trained to take sentences in Japanese, English, and other languages as input and generate natural, human-generated text.

If you can get an answer from ChatGPT (or some other models) by using curl, that means you can embed ChatGPT into your apps!

I will share the way of

  • generating an API key
  • running ChatGPT in curl
  • running it as a shell script

in this article.

▼Generate API key

  • Access to

https://beta.openai.com/

  • Login

You can use a Social account sign-in like Google sign.

  • Access to View API keys
  • Click “Create new secret key”

--

--

KASATA - TechVoyager

Master of Applied Physics/Programmer/Optics/Condensed Matter Physics/Quantum Mechanics/AI/IoT/Python/C,C++/Swift/WEB/Cloud/VBA