Created
July 27, 2023 09:26
Chat GPT estimation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const requestPrice = 0.003; | |
const responsePrice = 0.004; | |
const initialPromptSizeInTokens = 500; | |
const averageRequestTokens = 40; | |
const averageResponseTokens = 100; | |
const conversationTimeInMinutes = 15; | |
const messagesPerMinute = 2; | |
let totalConversationCost = 0; | |
let contextSizeTokens = 0; | |
for (let i = 0; i < conversationTimeInMinutes * messagesPerMinute; i++) { | |
contextSizeTokens += averageRequestTokens + averageResponseTokens; | |
const currentRequestPrice = (initialPromptSizeInTokens + averageRequestTokens + contextSizeTokens) / 1000 * requestPrice; | |
const currentResponsePrice = averageResponseTokens / 1000 * responsePrice; | |
totalConversationCost += currentRequestPrice + currentResponsePrice; | |
} | |
console.log(totalConversationCost); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment