#Unexpected High Token Usage in GPT-4o API Response

1 messages · Page 1 of 1 (latest)

fading jacinthBOT
#

Hi @swift marten. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:

#

Hello,

Based on the information provided in the knowledge sources, there could be several reasons for the unexpectedly high token usage in your GPT-4o API response.

  1. Image Size: The token usage for images is based on the detail and tiles, but this is not calculated. The internal resizing of the smallest side of the image is what makes even up to 1024x1024 take 4 “tiles” that are 512x512 in the detail:high mode. For an image 640x640, detail:low will make it only cost 85 tokens with the image being downsized to 512x512 internally. If your image is larger than this, it could result in higher token usage (source (https://community.openai.com/t/743297)).

  2. Input Structure: The token usage of input is not calculated based on the sent JSON, but on the language the AI receives, needing the role, name, message, tools to be constructed into the plain text with the overhead of unjoinable container tokens. Then images (source (https://community.openai.com/t/758778)).

  3. File Search Tool: If you have the file_search tool enabled along with an attached vector store, this could explain the high input tokens (source (https://community.openai.com/t/903755)).

  4. GPT-4o vs GPT-4 Turbo: It has been observed that GPT-4o uses more tokens by default compared to GPT-4 Turbo. This could be due to the fact that GPT-4o automatically uses the file search, but GPT-4 won’t do it on its own unless you turn on the force to use the file_search (source (https://community.openai.com/t/763075)).

#

If none of these factors seem to apply to your situation, it might be worth reaching out to OpenAI support for further assistance. They may be able to provide more specific insights based on your exact API usage.

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: