ChatGPT API – Setup Guide and Parameters Explained



Using the new ChatGPT API to make an essay writer. Explanation of parameters.

Works for models like gpt-3, gpt-3.5, gpt-4.
Use “gpt-4” instead if you have access to it.

Commands to install openai and tiktoken:
pip install openai
pip install tiktoken

If “pip” is not found, you have to install it. If it is already installed, try “pip3” instead.

Sample Code:
https://github.com/JosephChing/gpt-3.5-turbo-0301-demos

Link to api-key configuration:
https://platform.openai.com/account/api-keys

API documentation:
https://platform.openai.com/docs/guides/chat

tiktoken sample code for counting tokens:
https://github.com/openai/openai-cookbook/blob/main/examples/How_to_count_tokens_with_tiktoken.ipynb

Timestamps:

0:00 – Setup and Packages
0:12 – Billing and api-key
1:10 – Required Parameters
3:25 – User Input
3:34 – Counting Tokens
4:53 – Test Run
6:28 – Message List
6:55 – Formatting and Essay Prompt
7:48 – Stop parameter
8:16 – Presence Penalty
8:47 – Presence Penalty Demo
9:35 – Frequency Penalty
8:47 – Frequency Penalty Demo
11:16 – Temperature
11:54 – Temparture Demo
12:08 – Stream

6 comments
  1. Thank you so much for this video!! I’ve been reading the documentation and writing small apps in JavaScript, and Google app script. After watching your extremely clear and concise video it’s starting to all make sense!! Thank you

Comments are closed.