I'm not sure if this is a bug in the API or in the documentation (or my understanding), but according to https://platform.openai.com/docs/guides/vision a low detail image costs 85 tokens. But the usage field in the API response does not seem to reflect this:
➜ arcangel git:(main) ✗ curl https://api.openai.com/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-d '{
"model": "gpt-4o-mini",
"messages": [
{
"role": "user",
"content": [
{
"type": "text",
"text": "What’s in this 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"
}
}
]
}
],
"max_tokens": 300
}'
{
"id": "XXX",
"object": "chat.completion",
"created": 1722454358,
"model": "gpt-4o-mini-2024-07-18",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "The image depicts a serene landscape featuring a wooden boardwalk that stretches through lush green grass and vegetation. The sky is expansive with scattered clouds, suggesting a pleasant day. The scene evokes a sense of tranquility and connection to nature."
},
"logprobs": null,
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 2846,
"completion_tokens": 45,
"total_tokens": 2891
},
"system_fingerprint": "XXX"
}
Am I missing something or is this indeed a bug?