Translation via chatGPT API

Hi, I need an extension that translates selected text from Polish to English using the GPT3turbo API. The selected text should be automatically replaced with the translated version. I am not a developer and don’t know anything about coding. I tried to use the code below (and many similar ones), but it’s not working. Every time I get an error saying “There is no application set to open the URL popclipext://return/…” or the translation button is not clickable.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "">
<plist version="1.0">
            <key>Script File</key>
            <string>Translate to English</string>
    <key>Required Software Version</key>


translated_text=$(curl -s -X POST "" \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer $api_key" \
    -d "{\"prompt\":\"Translate the following Polish text to English: '$selected_text'\",\"n\":1,\"max_tokens\":500,\"temperature\":0.5,\"top_p\":1,\"engine\":\"text-davinci-003.5-turbo\"}" \
    | python -c "import sys, json; print(json.load(sys.stdin)['choices'][0]['text'].strip())")

echo $translated_text

I don’t have access to GPT4 but even GPT3.5 Turbo is 100 better than Deep-L.

It doesn’t work either:

// #popclip
// name: Polish to English Translator
// icon: iconify:eos-icons:translate
// language: javascript
// after: paste-result
// entitlements: [network]
// options: [{identifier: apikey, label: API Key, type: string,
//   description: 'Obtain API key from'}] 
const axios = require("axios");
// base object for communicating with OpenAI
const openai = axios.create({
  baseURL: '',
  headers: { Authorization: `Bearer ${popclip.options.apikey}` }
// use the GPT-3.5-turbo model (note - can change/add other params here)
const data = {
  model: 'text-davinci-003.5-turbo',
  max_tokens: 100,
  temperature: 0.5,
  prompt: `Translate the following Polish text to English: '${popclip.input.text}'`
// send query to OpenAI's `completions` service
const response = await'completions', data);
// return the first text in the response