There isn’t much more than what is already in the logs.
Usually this sort of error seems to be related to the prompt or a temporary error, which is why I asked if your prompt might be too long or too complex.
You could also increase the timeout, but I’m not sure it matches the 504 error:
from openai import OpenAI
client = OpenAI(
# increase default timeout to 15 minutes (from 10 minutes)
timeout=900.0
)
And if possible, you can also make a http request instead of using the API, in which case you would receive http response headers with extra details.
Here are a few other cases for reference: