API times out when image_url forward slashes are escaped

when I hit https://api.openai.com/v1/chat/completions with an image_url formatted like {“url”:“http:\/\/…”} the api times out. it works if the forward slashes are not escaped.

the json spec allows forward slashes to be escaped or not so this is probably a bug in your parsing. my json is being produced by a “for json” query from sql server fwiw.

The issue is not whether or not JSON allows the character to be escaped—JSON allows escape characters. The issue is whether or not the API will process an escaped character.

Remember, you’re not sending JSON to the API.

You’ll have the best luck just unescaping the forward slashes, because I don’t think this is a bug.

not sure what you mean? maybe I was unclear, here is a repro:

this works:

curl -d '{"model":"gpt-4o","messages":[{"role":"system","content":[{"type":"text","text":"How much does this duck weight?"}]},{"role":"user","content":[{"type":"image_url","image_url":{"url":"https://assets.pbimgs.com/pbimgs/ab/images/dp/wcm/202322/0188/cast-stone-concrete-duck-garden-object-l.jpg"}}]}]}' -H 'Content-Type: application/json' -H 'Authorization: Bearer sk-xxx' -X POST https://api.openai.com/v1/chat/completions

this fails:

curl -d '{"model":"gpt-4o","messages":[{"role":"system","content":[{"type":"text","text":"How much does this duck weight?"}]},{"role":"user","content":[{"type":"image_url","image_url":{"url":"https:\/\/assets.pbimgs.com\/pbimgs\/ab\/images\/dp\/wcm\/202322\/0188\/cast-stone-concrete-duck-garden-object-l.jpg"}}]}]}' -H 'Content-Type: application/json' -H 'Authorization: Bearer sk-xxx' -X POST https://api.openai.com/v1/chat/completions

the only difference is that the forward slashes are escaped

What language are you working in?

It seems to work fine for me.

1 Like

ah it seems to be working now - I was consistently getting timeouts when sending escaped forward slashes before. if somebody just hotfixed this THANK YOU!