OpenAI Assistant File Preview URL - WRONG URL In API Response

I am using using OpenAI Assistant Code Interpreter in Apex Programming Language. I am asking the assistant to create a chart from a CSV I’ve provided. In addition, I am asking a download/preview link as well in the response.

If I run my assistant, it gives me fine response where file preview link is perfect. Like this:

<a href="https://fileserviceuploadsperm.blob.core.windows.net/files/file-94bljXXXXXXlAYJz9ksQjOk?se=2024-07-18T13%3A52%3A57Z&amp;sp=r&amp;sv=2023-11-03&amp;sr=b&amp;rscc=max-age%3D299%2C%20immutable%2C%20private&amp;rscd=attachment%3B%20filename%3DRockstar_Games_Yearly_Sales.png&amp;sig=vKICRn1n7DK7Ke92MzX%2BOHV9U4XXXXXwX/YPjQfhg%3D" target="_blank" rel="noopener noreferrer">Download the Yearly Total Sales Chart for Rockstar Games</a>

But when I do this in my Code, the API response give me a URL that doesn’t work. Like this:

You can download the chart using the link below:\n\n[Download Rockstar Games Yearly Sales Chart](sandbox:/mnt/data/rockstar_games_yearly_sales.png)

I saw some post where people were able to fix this in Python but no everyone has the luxury of Python. Can someone please explain why I am getting this? If there’s a fix for Apex or Java?

I solved it for Apex. Had to use

GET https://api.openai.com/v1/files/{file_id}/content

And do some file manipulation in apex.