@activepieces/piece-cometapi 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,71 @@
1
+ # Comet API Piece for Activepieces
2
+
3
+ This is a Comet API integration for Activepieces that allows users to access multiple AI models through a unified interface.
4
+
5
+ ## Features
6
+
7
+ - ✅ Support for multiple AI models (GPT, Claude, Gemini, DeepSeek, etc.)
8
+ - ✅ Dynamic model list loading
9
+ - ✅ Complete parameter configuration (temperature, max_tokens, top_p)
10
+ - ✅ Detailed error handling
11
+ - ✅ Custom API call support
12
+ - ✅ API key validation
13
+
14
+ ## Supported Models
15
+
16
+ ### GPT Series
17
+ - gpt-5-chat-latest
18
+ - chatgpt-4o-latest
19
+ - gpt-4o-mini
20
+ - gpt-5-mini
21
+ - gpt-5-nano
22
+
23
+ ### Claude Series
24
+ - claude-opus-4-1-20250805
25
+ - claude-sonnet-4-20250514
26
+ - claude-3-7-sonnet-latest
27
+ - claude-3-5-haiku-latest
28
+
29
+ ### Gemini Series
30
+ - gemini-2.5-pro
31
+ - gemini-2.5-flash
32
+ - gemini-2.0-flash
33
+
34
+ ### Other Models
35
+ - DeepSeek series (deepseek-v3.1, deepseek-v3, deepseek-r1-0528)
36
+ - Grok series (grok-4-0709, grok-3, grok-3-mini)
37
+ - Qwen series (qwen3-30b-a3b, qwen3-coder-plus-2025-07-22)
38
+
39
+ ## Usage
40
+
41
+ ### 1. Get API Key
42
+ 1. Visit: https://www.cometapi.com/
43
+ 2. Register an account and login
44
+ 3. Go to API settings page to get your API key
45
+
46
+ ### 2. Configure in Activepieces
47
+ 1. Create a new flow in Activepieces
48
+ 2. Add the "Comet API" piece
49
+ 3. Configure your API key
50
+ 4. Select the AI model to use
51
+ 5. Enter your prompt
52
+
53
+ ### 3. Available Actions
54
+
55
+ #### Ask Comet API
56
+ Send prompts to any AI model supported by Comet API.
57
+
58
+ **Parameters:**
59
+ - **Model**: The AI model to use
60
+ - **Prompt**: The prompt text to send to the AI
61
+ - **System Message** (optional): System message to set AI behavior
62
+ - **Temperature** (optional): Controls randomness (0-2)
63
+ - **Max Tokens** (optional): Maximum tokens to generate
64
+ - **Top P** (optional): Nucleus sampling parameter (0-1)
65
+
66
+ #### Custom API Call
67
+ Directly call any endpoint of the Comet API.
68
+
69
+ ## Build
70
+
71
+ Run `nx build pieces-cometapi` to build the library.
package/package.json ADDED
@@ -0,0 +1,32 @@
1
+ {
2
+ "name": "@activepieces/piece-cometapi",
3
+ "version": "0.0.1",
4
+ "type": "commonjs",
5
+ "main": "./src/index.js",
6
+ "types": "./src/index.d.ts",
7
+ "dependencies": {
8
+ "@sinclair/typebox": "0.34.11",
9
+ "axios": "1.8.3",
10
+ "axios-retry": "4.4.1",
11
+ "deepmerge-ts": "7.1.0",
12
+ "mime-types": "2.1.35",
13
+ "nanoid": "3.3.8",
14
+ "semver": "7.6.0",
15
+ "tslib": "^2.3.0",
16
+ "zod": "3.25.76",
17
+ "@activepieces/pieces-common": "0.7.0",
18
+ "@activepieces/pieces-framework": "0.20.1",
19
+ "@activepieces/shared": "0.20.1"
20
+ },
21
+ "overrides": {
22
+ "@tryfabric/martian": {
23
+ "@notionhq/client": "$@notionhq/client"
24
+ },
25
+ "vite": {
26
+ "rollup": "npm:@rollup/wasm-node"
27
+ }
28
+ },
29
+ "resolutions": {
30
+ "rollup": "npm:@rollup/wasm-node"
31
+ }
32
+ }
package/src/index.d.ts ADDED
@@ -0,0 +1 @@
1
+ export declare const cometapi: import("@activepieces/pieces-framework").Piece<import("@activepieces/pieces-framework").SecretTextProperty<true>>;
package/src/index.js ADDED
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.cometapi = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_framework_1 = require("@activepieces/pieces-framework");
6
+ const shared_1 = require("@activepieces/shared");
7
+ const pieces_common_1 = require("@activepieces/pieces-common");
8
+ const auth_1 = require("./lib/common/auth");
9
+ const ask_cometapi_1 = require("./lib/actions/ask-cometapi");
10
+ exports.cometapi = (0, pieces_framework_1.createPiece)({
11
+ displayName: 'CometAPI',
12
+ description: 'Access multiple AI models through CometAPI - unified interface for GPT, Claude, Gemini, and more.',
13
+ auth: auth_1.cometApiAuth,
14
+ minimumSupportedRelease: '0.36.1',
15
+ logoUrl: 'https://cdn.activepieces.com/pieces/cometapi.png',
16
+ categories: [shared_1.PieceCategory.ARTIFICIAL_INTELLIGENCE],
17
+ authors: ['TensorNull'],
18
+ actions: [
19
+ ask_cometapi_1.askCometApiAction,
20
+ (0, pieces_common_1.createCustomApiCallAction)({
21
+ baseUrl: () => auth_1.BASE_URL,
22
+ auth: auth_1.cometApiAuth,
23
+ authMapping: (auth) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
24
+ return {
25
+ Authorization: `Bearer ${auth}`,
26
+ };
27
+ }),
28
+ }),
29
+ ],
30
+ triggers: [],
31
+ });
32
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/pieces/community/cometapi/src/index.ts"],"names":[],"mappings":";;;;AAAA,qEAA6D;AAC7D,iDAAqD;AACrD,+DAAwE;AACxE,4CAA2D;AAC3D,6DAA+D;AAElD,QAAA,QAAQ,GAAG,IAAA,8BAAW,EAAC;IAClC,WAAW,EAAE,UAAU;IACvB,WAAW,EACT,mGAAmG;IACrG,IAAI,EAAE,mBAAY;IAClB,uBAAuB,EAAE,QAAQ;IACjC,OAAO,EAAE,kDAAkD;IAC3D,UAAU,EAAE,CAAC,sBAAa,CAAC,uBAAuB,CAAC;IACnD,OAAO,EAAE,CAAC,YAAY,CAAC;IACvB,OAAO,EAAE;QACP,gCAAiB;QACjB,IAAA,yCAAyB,EAAC;YACxB,OAAO,EAAE,GAAG,EAAE,CAAC,eAAQ;YACvB,IAAI,EAAE,mBAAY;YAClB,WAAW,EAAE,CAAO,IAAI,EAAE,EAAE;gBAC1B,OAAO;oBACL,aAAa,EAAE,UAAU,IAAI,EAAE;iBAChC,CAAC;YACJ,CAAC,CAAA;SACF,CAAC;KACH;IACD,QAAQ,EAAE,EAAE;CACb,CAAC,CAAC"}
@@ -0,0 +1,8 @@
1
+ export declare const askCometApiAction: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").SecretTextProperty<true>, {
2
+ model: import("@activepieces/pieces-framework").DropdownProperty<string, true>;
3
+ prompt: import("@activepieces/pieces-framework").LongTextProperty<true>;
4
+ systemMessage: import("@activepieces/pieces-framework").LongTextProperty<false>;
5
+ temperature: import("@activepieces/pieces-framework").NumberProperty<false>;
6
+ maxTokens: import("@activepieces/pieces-framework").NumberProperty<false>;
7
+ topP: import("@activepieces/pieces-framework").NumberProperty<false>;
8
+ }>;
@@ -0,0 +1,129 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.askCometApiAction = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_framework_1 = require("@activepieces/pieces-framework");
6
+ const pieces_common_1 = require("@activepieces/pieces-common");
7
+ const auth_1 = require("../common/auth");
8
+ const zod_1 = require("zod");
9
+ const props_1 = require("../common/props");
10
+ exports.askCometApiAction = (0, pieces_framework_1.createAction)({
11
+ name: 'ask-cometapi',
12
+ displayName: 'Ask CometAPI',
13
+ description: 'Sends a prompt to any AI model supported by CometAPI.',
14
+ auth: auth_1.cometApiAuth,
15
+ props: {
16
+ model: props_1.modelIdDropdown,
17
+ prompt: pieces_framework_1.Property.LongText({
18
+ displayName: 'Prompt',
19
+ required: true,
20
+ description: 'The prompt to send to the AI model.',
21
+ }),
22
+ systemMessage: pieces_framework_1.Property.LongText({
23
+ displayName: 'System Message',
24
+ required: false,
25
+ description: 'Optional system message to set the behavior of the AI.',
26
+ }),
27
+ temperature: pieces_framework_1.Property.Number({
28
+ displayName: 'Temperature',
29
+ required: false,
30
+ description: 'Controls randomness (0-2). Lower values make output more focused.',
31
+ defaultValue: 1.0,
32
+ }),
33
+ maxTokens: pieces_framework_1.Property.Number({
34
+ displayName: 'Max Tokens',
35
+ required: false,
36
+ description: 'Maximum number of tokens to generate.',
37
+ defaultValue: 1000,
38
+ }),
39
+ topP: pieces_framework_1.Property.Number({
40
+ displayName: 'Top P',
41
+ required: false,
42
+ description: 'Controls diversity via nucleus sampling (0-1).',
43
+ defaultValue: 1.0,
44
+ }),
45
+ },
46
+ run(context) {
47
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
48
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
49
+ // Validate input parameters
50
+ yield pieces_common_1.propsValidation.validateZod(context.propsValue, {
51
+ temperature: zod_1.z.number().min(0).max(2).optional(),
52
+ topP: zod_1.z.number().min(0).max(1).optional(),
53
+ maxTokens: zod_1.z.number().positive().optional(),
54
+ });
55
+ const { model, prompt, systemMessage, temperature, maxTokens, topP } = context.propsValue;
56
+ // Build messages array
57
+ const messages = [];
58
+ if (systemMessage) {
59
+ messages.push({
60
+ role: 'system',
61
+ content: systemMessage,
62
+ });
63
+ }
64
+ messages.push({
65
+ role: 'user',
66
+ content: prompt,
67
+ });
68
+ // Build request body
69
+ const requestBody = {
70
+ model: model,
71
+ messages: messages,
72
+ };
73
+ // Add optional parameters
74
+ if (temperature !== undefined)
75
+ requestBody['temperature'] = temperature;
76
+ if (maxTokens !== undefined)
77
+ requestBody['max_tokens'] = maxTokens;
78
+ if (topP !== undefined)
79
+ requestBody['top_p'] = topP;
80
+ // Build request
81
+ const request = {
82
+ url: 'https://api.cometapi.com/v1/chat/completions',
83
+ method: pieces_common_1.HttpMethod.POST,
84
+ body: requestBody,
85
+ authentication: {
86
+ type: pieces_common_1.AuthenticationType.BEARER_TOKEN,
87
+ token: context.auth,
88
+ },
89
+ headers: {
90
+ 'Content-Type': 'application/json',
91
+ },
92
+ };
93
+ try {
94
+ const response = yield pieces_common_1.httpClient.sendRequest(request);
95
+ const responseContent = (_b = (_a = response.body.choices[0]) === null || _a === void 0 ? void 0 : _a.message) === null || _b === void 0 ? void 0 : _b.content;
96
+ if (!responseContent) {
97
+ throw new Error('No response content received from API');
98
+ }
99
+ return {
100
+ response: responseContent.trim(),
101
+ model: response.body.model,
102
+ usage: response.body.usage,
103
+ };
104
+ }
105
+ catch (error) {
106
+ // Detailed error handling
107
+ const errorObj = error;
108
+ if (((_c = errorObj.response) === null || _c === void 0 ? void 0 : _c.status) === 401) {
109
+ throw new Error('Authentication failed: Please check your API key.');
110
+ }
111
+ if (((_d = errorObj.response) === null || _d === void 0 ? void 0 : _d.status) === 429) {
112
+ throw new Error('Rate limit exceeded: Please try again later.');
113
+ }
114
+ if (((_e = errorObj.response) === null || _e === void 0 ? void 0 : _e.status) === 400) {
115
+ const errorMessage = ((_h = (_g = (_f = errorObj.response) === null || _f === void 0 ? void 0 : _f.body) === null || _g === void 0 ? void 0 : _g.error) === null || _h === void 0 ? void 0 : _h.message) || 'Bad request parameters';
116
+ throw new Error(`Request parameter error: ${errorMessage}`);
117
+ }
118
+ if (((_j = errorObj.response) === null || _j === void 0 ? void 0 : _j.status) === 404) {
119
+ throw new Error(`Model not found: ${model}`);
120
+ }
121
+ if (((_k = errorObj.response) === null || _k === void 0 ? void 0 : _k.status) && errorObj.response.status >= 500) {
122
+ throw new Error('Server error: Please try again later.');
123
+ }
124
+ throw new Error(`Request failed: ${errorObj.message || 'Unknown error'}`);
125
+ }
126
+ });
127
+ },
128
+ });
129
+ //# sourceMappingURL=ask-cometapi.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ask-cometapi.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/cometapi/src/lib/actions/ask-cometapi.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,+DAMqC;AACrC,yCAA8C;AAC9C,6BAAwB;AACxB,2CAAkD;AA2BrC,QAAA,iBAAiB,GAAG,IAAA,+BAAY,EAAC;IAC5C,IAAI,EAAE,cAAc;IACpB,WAAW,EA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;gBAED,IAAI,CAAA,MAAA,QAAQ,CAAC,QAAQ,0CAAE,MAAM,KAAI,QAAQ,CAAC,QAAQ,CAAC,MAAM,IAAI,GAAG,EAAE,CAAC;oBACjE,MAAM,IAAI,KAAK,CAAC,uCAAuC,CAAC,CAAC;gBAC3D,CAAC;gBAED,MAAM,IAAI,KAAK,CAAC,mBAAmB,QAAQ,CAAC,OAAO,IAAI,eAAe,EAAE,CAAC,CAAC;YAC5E,CAAC;QACH,CAAC;KAAA;CACF,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const BASE_URL = "https://api.cometapi.com/v1";
2
+ export declare const cometApiAuth: import("@activepieces/pieces-framework").SecretTextProperty<true>;
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.cometApiAuth = exports.BASE_URL = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_common_1 = require("@activepieces/pieces-common");
6
+ const pieces_framework_1 = require("@activepieces/pieces-framework");
7
+ const markdownDescription = `
8
+ Follow these instructions to get your CometAPI Key:
9
+
10
+ 1. Visit the CometAPI Dashboard: https://api.cometapi.com/console/token
11
+ 2. Go to the API settings page to get your key.
12
+ 3. Copy the key and paste it below.
13
+ `;
14
+ exports.BASE_URL = 'https://api.cometapi.com/v1';
15
+ exports.cometApiAuth = pieces_framework_1.PieceAuth.SecretText({
16
+ description: markdownDescription,
17
+ displayName: 'API Key',
18
+ required: true,
19
+ validate: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
20
+ try {
21
+ yield pieces_common_1.httpClient.sendRequest({
22
+ url: exports.BASE_URL + '/models',
23
+ authentication: {
24
+ type: pieces_common_1.AuthenticationType.BEARER_TOKEN,
25
+ token: auth,
26
+ },
27
+ method: pieces_common_1.HttpMethod.GET,
28
+ });
29
+ return { valid: true };
30
+ }
31
+ catch (_b) {
32
+ return {
33
+ valid: false,
34
+ error: 'Invalid API Key.',
35
+ };
36
+ }
37
+ }),
38
+ });
39
+ //# sourceMappingURL=auth.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/cometapi/src/lib/common/auth.ts"],"names":[],"mappings":";;;;AAAA,+DAIqC;AACrC,qEAA2D;AAE3D,MAAM,mBAAmB,GAAG;;;;;;CAM3B,CAAC;AAEW,QAAA,QAAQ,GAAG,6BAA6B,CAAC;AAEzC,QAAA,YAAY,GAAG,4BAAS,CAAC,UAAU,CAAC;IAC/C,WAAW,EAAE,mBAAmB;IAChC,WAAW,EAAE,SAAS;IACtB,QAAQ,EAAE,IAAI;IACd,QAAQ,EAAE,KAAiB,EAAE,oDAAZ,EAAE,IAAI,EAAE;QACvB,IAAI,CAAC;YACH,MAAM,0BAAU,CAAC,WAAW,CAAC;gBAC3B,GAAG,EAAE,gBAAQ,GAAG,SAAS;gBACzB,cAAc,EAAE;oBACd,IAAI,EAAE,kCAAkB,CAAC,YAAY;oBACrC,KAAK,EAAE,IAAc;iBACtB;gBACD,MAAM,EAAE,0BAAU,CAAC,GAAG;aACvB,CAAC,CAAC;YAEH,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;QACzB,CAAC;QAAC,WAAM,CAAC;YACP,OAAO;gBACL,KAAK,EAAE,KAAK;gBACZ,KAAK,EAAE,kBAAkB;aAC1B,CAAC;QACJ,CAAC;IACH,CAAC,CAAA;CACF,CAAC,CAAC"}
@@ -0,0 +1 @@
1
+ export declare const modelIdDropdown: import("@activepieces/pieces-framework").DropdownProperty<string, true>;
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.modelIdDropdown = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_common_1 = require("@activepieces/pieces-common");
6
+ const pieces_framework_1 = require("@activepieces/pieces-framework");
7
+ const auth_1 = require("./auth");
8
+ exports.modelIdDropdown = pieces_framework_1.Property.Dropdown({
9
+ displayName: 'Model',
10
+ refreshers: [],
11
+ required: true,
12
+ options: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
13
+ if (!auth) {
14
+ return {
15
+ placeholder: 'Please connect your account first.',
16
+ disabled: true,
17
+ options: [],
18
+ };
19
+ }
20
+ const response = yield pieces_common_1.httpClient.sendRequest({
21
+ url: auth_1.BASE_URL + '/models',
22
+ authentication: {
23
+ type: pieces_common_1.AuthenticationType.BEARER_TOKEN,
24
+ token: auth,
25
+ },
26
+ method: pieces_common_1.HttpMethod.GET,
27
+ });
28
+ return {
29
+ disabled: false,
30
+ options: response.body.data.map((model) => ({
31
+ label: `${model.id} (${model.owned_by})`,
32
+ value: model.id,
33
+ })),
34
+ };
35
+ }),
36
+ });
37
+ //# sourceMappingURL=props.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"props.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/cometapi/src/lib/common/props.ts"],"names":[],"mappings":";;;;AAAA,+DAIqC;AACrC,qEAA0D;AAC1D,iCAAkC;AAErB,QAAA,eAAe,GAAG,2BAAQ,CAAC,QAAQ,CAAC;IAC/C,WAAW,EAAE,OAAO;IACpB,UAAU,EAAE,EAAE;IACd,QAAQ,EAAE,IAAI;IACd,OAAO,EAAE,KAAiB,EAAE,oDAAZ,EAAE,IAAI,EAAE;QACtB,IAAI,CAAC,IAAI,EAAE,CAAC;YACV,OAAO;gBACL,WAAW,EAAE,oCAAoC;gBACjD,QAAQ,EAAE,IAAI;gBACd,OAAO,EAAE,EAAE;aACZ,CAAC;QACJ,CAAC;QAED,MAAM,QAAQ,GAAG,MAAM,0BAAU,CAAC,WAAW,CAE1C;YACD,GAAG,EAAE,eAAQ,GAAG,SAAS;YACzB,cAAc,EAAE;gBACd,IAAI,EAAE,kCAAkB,CAAC,YAAY;gBACrC,KAAK,EAAE,IAAc;aACtB;YACD,MAAM,EAAE,0BAAU,CAAC,GAAG;SACvB,CAAC,CAAC;QAEH,OAAO;YACL,QAAQ,EAAE,KAAK;YACf,OAAO,EAAE,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;gBAC1C,KAAK,EAAE,GAAG,KAAK,CAAC,EAAE,KAAK,KAAK,CAAC,QAAQ,GAAG;gBACxC,KAAK,EAAE,KAAK,CAAC,EAAE;aAChB,CAAC,CAAC;SACJ,CAAC;IACJ,CAAC,CAAA;CACF,CAAC,CAAC"}