-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
48 lines (43 loc) · 1.49 KB
/
index.js
File metadata and controls
48 lines (43 loc) · 1.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import { tool } from "@opencode-ai/plugin/tool";
/**
* Thaura AI Plugin for OpenCode
*
* This plugin enables OpenCode to use Thaura AI as a provider.
* It provides an auth hook that integrates with OpenCode's /connect command,
* allowing users to authenticate with their Thaura API key.
*
* @see https://thaura.ai
* @see https://opencode.ai/docs/providers
*/
export const ThauraPlugin = async (ctx) => {
return {
auth: {
provider: "thaura",
methods: [{
type: "api",
label: "Thaura AI API Key",
prompts: [{
type: "text",
key: "apiKey",
message: "Enter your Thaura API key from https://backend.thaura.ai/api/api-keys",
placeholder: "tk_..."
}],
authorize: async (inputs) => {
// Validate key format
if (!inputs.apiKey) {
return { type: "failed" };
}
// Thaura keys start with tk_
if (!inputs.apiKey.startsWith("tk_")) {
console.warn("Warning: Thaura API keys typically start with 'tk_'");
}
return {
type: "success",
key: inputs.apiKey
};
}
}]
}
};
};
export default ThauraPlugin;