Skip to content

Commit 117993a

Browse files
authored
Add GitHub Models AI backend script (via Copilot subscription) (#280)
* Add GitHub Models AI backend script (via Copilot subscription) * Minor fix to the description
1 parent 40123bc commit 117993a

File tree

2 files changed

+80
-0
lines changed

2 files changed

+80
-0
lines changed
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
import QtQml 2.0
2+
import QOwnNotesTypes 1.0
3+
4+
/**
5+
* This script adds GitHub Models to QOwnNotes, allowing you to use AI models
6+
* via your GitHub Copilot subscription through the GitHub Models inference API.
7+
*
8+
* Setup:
9+
* 1. Install this script in QOwnNotes (Settings > Scripting)
10+
* 2. Go to the script settings and enter your GitHub Personal Access Token
11+
* (create one at https://github.com/settings/tokens — fine-grained
12+
* with "Models: Read" permission, or a classic token)
13+
* 3. Once the script is active, you can choose the "GitHub" backend and
14+
* your preferred model
15+
*
16+
*/
17+
Script {
18+
property string githubToken;
19+
20+
property variant settingsVariables: [
21+
{
22+
"identifier": "githubToken",
23+
"name": "GitHub Personal Access Token",
24+
"description": "Enter your GitHub PAT (create at https://github.com/settings/tokens).\nFine-grained: enable 'Models: Read' permission.\nClassic: the 'models' scope is needed.",
25+
"type": "string-secret",
26+
"default": "",
27+
}
28+
];
29+
30+
function openAiBackendsHook() {
31+
if (!githubToken || githubToken === "") {
32+
return [];
33+
}
34+
35+
return [
36+
{
37+
"id": "github-models",
38+
"name": "GitHub",
39+
"baseUrl": "https://models.inference.ai.azure.com/chat/completions",
40+
"apiKey": githubToken,
41+
"models": [
42+
"gpt-4o",
43+
"gpt-4o-mini",
44+
"gpt-4.1",
45+
"gpt-4.1-mini",
46+
"gpt-4.1-nano",
47+
"gpt-5",
48+
"gpt-5-mini",
49+
"gpt-5-nano",
50+
"o4-mini",
51+
"o3",
52+
"o3-mini",
53+
"o1",
54+
"o1-mini",
55+
"deepseek-r1",
56+
"deepseek-r1-0528",
57+
"deepseek-v3-0324",
58+
"llama-4-scout-17b-16e-instruct",
59+
"llama-4-maverick-17b-128e-instruct-fp8",
60+
"llama-3.3-70b-instruct",
61+
"grok-3",
62+
"grok-3-mini",
63+
"mistral-small-2503",
64+
"phi-4",
65+
"phi-4-reasoning",
66+
],
67+
}
68+
];
69+
}
70+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"name": "GitHub Models AI backend (via Copilot subscription)",
3+
"identifier": "ai-github-copilot-backend",
4+
"script": "ai-github-copilot-backend.qml",
5+
"version": "0.0.1",
6+
"minAppVersion": "24.6.3",
7+
"authors": ["@nagelp"],
8+
"platforms": ["linux", "macos", "windows"],
9+
"description": "This script adds a <a href=\"https://github.com/marketplace/models\">GitHub</a> 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 <a href=\"https://github.com/settings/tokens\">GitHub Settings</a>) with 'Models: Read' permission."
10+
}

0 commit comments

Comments
 (0)