Image cropping using assistant playground works but fails when using assistant api

I am consistently getting the following error in the messages retrieval api:
ERROR: There seems to be an error while trying to access or process the uploaded image. Let me try again to ensure I follow the correct steps to resize the image as per your requirements.
Same jpg/png file when uploaded in the assistant playground works fine.
I checked the logs in the playground and I seem to be making the same api calls in the same order: files > threads > runs > steps > runstep until status=completed > runs (status check) until run-status=completed > messages (to retrieve the file) > [ERROR] > file-content to download the resized file

any idea what I could be doing wrong here? Any sample javascript program to see the orchestration of the assistant api calls?

Another observation was that in my program the runstep check would take a long time (almost 5-10 retries) and runs status check would take upto 15-20 retries (in loop) with 3 seconds timeout between calls. While on the assistant playground, there’s hardly 3 runsteps calls and 1-2 runs status call and the file is processed! :thinking: