cnezxp (text, doesn't expire)
#include <sourcemod>

public Plugin my_chatgpt_plugin = 
  new Plugin("My ChatGPT Plugin for TF2", "1.0", "Your Name");

public Action OnClientSay(int client, const char[] message) 
{
  if (StrContains(message, "Kog:", true) != -1) 
  {
    // Extract the message text without "Kog:"
    char[] msg_text[256];
    SubStr(message, 4, -1, msg_text, sizeof(msg_text));

    // Use the ChatGPT API to generate a response
    char[] response[256];
    MyChatGPTApi(msg_text, response);

    // Send the response to the chat
    PrintToChat(client, "Kog: %s", response);

    // Log the response for debugging purposes
    LogMessage("Generated response to \"%s\": \"%s\"", msg_text, response);
  }

  return Plugin_Handled;
}

public void MyChatGPTApi(const char[] input, char[] output) 
{
    // Define the API endpoint URL
    const char[] api_url = "https://api.openai.com/v1/engines/davinci-codex/completions";

    // Define the API request headers
    const char[] api_headers = "Content-Type: application/json\r\nAuthorization: Bearer YOUR_API_KEY";

    // Define the API request data
    char[] api_data[512];
    format(api_data, "{\"prompt\":\"%s\",\"max_tokens\":50,\"temperature\":0.5}", input);

    // Send the API request and get the response
    char[] api_response[2048];
    HTTPRequest(api_url, api_headers, api_data, api_response, sizeof(api_response), HTTPMETHOD_POST);

    // Parse the API response and extract the generated text
    char[] response_text[256];
    JSON_Object obj = JSON_Parse(api_response);
    JSON_Array choices = JSON_GetObjectItem(obj, "choices");
    JSON_Object choice = JSON_GetArrayItem(choices, 0);
    JSON_Object text = JSON_GetObjectItem(choice, "text");
    JSON_GetStringValue(text, response_text, sizeof(response_text));
    JSON_Delete(obj);

    // Copy the generated text to the output buffer
    CopyString(output, response_text, sizeof(output));
}