I’m running a very simply C# method (in Unity) calling the API to create tags based on two strings, a name and a path, which together would constitute about 10-15 input tokens per item max. After about 30 calls, the API has registered about 471k input tokens, which seems entirely disproportionate. It averages at ~5.3k per request).
A system message is sent once during initialization, with instructions for how to handle inputs and outputs.
I would have expected the entire routine to be a maximum of 75,000 input tokens, spread over probably half an hour of processing time. Even the output tokens of 7k seem a bit excessive, considering it only processed 89 items in total, and it is returning at most about 50 tokens per item, usually less. I would have expected that to be about 4.5-5k. But least it is within 20%, the 450k of input tokens makes absolutely no sense.
private void InitializeGPT()
{
ApiKeyManager.LoadOpenAIKey(out string openApiKey);
OpenAIAPI api = new (openApiKey);
chat = api.Chat.CreateConversation();
chat.Model = Model.GPT4_Turbo;
chat.AppendSystemMessage(chatSystemMessage);
Debug.Log($"<color=#FEC90B><b><size=14>GPT Icon Tags initialized</size></b></color>");
}
private async void CreateTags()
{
int count = 0;
foreach ((string iconName, string iconPath) in spriteList)
{
chat.AppendUserInput($"{{name: {iconName}}}, {{path: {iconPath}}}");
try
{
string response = await chat.GetResponseFromChatbotAsync();
(string iconLabel, List<string> tags) = response.ParseIconTags();
iconDatabase.AddTagsWithLabel(iconLabel, tags);
Debug.Log($"Tags processed | Item: <color=#FEC90B><b><size=14>{iconLabel}</size></b></color>");
count++;
}
catch (Exception ex)
{
Debug.LogError($"Error processing tags for {iconName}: {ex.Message}");
}
}
Debug.Log($"<size=18><color=#40FE0B><b>All items processed: {count}</b></color></size>");
}
The instructions are about 400 tokens, sent as a single system message. As I’ve run the method about 10 times in early testing, then I would expect that system message to consume about 4000 input tokens in total.
The requests for the day is showing as 89 requests, which does make sense. But the number of input tokens makes zero sense.
Any thoughts?