- This event has passed.
6 PM – AI Agent – Gamas
June 17 @ 6:00 pm - 7:00 pm
Today We Did
- We created OpenAI API Key.
- We pulled all available OpenAI models.
- We created simple chat program using gpt-5.4-mini model.
Homework
Change your main.py to do the following
- keep track of number of tokens you use within session. You need to create a global variable outside of the function to keep track of this.
- calculate the money spent for your token. Formula is (total token / 1000000) * 0.75.
- If you did it properly, you should be getting something like below
-
Enter your question: What is capital city of Indonesia? Tokens used: 28 Total tokens used: 28 Total money spent: $0.00020999999999999998 The capital city of Indonesia is **Jakarta**. Enter your question: What is capital city of Australia? Tokens used: 28 Total tokens used: 56 Total money spent: $0.00041999999999999996 The capital city of Australia is **Canberra**. Enter your question: What is the Java programming language? Tokens used: 113 Total tokens used: 169 Total money spent: $0.0012675 Java is a high-level, object-oriented programming language designed to be portable, secure, and widely applicable. Key points: - **Platform-independent:** Java code is compiled into **bytecode**, which runs on the **Java Virtual Machine (JVM)**, so the same program can run on different operating systems. - **Object-oriented:** It organizes code around **classes** and **objects**. - **Strongly typed:** Variables and expressions have specific types checked by the compiler. - Enter your question: