Getting 400 error with the vision api

Hi Everybody,

I’m using this api :

but getting this error :

{
    "result": {
        "request": {
            "method": "POST",
            "url": "https://api.openai.com/v1/chat/completions",
            "querystring": null,
            "headers": {
                "Content-Type": "application/json",
                "Authorization": "Bearer sk-proj-aJpQkUGIy3nb27i974BaT3BlbkFJKXK9CGBAEWct9a3pQBC2"
            },
            "body": "{\n    \"model\": \"gpt-4-turbo\",\n    \"messages\": [\n      {\n        \"role\": \"user\",\n        \"content\": [\n          {\n            \"type\": \"text\",\n            \"text\": \"What are in these images? Is there any difference between them?\"\n          },\n          {\n            \"type\": \"image_url\",\n            \"image_url\": {\n              \"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\",\n            }\n          },\n          {\n            \"type\": \"image_url\",\n            \"image_url\": {\n              \"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\",\n            }\n          }\n        ]\n      }\n    ],\n    \"max_tokens\": 300\n  }",
            "data": null
        },
        "response": {
            "status": 400,
            "headers": {},
            "body": "{\n    \"error\": {\n        \"message\": \"We could not parse the JSON body of your request. (HINT: This likely means you aren't using your HTTP library correctly. The OpenAI API expects a JSON payload, but what was sent was not valid JSON. If you have trouble figuring out how to fix this, please contact us through our help center at help.openai.com.)\",\n        \"type\": \"invalid_request_error\",\n        \"param\": null,\n        \"code\": null\n    }\n}",
            "data": {
                "error": {
                    "message": "We could not parse the JSON body of your request. (HINT: This likely means you aren't using your HTTP library correctly. The OpenAI API expects a JSON payload, but what was sent was not valid JSON. If you have trouble figuring out how to fix this, please contact us through our help center at help.openai.com.)",
                    "type": "invalid_request_error",
                    "param": null,
                    "code": null
                }
            }
        }
    }
}

What should I have to do? Can you guys help me?

Thank you

Is this not supported? Really need to get this done quick.

Anyone? Buddies? Am I missing something? :sob:

I see at least one problem – the extra comma at the end of both your ‘url’ entries

2 Likes

@maurice3, man you’re truly awesome! It solved! Thank you so much! Open AI please update the docs! :joy: