That's because GPT-4o's training cut-off is Sep 30, 2023 (see
https://platform.openai.com/docs/models/gpt-4o) and the OpenAI API has changed a LOT since then.
Claude 4 has a training cut-off of March 2025, I tried something today about its own API and it gave me useful code.