@acedatacloud/piece-gpt-image 0.1.0 → 0.1.2

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 CHANGED
@@ -2,26 +2,31 @@
2
2
 
3
3
  Create a GPT Image task and retrieve the **same task ID** through Ace Data Cloud. The Piece has two actions: **Create GPT Image task** and **Get GPT Image task**. Submission returns an ID; the image is ready only after the lookup reports `succeeded`.
4
4
 
5
- **Distribution:** Install `@acedatacloud/piece-gpt-image@0.1.0` as a custom Piece in your Activepieces instance. A public npm package does not automatically enter the shared Activepieces catalog. [中文指南](README.zh-CN.md)
5
+ **Distribution:** Install `@acedatacloud/piece-gpt-image@0.1.2` as a custom Piece in your Activepieces instance. A public npm package does not automatically enter the shared Activepieces catalog. [中文指南](README.zh-CN.md)
6
6
 
7
7
  ## Install and connect
8
8
 
9
- In Activepieces 0.92.2+, open **Platform Admin → Catalogue → Pieces → Install Piece → NPM Registry**. Enter `@acedatacloud/piece-gpt-image` and version `0.1.0`, then install it. Search for **GPT Image by Ace Data Cloud** when adding a flow action. Confirm the Ace Data Cloud logo and both actions.
9
+ In Activepieces 0.92.2+, open **Platform Admin → Catalogue → Pieces → Install Piece → NPM Registry**. Enter `@acedatacloud/piece-gpt-image` and version `0.1.2`, then install it. Search for **GPT Image by Ace Data Cloud** when adding a flow action. Confirm the Ace Data Cloud logo and both actions.
10
10
 
