Unexpected High Token Usage in GPT-4o API Response

Hi everyone,

I recently made a request to the GPT-4o API with the following cURL command, where I provided a text prompt and an image URL with the low detail setting:

curl https://api.openai.com/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_OPENAI_API_KEY" \
  -d '{
    "model": "gpt-4o",
    "messages": [
      {
        "role": "system",
        "content": "You are an assistant that analyzes images and text."
      },
      {
        "role": "user",
        "content": [
          {
            "type": "text",
            "text": "Describe this image:"
          },
          {
            "type": "image_url",
            "image_url": {
              "url": "https://images.pexels.com/photos/9729585/pexels-photo-9729585.jpeg",
              "detail": "low"
            }
          }
        ]
      }
    ]
  }'

According to the documentation, the low detail setting for image processing should only consume around 85 tokens. However, the API response indicates that usage.prompt_tokens=2862, which is significantly higher than expected.

I’m trying to understand why the token usage is so high. Has anyone encountered similar behavior or know what might be causing this discrepancy? Is there something wrong with how I’m structuring my request, or is it a known issue?

Any insights would be appreciated!

Thanks!

I just tested it and got:

CompletionUsage(completion_tokens=104, prompt_tokens=110, total_tokens=214)
3 Likes

Echoing @sps

I also just tried to reproduce the issue on my end.

I ran both cURL request as well as regular Python request. In both cases, the results were fairly normal:

  • cURL: prompt_tokens: 110, completion_tokens: 122
  • Python: prompt_tokens=95, completion_tokens=83

You definitely did not use gpt-4o-mini? When I ran it via mini I got a bit over 2k tokens, i.e. closer to your usage.

3 Likes

Yes, I was indeed using the gpt-4o-mini model, and it seems the documentation was not very clear that the mini version doesn’t perform that specific task. Thanks for pointing that out!

2 Likes