Well done.
Although I should note, I believe there is a completely extraneous disk write here. I believe you can use pillow to directly read the bytes into memory before sending the image data to openai rather than doing disk write -> read from disk -> byte encode -> openai which is pretty inefficient.