From 5eb1bcbb760da93d3d9e9f4c1fba4a3ad08f9cbe Mon Sep 17 00:00:00 2001 From: Patrick Nagel Date: Thu, 26 Mar 2026 22:07:20 +0100 Subject: [PATCH 1/2] Add GitHub Models AI backend script (via Copilot subscription) --- .../ai-github-copilot-backend.qml | 70 +++++++++++++++++++ ai-github-copilot-backend/info.json | 10 +++ 2 files changed, 80 insertions(+) create mode 100644 ai-github-copilot-backend/ai-github-copilot-backend.qml create mode 100644 ai-github-copilot-backend/info.json diff --git a/ai-github-copilot-backend/ai-github-copilot-backend.qml b/ai-github-copilot-backend/ai-github-copilot-backend.qml new file mode 100644 index 0000000..54418d5 --- /dev/null +++ b/ai-github-copilot-backend/ai-github-copilot-backend.qml @@ -0,0 +1,70 @@ +import QtQml 2.0 +import QOwnNotesTypes 1.0 + +/** + * This script adds GitHub Models to QOwnNotes, allowing you to use AI models + * via your GitHub Copilot subscription through the GitHub Models inference API. + * + * Setup: + * 1. Install this script in QOwnNotes (Settings > Scripting) + * 2. Go to the script settings and enter your GitHub Personal Access Token + * (create one at https://github.com/settings/tokens — fine-grained + * with "Models: Read" permission, or a classic token) + * 3. Once the script is active, you can choose the "GitHub" backend and + * your preferred model + * + */ +Script { + property string githubToken; + + property variant settingsVariables: [ + { + "identifier": "githubToken", + "name": "GitHub Personal Access Token", + "description": "Enter your GitHub PAT (create at https://github.com/settings/tokens).\nFine-grained: enable 'Models: Read' permission.\nClassic: the 'models' scope is needed.", + "type": "string-secret", + "default": "", + } + ]; + + function openAiBackendsHook() { + if (!githubToken || githubToken === "") { + return []; + } + + return [ + { + "id": "github-models", + "name": "GitHub", + "baseUrl": "https://models.inference.ai.azure.com/chat/completions", + "apiKey": githubToken, + "models": [ + "gpt-4o", + "gpt-4o-mini", + "gpt-4.1", + "gpt-4.1-mini", + "gpt-4.1-nano", + "gpt-5", + "gpt-5-mini", + "gpt-5-nano", + "o4-mini", + "o3", + "o3-mini", + "o1", + "o1-mini", + "deepseek-r1", + "deepseek-r1-0528", + "deepseek-v3-0324", + "llama-4-scout-17b-16e-instruct", + "llama-4-maverick-17b-128e-instruct-fp8", + "llama-3.3-70b-instruct", + "grok-3", + "grok-3-mini", + "mistral-small-2503", + "phi-4", + "phi-4-reasoning", + ], + } + ]; + } +} diff --git a/ai-github-copilot-backend/info.json b/ai-github-copilot-backend/info.json new file mode 100644 index 0000000..601527a --- /dev/null +++ b/ai-github-copilot-backend/info.json @@ -0,0 +1,10 @@ +{ + "name": "GitHub Models AI backend (via Copilot subscription)", + "identifier": "ai-github-copilot-backend", + "script": "ai-github-copilot-backend.qml", + "version": "0.0.1", + "minAppVersion": "24.6.3", + "authors": ["@nagelp"], + "platforms": ["linux", "macos", "windows"], + "description": "This script adds a GitHub Models AI backend to QOwnNotes, allowing you to use AI models via your GitHub Copilot subscription through the GitHub Models inference API. You'll need a GitHub Personal Access Token (create at GitHub Settings) with 'Models: Read' permission." +} From 128a8b9e8e6b435f07ef4a0c4154d406d1a54cba Mon Sep 17 00:00:00 2001 From: Patrick Nagel Date: Thu, 26 Mar 2026 22:13:37 +0100 Subject: [PATCH 2/2] Minor fix to the description --- ai-github-copilot-backend/info.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ai-github-copilot-backend/info.json b/ai-github-copilot-backend/info.json index 601527a..ed339bb 100644 --- a/ai-github-copilot-backend/info.json +++ b/ai-github-copilot-backend/info.json @@ -6,5 +6,5 @@ "minAppVersion": "24.6.3", "authors": ["@nagelp"], "platforms": ["linux", "macos", "windows"], - "description": "This script adds a GitHub Models AI backend to QOwnNotes, allowing you to use AI models via your GitHub Copilot subscription through the GitHub Models inference API. You'll need a GitHub Personal Access Token (create at GitHub Settings) with 'Models: Read' permission." + "description": "This script adds a GitHub AI backend to QOwnNotes, allowing you to use AI models via your GitHub Copilot subscription through the GitHub Models inference API. You'll need a GitHub Personal Access Token (create at GitHub Settings) with 'Models: Read' permission." }