#Consuming more tokens than expected - vision - gpt-4o

1 messages · Page 1 of 1 (latest)

echo karma
#

I need some clarification regarding the Vision API. According to the documentation, an image with "low detail" should use only 85 tokens. However, when I run the command below, I’m seeing approximately 305 prompt_tokens in the response.
Is this behavior expected?

curl --location 'https://api.openai.com/v1/chat/completions'
--header 'Authorization: <TOKEN>'
--header 'Content-Type: application/json'
--data '{
"model": "gpt-4o",
"messages": [
{
"role": "user",
"content": [
{
"type": "text",
"text": "Describe image"
},
{
"type": "image_url",
"image_url": {
"url": "https://upload.wikimedia.org/wikipedia/commons/thumb/d/dd/Gfp-wisconsin-madison-the-nature-boardwalk.jpg/2560px-Gfp-wisconsin-madison-the-nature-boardwalk.jpg",
"detail": "low"
}
}
]
}
]
}'

weary nexusBOT
#

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

#

It seems like you're experiencing higher token usage than expected when using the Vision API with the "low detail" setting. According to the documentation, images with "low detail" should indeed use 85 tokens. However, the total token count in a request can be influenced by several factors beyond just the image token cost.

Here are some considerations that might explain the higher token usage:

  1. Text Tokens: The text content in your request, such as "Describe image," also consumes tokens. Each word and character in the text contributes to the total token count.

  2. Overhead Tokens: There might be additional tokens used for structuring the request, such as JSON formatting and metadata, which can add to the total token count.

  3. Model Processing: The model might use additional tokens internally for processing and understanding the context of the request, which can also contribute to the total token count.

If you continue to see discrepancies, it might be helpful to review the request structure and ensure that all components are accounted for in the token calculation. Additionally, you can refer to the OpenAI API documentation for more details on token usage and limits.

If the issue persists and you believe it might be a bug or an unexpected behavior, consider reaching out to OpenAI support for further assistance.

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