Dynamically Fetching GPT Model Information on WordPress

Hello

I’m developing a WordPress plugin to dynamically fetch and display GPT model information using the OpenAI API.
Despite setting up a custom REST API endpoint and using AJAX for data retrieval, I’m encountering issues with invalid model IDs and API responses.

What I’ve Done:

  1. REST API Endpoint Registration: Created a custom endpoint in WordPress to handle GET requests for model information.
  2. AJAX Implementation: Used jQuery to fetch data from the custom endpoint and display it on the frontend.
  3. Model ID Extraction: Extracted model IDs from URLs like https://chatgpt.com/g/g-Ct5uhVvs3-swiss-legal-expert.

Key Questions:

How can I correctly extract valid model IDs for use with the OpenAI API?

Any advice or solutions would be greatly appreciated!