11
- Create a connection using an Ace Data Cloud API key with access to both `/openai/images/generations` and `/openai/tasks`. Enter only the key, without `Bearer `. Keep it in the connection, never in a flow export. Check current [pricing](https://platform.acedata.cloud/models) and balance before generation.
11
+ 1. Register or sign in at [Ace Data Cloud Applications](https://platform.acedata.cloud/console/applications?utm_source=opensource&utm_medium=referral&utm_campaign=evergreen&utm_content=gpt_image_activepieces_readme_api_key). If you have no General application, choose **Initialize General Application**.
12
+ 2. Open a General application or an application with **GPT Image** access. A General key can access the services your account is entitled to use; a service-specific key is limited to that service.
13
+ 3. Use the application's copy button, or choose **Manage Keys → Create** to create a separate key named `Activepieces GPT Image`. Set expiry and usage limits as needed. If you restrict **Allowed APIs**, include both `/openai/images/generations` and `/openai/tasks`, then copy the key.
14
+ 4. Create an Activepieces connection and enter only the API key, without `Bearer `. A `platform-...` management token is not a generation API key. Keep the key in the connection, never in a flow export. Check current [pricing](https://platform.acedata.cloud/models?utm_source=opensource&utm_medium=referral&utm_campaign=evergreen&utm_content=gpt_image_activepieces_readme_pricing) and balance before generation.
12
15
 
13
16
  ## First flow
14
17
 
15
- 1. Add **Create GPT Image task**. Enter a prompt, choose `gpt-image-2`, quality `low`, size `1024x1024`, and image count `1`.
16
- 2. Run creation **once** and save its `task_id`. The action uses `callback_url` to submit asynchronously and has no HTTP retry. If a timeout or 5xx occurs, inspect request history before submitting again: the task may already exist.
18
+ 1. Add **Create GPT Image task**. The **Model** and **Quality** dropdowns read the current public image-generation API catalog. Choose an exact model, including any supported compatibility alias. The original defaults remain `gpt-image-2`, quality `low`, size `1024x1024`, and image count `1`; choose values supported by your selected model.
19
+ 2. Run creation **once** and save its `task_id`. The action uses `callback_url` to submit asynchronously and has no HTTP retry. If a timeout or 5xx occurs, inspect [request history](https://platform.acedata.cloud/console/usages?utm_source=opensource&utm_medium=referral&utm_campaign=evergreen&utm_content=gpt_image_activepieces_readme_request_history) before submitting again: the task may already exist.
17
20
  3. Add **Get GPT Image task**. Map its **Task ID** from the creation output. Query this same ID until `status=succeeded` or `failed`. Pending media is never returned as final output.
18
21
  4. Open a URL from `media_urls` only after `success=true`. The lookup can alternatively use a trace ID if the original request supplied a custom trace ID and its task ID was lost. This creation action does not set a custom trace ID.
19
22
 
20
23
  The [credential-free quickstart flow](https://raw.githubusercontent.com/AceDataCloud/GPTImageActivepieces/main/examples/gpt-image-quickstart.json) imports with both connections empty and the task-ID mapping intact. Add your own connection before running it. Its creation action has automatic retries disabled.
21
24
 
22
- Image count is 1–10 and each successful image can incur a charge. `size` must use `WIDTHxHEIGHT`; the GPT Image 2 public guide gives current custom-size limits. A task lookup does not create or bill another image.
25
+ The validation snapshot contains 24 model IDs and eight quality values; the dropdowns read the current catalog when refreshed. DALL-E 2 uses `standard`; DALL-E 3 uses `standard` or `hd` and image count `1`. Other models have their own limits; consult the current API descriptions. Image count is 1–10 and each successful image can incur a charge. `size` accepts `auto` or `WIDTHxHEIGHT`. A task lookup does not create or bill another image.
23
26
 
24
- An isolated Activepieces CE 0.92.2 instance accepted the build archive and ran **Get GPT Image task** against an existing completed task. The flow returned `succeeded` and one final image URL. The creation action has not been used to submit a new paid image in this validation.
27
+ Catalog lookup is anonymous and sends no connection, prompt or API key. If metadata is unavailable, the dropdown shows an explicit error instead of a partial fallback list; refresh it to retry. Existing saved flows continue using their stored model IDs without a catalog lookup during execution. This Piece implements generation and task lookup; it does not yet expose an image-editing action.
28
+
29
+ Earlier validation in an isolated Activepieces CE 0.92.2 instance accepted the build archive and ran **Get GPT Image task** against an existing completed task. The flow returned `succeeded` and one final image URL. The creation action has not been used to submit a new paid image in this validation.
25
30
 
26
31
  ## Troubleshoot
27
32
 
@@ -35,3 +40,13 @@ An isolated Activepieces CE 0.92.2 instance accepted the build archive and ran *
35
40
  | `failed` or missing task | Check the task or trace ID and retention window. |
36
41
 
37
42
  The Piece sends chosen inputs and the API key only to `https://api.acedata.cloud`. It returns final media URLs and removes internal routing fields from task results. [Source](https://github.com/AceDataCloud/GPTImageActivepieces) · [Support](https://github.com/AceDataCloud/GPTImageActivepieces/issues) · dev@acedata.cloud.
43
+
44
+ Generation and task requests verify HTTPS certificates and stay on `api.acedata.cloud`. Public catalog reads use the fixed `platform.acedata.cloud` API schema endpoint without authentication, verify certificates, and do not follow redirects. Transport failures and HTTP errors are not retried automatically; inspect request history before resubmitting a creation. The Piece does not provide its own proxy setting.
45
+
46
+ ## Visual setup references
47
+
48
+ ![Copy a key or open Manage Keys: real redacted Ace console](docs/screenshots/get-api-key-en.png)
49
+ ![Create a dedicated key: real redacted Ace console](docs/screenshots/create-api-key-en.png)
50
+ ![Official Activepieces generic installation dialog](docs/screenshots/install-piece.png)
51
+
52
+ References reused on 2026-10-18; [fixed sources and limits](docs/screenshots/onboarding-source.json). The installation picture is an official generic reference, not proof this Piece is in the shared catalog. After administrator installation, search the service name, select **by Ace Data Cloud**, and keep the raw API key in the action connection. Source PR, immutable npm release, official shared-catalog acceptance and first use are separate stages.
package/README.zh-CN.md CHANGED
@@ -2,26 +2,31 @@
2
2
 
3
3
  通过 Ace Data Cloud 创建 GPT Image 任务,并按**同一个任务 ID**查询结果。Piece 提供 **Create GPT Image task** 和 **Get GPT Image task** 两个动作。提交返回 ID 并不代表图片已完成;查询到 `succeeded` 后才可使用成品。[English](README.md)
4
4
 
5
- **分发方式:**在 Activepieces 实例中将 `@acedatacloud/piece-gpt-image@0.1.0` 作为自定义 Piece 安装。公开 npm 包不会自动进入 Activepieces 共享目录。
5
+ **分发方式:**在 Activepieces 实例中将 `@acedatacloud/piece-gpt-image@0.1.2` 作为自定义 Piece 安装。公开 npm 包不会自动进入 Activepieces 共享目录。
6
6
 
7
7
  ## 安装与连接
8
8
 
9
- Activepieces 0.92.2+ 中进入 **Platform Admin → Catalogue → Pieces → Install Piece → NPM Registry**,填写 `@acedatacloud/piece-gpt-image` 和版本 `0.1.0`。在流程中搜索 **GPT Image by Ace Data Cloud**,核对 Ace Data Cloud Logo 和两个动作。
9
+ Activepieces 0.92.2+ 中进入 **Platform Admin → Catalogue → Pieces → Install Piece → NPM Registry**,填写 `@acedatacloud/piece-gpt-image` 和版本 `0.1.2`。在流程中搜索 **GPT Image by Ace Data Cloud**,核对 Ace Data Cloud Logo 和两个动作。
10
10
 
11
- 创建连接时使用同时有 `/openai/images/generations` 与 `/openai/tasks` 权限的 Ace Data Cloud API Key。只填写 Key 本身,不加 `Bearer `;Key 留在连接中,不写入流程导出。生成前查看当前[价格](https://platform.acedata.cloud/models)与余额。
11
+ 1. 在 [Ace Data Cloud Applications](https://platform.acedata.cloud/console/applications?utm_source=opensource&utm_medium=referral&utm_campaign=evergreen&utm_content=gpt_image_activepieces_readme_api_key) 注册或登录。若没有通用应用,点击 **Initialize General Application**。
12
+ 2. 打开通用应用或具备 **GPT Image** 权限的应用。通用 Key 可访问账号已获授权的服务;专用 Key 仅限对应服务。
13
+ 3. 使用应用卡片的复制按钮,或通过 **Manage Keys → Create** 创建名为 `Activepieces GPT Image` 的独立 Key,按需设置有效期与用量限制。若启用 **Allowed APIs**,应同时包含 `/openai/images/generations` 与 `/openai/tasks`,创建后复制 Key。
14
+ 4. 创建 Activepieces 连接,只填写 API Key 本身,不加 `Bearer `。`platform-...` 管理 Token 不是生成 API Key。Key 留在连接中,不写入流程导出。生成前查看当前[价格](https://platform.acedata.cloud/models?utm_source=opensource&utm_medium=referral&utm_campaign=evergreen&utm_content=gpt_image_activepieces_readme_pricing)与余额。
12
15
 
13
16
  ## 首次流程
14
17
 
15
- 1. 添加 **Create GPT Image task**,填写提示词,选择 `gpt-image-2`、`low`、`1024x1024` 和图片数量 `1`。
16
- 2. **只运行一次**创建动作,保存输出的 `task_id`。动作使用 `callback_url` 异步提交,不设置 HTTP 重试。若超时或返回 5xx,先查请求历史再考虑重提,任务可能已被接收。
18
+ 1. 添加 **Create GPT Image task**。**Model** 与 **Quality** 下拉框读取当前公开图片生成接口目录,选择精确型号及其支持的参数,目录包含兼容别名。原默认值仍为 `gpt-image-2`、`low`、`1024x1024` 和图片数量 `1`;切换型号后请核对参数支持范围。
19
+ 2. **只运行一次**创建动作,保存输出的 `task_id`。动作使用 `callback_url` 异步提交,不设置 HTTP 重试。若超时或返回 5xx,先查[请求历史](https://platform.acedata.cloud/console/usages?utm_source=opensource&utm_medium=referral&utm_campaign=evergreen&utm_content=gpt_image_activepieces_readme_request_history)再考虑重提,任务可能已被接收。
17
20
  3. 添加 **Get GPT Image task**,把 **Task ID** 映射为创建动作的输出。只查询同一个 ID,直至 `status=succeeded` 或 `failed`。pending 时不会把预览当作最终媒体。
18
21
  4. 仅当 `success=true` 时打开 `media_urls`。若原始请求自带自定义 Trace ID 且丢失任务 ID,也可按 Trace ID 查询;本 Piece 的创建动作不设置自定义 Trace ID。
19
22
 
20
23
  [无密钥首跑流程](https://raw.githubusercontent.com/AceDataCloud/GPTImageActivepieces/main/examples/gpt-image-quickstart.json) 导入后两个连接均为空,任务 ID 映射保留。运行前请配置自己的连接;创建动作已关闭自动重试。
21
24
 
22
- 图片数量为 1–10;每张成功图片可能单独计费。`size` 使用 `WIDTHxHEIGHT`,自定义尺寸限制以 GPT Image 2 公开指南为准。查询任务不会再次生成或计费。
25
+ 本次校验的目录包含 24 个型号和 8 个质量选项;下拉框刷新时读取当前目录。DALL-E 2 使用 `standard`;DALL-E 3 使用 `standard` 或 `hd`,图片数量固定为 `1`。其它型号的参数限制以当前接口说明为准。图片数量为 1–10,每张成功图片可能单独计费;`size` 支持 `auto` 或 `WIDTHxHEIGHT`。查询任务不会再次生成或计费。
23
26
 
24
- 隔离的 Activepieces CE 0.92.2 实例已接受构建归档,并通过 **Get GPT Image task** 查询一条既有完成任务;流程返回 `succeeded` 和 1 个最终图片 URL。本轮未通过创建动作提交新的付费图片任务。
27
+ 目录读取不携带连接、提示词或 API Key。元数据不可用时,下拉框明确显示错误,不返回缩水的备用列表;刷新字段可重试。已有保存流程继续使用其保存的模型 ID,执行时无需查询目录。本 Piece 实现图片生成与任务查询,尚未提供图片编辑动作。
28
+
29
+ 此前隔离的 Activepieces CE 0.92.2 验证已接受构建归档,并通过 **Get GPT Image task** 查询一条既有完成任务;流程返回 `succeeded` 和 1 个最终图片 URL。本轮未通过创建动作提交新的付费图片任务。
25
30
 
26
31
  ## 排障
27
32
 
@@ -35,3 +40,13 @@ Activepieces 0.92.2+ 中进入 **Platform Admin → Catalogue → Pieces → Ins
35
40
  | `failed` 或任务不存在 | 检查任务或 Trace ID 及保留期限。 |
36
41
 
37
42
  Piece 只向 `https://api.acedata.cloud` 发送所选输入和 API Key,仅在终态返回媒体 URL,并过滤内部路由字段。[源码](https://github.com/AceDataCloud/GPTImageActivepieces) · [支持](https://github.com/AceDataCloud/GPTImageActivepieces/issues) · dev@acedata.cloud。
43
+
44
+ 生成及任务请求验证 HTTPS 证书,且仅访问 `api.acedata.cloud`。公开目录从固定的 `platform.acedata.cloud` 接口 schema 地址读取,不携带认证信息,验证 HTTPS 证书且不跟随重定向。网络失败与 HTTP 错误不自动重试;重新创建前先查请求历史。Piece 不提供独立代理设置。
45
+
46
+ ## 图文配置参考
47
+
48
+ ![复制 Key 或管理密钥:真实脱敏 Ace 控制台](docs/screenshots/get-api-key-en.png)
49
+ ![创建独立 Key:真实脱敏 Ace 控制台](docs/screenshots/create-api-key-en.png)
50
+ ![官方 Activepieces 通用安装弹窗](docs/screenshots/install-piece.png)
51
+
52
+ 2026-10-18 复用的真实/官方参考图,[固定来源与边界](docs/screenshots/onboarding-source.json)保留。安装图不是本 Piece 已被官方共享目录收录的证明。管理员安装后按服务名搜索并核对 **by Ace Data Cloud**;Key 只放动作连接。源码 PR、npm 发版、官方目录收录与真实首用分别验收。
@@ -1,7 +1,7 @@
1
1
  export declare const generateImage: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").SecretTextProperty<true>, {
2
2
  prompt: import("@activepieces/pieces-framework").LongTextProperty<true>;
3
- model: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
4
- quality: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
3
+ model: import("@activepieces/pieces-framework").DropdownProperty<string, true, undefined>;
4
+ quality: import("@activepieces/pieces-framework").DropdownProperty<string, true, undefined>;
5
5
  size: import("@activepieces/pieces-framework").ShortTextProperty<true>;
6
6
  count: import("@activepieces/pieces-framework").NumberProperty<true>;
7
7
  }>;
@@ -4,6 +4,7 @@ exports.generateImage = void 0;
4
4
  const pieces_framework_1 = require("@activepieces/pieces-framework");
5
5
  const auth_1 = require("../auth");
6
6
  const client_1 = require("../common/client");
7
+ const catalog_1 = require("../common/catalog");
7
8
  exports.generateImage = (0, pieces_framework_1.createAction)({
8
9
  name: 'generate_image',
9
10
  displayName: 'Create GPT Image task',
@@ -15,34 +16,33 @@ exports.generateImage = (0, pieces_framework_1.createAction)({
15
16
  description: 'Describe the image. Use Get GPT Image task with the returned task ID to check the result.',
16
17
  required: true,
17
18
  }),
18
- model: pieces_framework_1.Property.StaticDropdown({
19
+ model: pieces_framework_1.Property.Dropdown({
20
+ auth: undefined,
19
21
  displayName: 'Model',
22
+ description: 'Current image-generation models from Ace Data Cloud, including supported compatibility aliases.',
20
23
  required: true,
21
24
  defaultValue: 'gpt-image-2',
22
- options: { options: [{ label: 'GPT Image 2', value: 'gpt-image-2' }] },
25
+ refreshers: [],
26
+ options: async () => (0, catalog_1.imageCatalogOptions)('model'),
23
27
  }),
24
- quality: pieces_framework_1.Property.StaticDropdown({
28
+ quality: pieces_framework_1.Property.Dropdown({
29
+ auth: undefined,
25
30
  displayName: 'Quality',
31
+ description: 'Choose a quality supported by the selected model. DALL-E 2 uses standard; DALL-E 3 uses standard or hd.',
26
32
  required: true,
27
33
  defaultValue: 'low',
28
- options: {
29
- options: [
30
- { label: 'Low', value: 'low' },
31
- { label: 'Medium', value: 'medium' },
32
- { label: 'High', value: 'high' },
33
- { label: 'Auto', value: 'auto' },
34
- ],
35
- },
34
+ refreshers: [],
35
+ options: async () => (0, catalog_1.imageCatalogOptions)('quality'),
36
36
  }),
37
37
  size: pieces_framework_1.Property.ShortText({
38
38
  displayName: 'Size',
39
- description: 'WIDTHxHEIGHT, such as 1024x1024. Read current model limits before using a custom size.',
39
+ description: 'WIDTHxHEIGHT, such as 1024x1024, or auto. Read current model limits before using a custom size.',
40
40
  required: true,
41
41
  defaultValue: '1024x1024',
42
42
  }),
43
43
  count: pieces_framework_1.Property.Number({
44
44
  displayName: 'Image count',
45
- description: 'Each generated image is billed. Choose a whole number from 1 to 10.',
45
+ description: 'Each generated image is billed. Choose a whole number from 1 to 10; DALL-E 3 requires 1.',
46
46
  required: true,
47
47
  defaultValue: 1,
48
48
  }),
@@ -52,8 +52,11 @@ exports.generateImage = (0, pieces_framework_1.createAction)({
52
52
  if (!prompt.trim()) {
53
53
  throw new Error('An image description is required.');
54
54
  }
55
- if (!/^\d+x\d+$/.test(size)) {
56
- throw new Error('Size must use WIDTHxHEIGHT, such as 1024x1024.');
55
+ if (typeof model !== 'string' || !model.trim()) {
56
+ throw new Error('Choose a model explicitly.');
57
+ }
58
+ if (!/^(auto|\d+x\d+)$/.test(size)) {
59
+ throw new Error('Size must use auto or WIDTHxHEIGHT, such as 1024x1024.');
57
60
  }
58
61
  if (!Number.isInteger(count) || count < 1 || count > 10) {
59
62
  throw new Error('Image count must be a whole number from 1 to 10.');
@@ -4,6 +4,6 @@ exports.gptImageAuth = void 0;
4
4
  const pieces_framework_1 = require("@activepieces/pieces-framework");
5
5
  exports.gptImageAuth = pieces_framework_1.PieceAuth.SecretText({
6
6
  displayName: 'Ace Data Cloud API key',
7
- description: 'Use an API key with GPT Image access from https://platform.acedata.cloud/console/applications. Enter only the key, without Bearer.',
7
+ description: 'Register or sign in at [Applications](https://platform.acedata.cloud/console/applications?utm_source=activepieces&utm_medium=referral&utm_campaign=evergreen&utm_content=gpt_image_activepieces_connection_api_key). If needed choose Initialize General Application, then copy the key or use Manage Keys → Create for a dedicated Activepieces key. Check service permissions, balance, current pricing and Allowed APIs in the guide. Paste only the API key without Bearer; a platform management token is not a generation key.',
8
8
  required: true,
9
9
  });
@@ -0,0 +1,2 @@
1
+ import { DropdownState } from '@activepieces/pieces-framework';
2
+ export declare function imageCatalogOptions(field: 'model' | 'quality'): Promise<DropdownState<string>>;
@@ -0,0 +1,87 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.imageCatalogOptions = imageCatalogOptions;
37
+ const https = __importStar(require("node:https"));
38
+ const CATALOG_URL = 'https://platform.acedata.cloud/api/v1/apis/8f01fe72-8a3e-4872-8d8d-330cde179b3a/';
39
+ const GENERATION_PATH = '/openai/images/generations';
40
+ // Public metadata uses a separate fixed destination and never receives the
41
+ // action's connection, prompt or API key. HTTPS redirects are not followed.
42
+ function readCatalog() {
43
+ return new Promise((resolve, reject) => {
44
+ const request = https.get(CATALOG_URL, {
45
+ rejectUnauthorized: true,
46
+ headers: { Accept: 'application/json' },
47
+ }, (response) => {
48
+ let body = '';
49
+ response.setEncoding('utf8');
50
+ response.on('data', (chunk) => { body += chunk; });
51
+ response.on('error', () => reject(new Error('Catalog response interrupted.')));
52
+ response.on('end', () => {
53
+ if (response.statusCode !== 200) {
54
+ reject(new Error('Catalog request failed.'));
55
+ return;
56
+ }
57
+ try {
58
+ resolve(JSON.parse(body));
59
+ }
60
+ catch {
61
+ reject(new Error('Invalid catalog response.'));
62
+ }
63
+ });
64
+ });
65
+ request.setTimeout(15_000, () => request.destroy(new Error('Catalog timeout')));
66
+ request.on('error', () => reject(new Error('Catalog network or TLS error.')));
67
+ });
68
+ }
69
+ async function imageCatalogOptions(field) {
70
+ try {
71
+ const catalog = await readCatalog();
72
+ const values = catalog.definition?.paths?.[GENERATION_PATH]?.post?.requestBody
73
+ ?.content?.['application/json']?.schema?.properties?.[field]?.enum;
74
+ if (!Array.isArray(values) || values.length === 0 ||
75
+ !values.every((value) => typeof value === 'string' && value.trim().length > 0)) {
76
+ throw new Error('Missing catalog enum.');
77
+ }
78
+ return { options: [...new Set(values)].map((value) => ({ label: value, value })) };
79
+ }
80
+ catch {
81
+ return {
82
+ disabled: true,
83
+ placeholder: `Current ${field} catalog unavailable. Refresh the field and try again.`,
84
+ options: [],
85
+ };
86
+ }
87
+ }
@@ -2,8 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.gptImageClient = void 0;
4
4
  const pieces_common_1 = require("@activepieces/pieces-common");
5
+ const secure_http_1 = require("../secure-http");
5
6
  async function post({ token, path, body, }) {
6
- const response = await pieces_common_1.httpClient.sendRequest({
7
+ const response = await secure_http_1.httpClient.sendRequest({
7
8
  method: pieces_common_1.HttpMethod.POST,
8
9
  url: `https://api.acedata.cloud${path}`,
9
10
  headers: {
@@ -0,0 +1,14 @@
1
+ type Request = {
2
+ method: string;
3
+ url: string;
4
+ headers?: Record<string, string>;
5
+ body?: unknown;
6
+ retries?: number;
7
+ };
8
+ export declare const httpClient: {
9
+ sendRequest<T>(request: Request): Promise<{
10
+ status: number;
11
+ body: T;
12
+ }>;
13
+ };
14
+ export {};
@@ -0,0 +1,81 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.httpClient = void 0;
37
+ const https = __importStar(require("node:https"));
38
+ // Keep credentials on the documented API host and verify TLS even if the host
39
+ // process or an unrelated Piece has changed NODE_TLS_REJECT_UNAUTHORIZED.
40
+ exports.httpClient = {
41
+ async sendRequest(request) {
42
+ const url = new URL(request.url);
43
+ if (url.protocol !== 'https:' || url.hostname !== 'api.acedata.cloud' || url.port) {
44
+ throw new Error('Unsupported Ace Data Cloud API host.');
45
+ }
46
+ const payload = request.body === undefined ? undefined : JSON.stringify(request.body);
47
+ return new Promise((resolve, reject) => {
48
+ const pending = https.request(url, {
49
+ method: request.method,
50
+ rejectUnauthorized: true,
51
+ headers: {
52
+ ...request.headers,
53
+ ...(payload === undefined ? {} : { 'Content-Length': String(Buffer.byteLength(payload)) }),
54
+ },
55
+ }, (response) => {
56
+ let body = '';
57
+ response.setEncoding('utf8');
58
+ response.on('data', (chunk) => { body += chunk; });
59
+ response.on('error', () => reject(new Error('Ace Data Cloud response interrupted. Inspect request history before resubmitting.')));
60
+ response.on('end', () => {
61
+ const status = response.statusCode ?? 0;
62
+ if (status < 200 || status >= 300) {
63
+ const error = new Error(`Ace Data Cloud HTTP ${status}. Inspect request history before resubmitting.`);
64
+ Object.assign(error, { response: { status } });
65
+ reject(error);
66
+ return;
67
+ }
68
+ try {
69
+ resolve({ status, body: JSON.parse(body) });
70
+ }
71
+ catch {
72
+ reject(new Error('Ace Data Cloud returned invalid JSON. Inspect request history before resubmitting.'));
73
+ }
74
+ });
75
+ });
76
+ pending.setTimeout(120_000, () => pending.destroy(new Error('Request timeout')));
77
+ pending.on('error', () => reject(new Error('Ace Data Cloud network or TLS error. Inspect request history before resubmitting.')));
78
+ pending.end(payload);
79
+ });
80
+ },
81
+ };
@@ -0,0 +1,6 @@
1
+ {
2
+ "checked_on": "2026-10-18 Asia/Shanghai",
3
+ "key_image_source": "https://github.com/AceDataCloud/SunoDify/tree/8d3d03570e73324220f111f7fe343da0792a8071/_assets/tutorial",
4
+ "installation_reference": "https://github.com/activepieces/activepieces/blob/860ce5b87c43856549586ee7b44007ba0937efdf/docs/resources/screenshots/install-piece.png",
5
+ "limits": "Real redacted Ace console references and official Activepieces generic install dialog. Not proof this service is in the official catalog or the current PR is published."
6
+ }
@@ -0,0 +1,126 @@
1
+ {
2
+ "name": "GPT Image quickstart",
3
+ "type": "SHARED",
4
+ "summary": "",
5
+ "description": "",
6
+ "tags": [],
7
+ "blogUrl": "",
8
+ "metadata": {
9
+ "externalId": "gpt-image-quickstart-20261012"
10
+ },
11
+ "author": "Ace Data Cloud",
12
+ "categories": [],
13
+ "pieces": [
14
+ "@activepieces/piece-manual-trigger",
15
+ "@acedatacloud/piece-gpt-image"
16
+ ],
17
+ "flows": [
18
+ {
19
+ "displayName": "GPT Image quickstart",
20
+ "trigger": {
21
+ "name": "trigger",
22
+ "valid": true,
23
+ "displayName": "Manual Trigger",
24
+ "nextAction": {
25
+ "name": "step_1",
26
+ "skip": false,
27
+ "type": "PIECE",
28
+ "valid": false,
29
+ "settings": {
30
+ "input": {
31
+ "auth": "",
32
+ "prompt": "A small red kite above a green meadow, watercolor illustration.",
33
+ "model": "gpt-image-2",
34
+ "quality": "low",
35
+ "size": "1024x1024",
36
+ "count": 1
37
+ },
38
+ "pieceName": "@acedatacloud/piece-gpt-image",
39
+ "actionName": "generate_image",
40
+ "sampleData": {},
41
+ "pieceVersion": "0.1.2",
42
+ "propertySettings": {
43
+ "prompt": {
44
+ "type": "MANUAL"
45
+ },
46
+ "model": {
47
+ "type": "MANUAL"
48
+ },
49
+ "quality": {
50
+ "type": "MANUAL"
51
+ },
52
+ "size": {
53
+ "type": "MANUAL"
54
+ },
55
+ "count": {
56
+ "type": "MANUAL"
57
+ }
58
+ },
59
+ "errorHandlingOptions": {
60
+ "retryOnFailure": {
61
+ "value": false
62
+ },
63
+ "continueOnFailure": {
64
+ "value": false
65
+ }
66
+ }
67
+ },
68
+ "nextAction": {
69
+ "name": "step_2",
70
+ "skip": false,
71
+ "type": "PIECE",
72
+ "valid": false,
73
+ "settings": {
74
+ "input": {
75
+ "auth": "",
76
+ "taskId": "{{step_1['output']['task_id']}}",
77
+ "traceId": ""
78
+ },
79
+ "pieceName": "@acedatacloud/piece-gpt-image",
80
+ "actionName": "get_task",
81
+ "sampleData": {},
82
+ "pieceVersion": "0.1.2",
83
+ "propertySettings": {
84
+ "taskId": {
85
+ "type": "MANUAL"
86
+ },
87
+ "traceId": {
88
+ "type": "MANUAL"
89
+ }
90
+ },
91
+ "errorHandlingOptions": {
92
+ "retryOnFailure": {
93
+ "value": false
94
+ },
95
+ "continueOnFailure": {
96
+ "value": false
97
+ }
98
+ }
99
+ },
100
+ "displayName": "Get GPT Image task",
101
+ "lastUpdatedDate": "2026-10-11T15:59:36.284Z"
102
+ },
103
+ "displayName": "Create GPT Image task",
104
+ "lastUpdatedDate": "2026-10-11T15:40:03.227Z"
105
+ },
106
+ "type": "PIECE_TRIGGER",
107
+ "settings": {
108
+ "propertySettings": {
109
+ "markdown": {
110
+ "type": "MANUAL"
111
+ }
112
+ },
113
+ "pieceName": "@activepieces/piece-manual-trigger",
114
+ "pieceVersion": "0.0.8",
115
+ "triggerName": "manual_trigger",
116
+ "input": {}
117
+ },
118
+ "lastUpdatedDate": "2026-10-11T15:29:17.786Z"
119
+ },
120
+ "valid": true,
121
+ "schemaVersion": "27",
122
+ "notes": []
123
+ }
124
+ ],
125
+ "status": "PUBLISHED"
126
+ }
package/package.json CHANGED
@@ -1,12 +1,15 @@
1
1
  {
2
2
  "name": "@acedatacloud/piece-gpt-image",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "GPT Image generation and task lookup through Ace Data Cloud for Activepieces",
5
5
  "type": "commonjs",
6
6
  "main": "./dist/src/index.js",
7
7
  "types": "./dist/src/index.d.ts",
8
8
  "files": [
9
- "dist"
9
+ "dist",
10
+ "README.zh-CN.md",
11
+ "examples",
12
+ "docs/screenshots"
10
13
  ],
11
14
  "scripts": {
12
15
  "build": "tsc -p tsconfig.json",
@@ -25,6 +28,15 @@
25
28
  "@activepieces/pieces-framework": "0.32.0"
26
29
  },
27
30
  "devDependencies": {
31
+ "@types/node": "24.11.0",
28
32
  "typescript": "5.9.3"
29
- }
33
+ },
34
+ "keywords": [
35
+ "activepieces",
36
+ "piece",
37
+ "acedatacloud",
38
+ "gpt-image",
39
+ "gpt",
40
+ "image"
41
+ ]
30
42
  }