Problems with Ask AI

Describe the bug
I tried the Ask AI feature today for the first time. The job was relatively simple:

i want to take selected text or clipboard content and translate it to english in a hud from which I can select the translation; bound to a BTT key binding

It started working quickly but after making 5 blank items in my keyboard shortcuts seemed to think it was succesful:

I asked if it could try a different method and give me JSON saved to my desktop,

then I tried to import it but still nothing. Here is the generated JSON that does’t look quite right:

[
  {
    "©TriggerType": 769,
    "©TriggerClass": "BTTTriggerTypeKeyboardShortcut",
    "©Enabled": 1,
    "©TriggerName": "Translate Selection/Clipboard to English",
    "©TriggerConfig": {
      "keyCode": 117,
      "modifiers": 0,
      "keyString": "F5"
    },
    "BTTActions": [
      {
        "BTTTriggerActionConfig": {
          "BTTAction": "BTTGetClipboardContentAction",
          "BTTActionConfig": {
            "BTTClipboardContent": ""
          }
        }
      },
      {
        "BTTTriggerActionConfig": {
          "BTTAction": "BTTJavaScriptAction",
          "BTTActionConfig": {
            "BTTJavaScript": "async function translateText() {\n    // Get clipboard content from previous action\n    let text = BTT.get_action_value(1);\n    \n    if (!text || text.trim() === '') {\n        // If no text in clipboard, try to get selected text\n        text = await BTT.get_selected_text();\n    }\n    \n    if (!text || text.trim() === '') {\n        BTT.display_notification('No text to translate', 'Error');\n        return '';\n    }\n    \n    // Use a translation API (Google Translate free API)\n    try {\n        let response = await fetch('https://translate.googleapis.com/translate_a/single?client=gtx&sl=auto&tl=en&dt=t&q=' + encodeURIComponent(text));\n        let result = await response.json();\n        let translation = result[0][0][0];\n        return translation;\n    } catch (error) {\n        BTT.display_notification('Translation failed: ' + error.message, 'Error');\n        return text;\n    }\n}\n\nreturn await translateText();",
            "BTTOnlyExecuteIfPreviousActionSucceeded": 1
          }
        }
      },
      {
        "BTTTriggerActionConfig": {
          "BTTAction": "BTTShowHUDWithTextAction",
          "BTTActionConfig": {
            "BTTText": "TRANSLATED_TEXT",
            "BTTWidth": 500,
            "BTTHeight": 300,
            "BTTBackgroundColor": "255, 255, 255, 255",
            "BTTFontColor": "0, 0, 0, 255",
            "BTTFont": "Helvetica",
            "BTTFontSize": 14,
            "BTTAllowTextSelection": 1,
            "BTTBorderType": 2,
            "BTTOnlyExecuteIfPreviousActionSucceeded": 1,
            "BTTUseCustomText": 1
          }
        }
      }
    ]
  }
]
```

Affected input device (e.g. MacBook Trackpad, Magic Mouse/Trackpad, Touch Bar, etc.):

keyboard.


Screenshots
If applicable, add screenshots to help explain your problem. (You can just paste or drag them here)


Device information:

  • Type of Mac: macbook air M2
  • macOS version: 26.4.1
  • BetterTouchTool version: 6.409

Additional information (e.g. crash logs, related issues, etc.):

What model did you use? (such complex tasks require pretty high end models). The LLM seems to have hallucinated most of the properties, so it probably didn't try to load the action definitions etc. first.

Hi Andreas, openrouter provided : arcee-ai/trinity-large-thinking Trinity Large Thinking - API Pricing & Providers | OpenRouter -- a relatively new model which has been working well in some other agentic workflows.

Some other details:

In the How to Import instructions it gave me there is no Manage Triggers button in the current UI, and also import failed but it didn't tell me it failed:

I'm not very versed in how the JSON import is supposed to work, so I imported it from "Import Preset"

You could send me the conversation log stored in ~/Library/Application Support/BetterTouchTool/AI/Conversations, that would at least show whether the model tried to follow the instructions and retrieve the details.

I currently mostly recommend gpt 5.4 or claude opus models for complex tasks. I will do some tests with the trinity model, maybe the prompts could be adjusted to make it work better.

Import won't work because most of the generated json is incorrect.

Conversations.zip (40.8 KB)

Three JSON files.

I usually use Chinese models like GLM5.1 (as I live in China), but do have a codex (and github copilot) subscription as well. I can try one of these providers for gpt 5.4 or claude. I chose the trinity model as it is currently leading on pinchbench https://pinchbench.com and I am experimenting with Hermes Agent on a locked down server.