Sending incorrect JSON to GPT4 Vision still burns one of your requests

GPT4 Vision limits you to 100 requests a day.

I just found out that sending invalid JSON to that API burns one of those requests, even though you only get back an error message saying your JSON was not correct.

Here’s an example:

curl -i https://api.openai.com/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -d '{
    "model": "gpt-4-vision-preview",
    "response_format": {
        "type": "json_object"
    },
    "messages": [
        {
            "role": "user",
            "content": [
                {
                    "type": "text",
                    "text": "Provide alt text for this image"
                },
                {
                    "type": "image_url",
                    "image_url": {
                        "url": "https://niche-museums.imgix.net/pioneer-history-1.jpeg?w=400&auto=compress"
                    }
                }
            ]
        }
    ]
}'

I’m trying to use the response_format key here, which it turns out is not supported by the gpt-4-vision-preview model. I got back this error:

{
  "error": {
    "message": "1 validation error for Request\nbody -> response_format\n  extra fields not permitted (type=value_error.extra)",
    "type": "invalid_request_error",
    "param": null,
    "code": null
  }
}

But… the x-ratelimit-remaining-request header showed that my allowed requests had still reduced by one.

I think this limit should not be affected by invalid JSON requests like this.