i want exactly this only in python with ahk.

"; ai-tools-ahk - AutoHotkey scripts for AI tools
;
https: // NAME_1.com/NAME_2/ai-tools-ahk
       ;
MIT License

#Requires AutoHotkey v2 .0
#singleInstance force
#Include jjson.ahk
#include _Cursor.ahk

    Persistent SendMode "Input"

    ;
#init setup if not(FileExist("settings.ini")) {
api_key
    : =
          InputBox("Enter your OpenAI API key", "AI-Tools-AHK : Setup",
                   "W400 H100")
              .value if (api_key == ""){
                  MsgBox("To use this script, you need to enter an OpenAI key. "
                         "Please restart the script and try again.")
                      ExitApp} FileCopy("settings.ini.default", "settings.ini")
                  IniWrite(api_key, ".\settings.ini", "settings",
                           "default_api_key")
}
RestoreCursor()

    ;
#globals _settingsCache : = Map() _lastModified : =
fileGetTime("./settings.ini") _displayResponse : = false _activeWin
    : = "" _oldClipboard : = "" _debug
    : = GetSetting("settings", "debug", false) _reload_on_change
    : = GetSetting("settings", "reload_on_change", false)

    ;
#CheckSettings()

;
#menu InitPopupMenu() InitTrayMenu()

;
#hotkeys

HotKey GetSetting("settings", "hotkey_1"),
    (*) = > (SelectText()
                 PromptHandler(GetSetting("settings", "hotkey_1_prompt")))

                HotKey GetSetting("settings", "hotkey_2"),
    (*) = > (SelectText() ShowPopupMenu())

                HotKey GetSetting("settings", "menu_hotkey"),
    (*) = > (ShowPopupMenu())

    ;
## #

    ShowPopupMenu(){_iMenu.Show()}

PromptHandler(promptName, append
              : = false) {
  try {

    global _running : = true global _startTime
        : = A_TickCount

          ShowWaitTooltip() SetSystemCursor(
              GetSetting("settings", "cursor_wait_file", "wait"))

              prompt : = GetSetting(promptName, "prompt") promptEnd
        : = GetSetting(promptName, "prompt_end") mode
        : = GetSetting(promptName, "mode",
                       GetSetting("settings", "default_mode")) input
        : = GetTextFromClip()

              CallAPI(mode, promptName, prompt, input, promptEnd)

  } catch as err {
    global _running : = false RestoreCursor() MsgBox Format(
                          "{1}: {2}.`n`nFile:`t{3}`nLine:`t{4}`nWhat:`t{5}",
                          type(err), err.Message, err.File, err.Line, err.What),
                    , 16;
    throw err
  }
}

;
## #

    SelectText() {
  if WinActive ("ahk_exe WINWORD.EXE")
    or W Provide your reponse without using the word message.
user