@acedatacloud/piece-fish-audio 0.0.0-stage → 0.1.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/LICENSE +21 -0
- package/README.md +49 -2
- package/README.zh-CN.md +50 -0
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.js +17 -0
- package/dist/src/lib/actions/get-task.d.ts +3 -0
- package/dist/src/lib/actions/get-task.js +31 -0
- package/dist/src/lib/actions/synthesize-speech.d.ts +6 -0
- package/dist/src/lib/actions/synthesize-speech.js +72 -0
- package/dist/src/lib/auth.d.ts +1 -0
- package/dist/src/lib/auth.js +9 -0
- package/dist/src/lib/common/client.d.ts +25 -0
- package/dist/src/lib/common/client.js +134 -0
- package/dist/src/lib/secure-http.d.ts +14 -0
- package/dist/src/lib/secure-http.js +81 -0
- package/docs/screenshots/create-api-key-en.png +0 -0
- package/docs/screenshots/get-api-key-en.png +0 -0
- package/docs/screenshots/install-piece.png +0 -0
- package/docs/screenshots/onboarding-source.json +6 -0
- package/examples/fish-audio-quickstart.json +118 -0
- package/package.json +40 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Ace Data Cloud
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,50 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Fish Audio for Activepieces
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Synthesize speech through Ace Data Cloud and retrieve an asynchronous Fish Audio task by the **same task ID**. The Piece has **Synthesize Fish Audio speech** and **Get Fish Audio task** actions. [中文指南](README.zh-CN.md)
|
|
4
|
+
|
|
5
|
+
**Distribution:** Install `@acedatacloud/piece-fish-audio@0.1.1` as a custom Piece in your Activepieces instance. A public npm package does not automatically enter the shared Activepieces catalog.
|
|
6
|
+
|
|
7
|
+
## Install and connect
|
|
8
|
+
|
|
9
|
+
In Activepieces 0.92.2+, open **Platform Admin → Catalogue → Pieces → Install Piece → NPM Registry**. Enter `@acedatacloud/piece-fish-audio` and version `0.1.1`. Search for **Fish Audio by Ace Data Cloud** when adding a flow action, then check the Ace Data Cloud logo and both actions.
|
|
10
|
+
|
|
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=fish_audio_activepieces_readme_api_key). If you have no General application, choose **Initialize General Application**.
|
|
12
|
+
2. Open a General application or an application with **Fish Audio** 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 Fish Audio`. Set expiry and usage limits as needed. If you restrict **Allowed APIs**, include both `/fish/tts` and `/fish/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=fish_audio_activepieces_readme_pricing) and balance before synthesis.
|
|
15
|
+
|
|
16
|
+
## First flow
|
|
17
|
+
|
|
18
|
+
1. Add **Synthesize Fish Audio speech**. Enter the text, select `s2-pro` and `mp3`, and optionally enter a saved or public **Reference voice ID**. The Piece sends the model in the `model` request header, not the JSON body.
|
|
19
|
+
2. The action requests asynchronous synthesis and does not retry the paid request. If it returns `task_id`, save that ID; if the API returns a direct `audio_url`, the action returns `succeeded` and the final URL immediately.
|
|
20
|
+
3. For an asynchronous task, add **Get Fish Audio task** and map **Task ID** from the first action. Query the same ID until `status=succeeded` or `failed`. Do not rerun synthesis while polling. A direct final audio response needs no lookup.
|
|
21
|
+
4. Open a URL in `media_urls` only when `success=true`. Task lookup does not create or bill another speech request.
|
|
22
|
+
|
|
23
|
+
The [credential-free quickstart flow](https://raw.githubusercontent.com/AceDataCloud/FishAudioActivepieces/main/examples/fish-audio-quickstart.json) imports with both connections empty and the task-ID mapping intact. Configure your own connection before running. The sample follows the asynchronous task path and has synthesis retries disabled.
|
|
24
|
+
|
|
25
|
+
This first Piece supports text-to-speech with three published engines, MP3/WAV output and an optional existing voice ID. It does not yet expose voice creation, one-shot references, prosody controls, or the full Fish Audio API. Synthesis cost depends on the current price and text length.
|
|
26
|
+
|
|
27
|
+
An isolated Activepieces CE 0.92.2 instance accepted the build archive and ran **Get Fish Audio task** against an existing completed task. The flow returned `succeeded` and one final audio URL. The synthesis action has not submitted a new paid request in this validation.
|
|
28
|
+
|
|
29
|
+
## Troubleshoot
|
|
30
|
+
|
|
31
|
+
| Result | Action |
|
|
32
|
+
| --- | --- |
|
|
33
|
+
| 401 / 403 | Check the API key, Fish Audio access, and Allowed APIs for both paths. |
|
|
34
|
+
| 400 | Check text, format, and reference voice ID. |
|
|
35
|
+
| `pending` | Wait and query the same task ID; do not rerun synthesis. |
|
|
36
|
+
| 429 | Reduce concurrency and wait; avoid automatic paid retries. |
|
|
37
|
+
| Synthesis timeout or 5xx | Inspect [request history](https://platform.acedata.cloud/console/usages?utm_source=opensource&utm_medium=referral&utm_campaign=evergreen&utm_content=fish_audio_activepieces_readme_request_history) before another submission. |
|
|
38
|
+
| `failed` or missing task | Check the task ID and retention window. |
|
|
39
|
+
|
|
40
|
+
The Piece sends selected inputs and the API key only to `https://api.acedata.cloud`. It exposes final media URLs and removes internal routing fields from task output. [Source](https://github.com/AceDataCloud/FishAudioActivepieces) · [Support](https://github.com/AceDataCloud/FishAudioActivepieces/issues) · dev@acedata.cloud.
|
|
41
|
+
|
|
42
|
+
API requests verify HTTPS certificates and stay on `api.acedata.cloud`. Transport failures and HTTP errors are not retried automatically; inspect request history before resubmitting a creation. HTTPS proxy configuration is not supported by this transport.
|
|
43
|
+
|
|
44
|
+
## Visual setup references
|
|
45
|
+
|
|
46
|
+

|
|
47
|
+

|
|
48
|
+

|
|
49
|
+
|
|
50
|
+
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
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# Fish Audio for Activepieces
|
|
2
|
+
|
|
3
|
+
通过 Ace Data Cloud 合成语音,并按**同一个任务 ID**查询 Fish Audio 异步任务。Piece 提供 **Synthesize Fish Audio speech** 和 **Get Fish Audio task** 两个动作。[English](README.md)
|
|
4
|
+
|
|
5
|
+
**分发方式:**在 Activepieces 实例中将 `@acedatacloud/piece-fish-audio@0.1.1` 作为自定义 Piece 安装。公开 npm 包不会自动进入 Activepieces 共享目录。
|
|
6
|
+
|
|
7
|
+
## 安装与连接
|
|
8
|
+
|
|
9
|
+
Activepieces 0.92.2+ 中进入 **Platform Admin → Catalogue → Pieces → Install Piece → NPM Registry**,填写 `@acedatacloud/piece-fish-audio` 和版本 `0.1.1`。在流程中搜索 **Fish Audio by Ace Data Cloud**,核对 Ace Data Cloud Logo 和两个动作。
|
|
10
|
+
|
|
11
|
+
1. 在 [Ace Data Cloud Applications](https://platform.acedata.cloud/console/applications?utm_source=opensource&utm_medium=referral&utm_campaign=evergreen&utm_content=fish_audio_activepieces_readme_api_key) 注册或登录。若没有通用应用,点击 **Initialize General Application**。
|
|
12
|
+
2. 打开通用应用或具备 **Fish Audio** 权限的应用。通用 Key 可访问账号已获授权的服务;专用 Key 仅限对应服务。
|
|
13
|
+
3. 使用应用卡片的复制按钮,或通过 **Manage Keys → Create** 创建名为 `Activepieces Fish Audio` 的独立 Key,按需设置有效期与用量限制。若启用 **Allowed APIs**,应同时包含 `/fish/tts` 与 `/fish/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=fish_audio_activepieces_readme_pricing)与余额。
|
|
15
|
+
|
|
16
|
+
## 首次流程
|
|
17
|
+
|
|
18
|
+
1. 添加 **Synthesize Fish Audio speech**,填写文本,选择 `s2-pro`、`mp3`,可选填现有或公开声音的 **Reference voice ID**。Piece 把模型放在 `model` 请求头,而不是 JSON 请求体。
|
|
19
|
+
2. 动作请求异步合成,不重试付费请求。若返回 `task_id`,保存它;若 API 直接返回 `audio_url`,动作立即返回 `succeeded` 和最终链接。
|
|
20
|
+
3. 对异步任务添加 **Get Fish Audio task**,把 **Task ID** 映射为上一动作输出。只查询同一 ID,直到 `status=succeeded` 或 `failed`;轮询不重跑合成。直接得到最终音频时无需查询。
|
|
21
|
+
4. 仅当 `success=true` 时打开 `media_urls`。查询任务不会再次创建语音或计费。
|
|
22
|
+
|
|
23
|
+
[无密钥首跑流程](https://raw.githubusercontent.com/AceDataCloud/FishAudioActivepieces/main/examples/fish-audio-quickstart.json) 导入后两个连接均为空,任务 ID 映射保留。运行前请配置自己的连接。样例走异步任务路径,并已关闭合成动作的自动重试。
|
|
24
|
+
|
|
25
|
+
首版支持三个公开语音引擎、MP3/WAV 输出和可选的现有声音 ID;尚未涵盖创建声音、一次性参考音频、韵律控制或 Fish Audio 全部 API。合成费用取决于当前价格和文本长度。
|
|
26
|
+
|
|
27
|
+
隔离的 Activepieces CE 0.92.2 实例已接受构建归档,并通过 **Get Fish Audio task** 查询既有完成任务;流程返回 `succeeded` 和 1 个最终音频 URL。本轮未通过合成动作提交新的付费请求。
|
|
28
|
+
|
|
29
|
+
## 排障
|
|
30
|
+
|
|
31
|
+
| 现象 | 处理 |
|
|
32
|
+
| --- | --- |
|
|
33
|
+
| 401 / 403 | 核对 Key、Fish Audio 权限和两个路径的 Allowed APIs。 |
|
|
34
|
+
| 400 | 核对文本、格式和声音 ID。 |
|
|
35
|
+
| `pending` | 等待并查询同一任务 ID,不重跑合成。 |
|
|
36
|
+
| 429 | 降低并发,避免自动重试付费请求。 |
|
|
37
|
+
| 合成超时或 5xx | 先查[请求历史](https://platform.acedata.cloud/console/usages?utm_source=opensource&utm_medium=referral&utm_campaign=evergreen&utm_content=fish_audio_activepieces_readme_request_history),再考虑再次提交。 |
|
|
38
|
+
| `failed` 或任务不存在 | 检查任务 ID 和保留期限。 |
|
|
39
|
+
|
|
40
|
+
Piece 只向 `https://api.acedata.cloud` 发送所选输入和 API Key,仅在终态返回媒体 URL,并过滤内部路由字段。[源码](https://github.com/AceDataCloud/FishAudioActivepieces) · [支持](https://github.com/AceDataCloud/FishAudioActivepieces/issues) · dev@acedata.cloud。
|
|
41
|
+
|
|
42
|
+
API 请求验证 HTTPS 证书,且仅访问 `api.acedata.cloud`。网络失败与 HTTP 错误不自动重试;重新创建前先查请求历史。此传输方式不支持 HTTPS 代理配置。
|
|
43
|
+
|
|
44
|
+
## 图文配置参考
|
|
45
|
+
|
|
46
|
+

|
|
47
|
+

|
|
48
|
+

|
|
49
|
+
|
|
50
|
+
2026-10-18 复用的真实/官方参考图,[固定来源与边界](docs/screenshots/onboarding-source.json)保留。安装图不是本 Piece 已被官方共享目录收录的证明。管理员安装后按服务名搜索并核对 **by Ace Data Cloud**;Key 只放动作连接。源码 PR、npm 发版、官方目录收录与真实首用分别验收。
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const fishAudio: import("@activepieces/pieces-framework").Piece<import("@activepieces/pieces-framework").SecretTextProperty<true>>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fishAudio = void 0;
|
|
4
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
5
|
+
const synthesize_speech_1 = require("./lib/actions/synthesize-speech");
|
|
6
|
+
const get_task_1 = require("./lib/actions/get-task");
|
|
7
|
+
const auth_1 = require("./lib/auth");
|
|
8
|
+
exports.fishAudio = (0, pieces_framework_1.createPiece)({
|
|
9
|
+
displayName: 'Fish Audio by Ace Data Cloud',
|
|
10
|
+
description: 'Synthesize Fish Audio speech and retrieve the same task through Ace Data Cloud.',
|
|
11
|
+
logoUrl: 'https://cdn.acedata.cloud/assets/logo.png',
|
|
12
|
+
authors: ['Ace Data Cloud'],
|
|
13
|
+
minimumSupportedRelease: '0.92.2',
|
|
14
|
+
auth: auth_1.fishAudioAuth,
|
|
15
|
+
actions: [synthesize_speech_1.synthesizeSpeech, get_task_1.getTask],
|
|
16
|
+
triggers: [],
|
|
17
|
+
});
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getTask = void 0;
|
|
4
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
5
|
+
const auth_1 = require("../auth");
|
|
6
|
+
const client_1 = require("../common/client");
|
|
7
|
+
exports.getTask = (0, pieces_framework_1.createAction)({
|
|
8
|
+
name: 'get_task',
|
|
9
|
+
displayName: 'Get Fish Audio task',
|
|
10
|
+
description: 'Retrieve one existing task ID. Pending previews are not final audio.',
|
|
11
|
+
auth: auth_1.fishAudioAuth,
|
|
12
|
+
props: {
|
|
13
|
+
taskId: pieces_framework_1.Property.ShortText({
|
|
14
|
+
displayName: 'Task ID',
|
|
15
|
+
description: 'Map the task_id output from Synthesize Fish Audio speech. Query this same ID until it succeeds or fails.',
|
|
16
|
+
required: true,
|
|
17
|
+
}),
|
|
18
|
+
},
|
|
19
|
+
async run(context) {
|
|
20
|
+
const taskId = context.propsValue.taskId.trim();
|
|
21
|
+
if (!taskId) {
|
|
22
|
+
throw new Error('A task ID is required.');
|
|
23
|
+
}
|
|
24
|
+
const response = await client_1.fishAudioClient.post({
|
|
25
|
+
token: context.auth.secret_text,
|
|
26
|
+
path: '/fish/tasks',
|
|
27
|
+
body: { id: taskId },
|
|
28
|
+
});
|
|
29
|
+
return client_1.fishAudioClient.normalizeTask({ body: response, taskId });
|
|
30
|
+
},
|
|
31
|
+
});
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const synthesizeSpeech: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").SecretTextProperty<true>, {
|
|
2
|
+
text: import("@activepieces/pieces-framework").LongTextProperty<true>;
|
|
3
|
+
model: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
|
|
4
|
+
format: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
|
|
5
|
+
referenceId: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
6
|
+
}>;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.synthesizeSpeech = void 0;
|
|
4
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
5
|
+
const auth_1 = require("../auth");
|
|
6
|
+
const client_1 = require("../common/client");
|
|
7
|
+
exports.synthesizeSpeech = (0, pieces_framework_1.createAction)({
|
|
8
|
+
name: 'synthesize_speech',
|
|
9
|
+
displayName: 'Synthesize Fish Audio speech',
|
|
10
|
+
description: 'Submit one text-to-speech request. Async responses return a task ID; a direct audio response is already final.',
|
|
11
|
+
auth: auth_1.fishAudioAuth,
|
|
12
|
+
props: {
|
|
13
|
+
text: pieces_framework_1.Property.LongText({
|
|
14
|
+
displayName: 'Text to speak',
|
|
15
|
+
description: 'Words to synthesize. Billing depends on the text length.',
|
|
16
|
+
required: true,
|
|
17
|
+
}),
|
|
18
|
+
model: pieces_framework_1.Property.StaticDropdown({
|
|
19
|
+
displayName: 'Engine',
|
|
20
|
+
description: 'Sent in the model request header, not the JSON body.',
|
|
21
|
+
required: true,
|
|
22
|
+
defaultValue: 's2-pro',
|
|
23
|
+
options: { options: [
|
|
24
|
+
{ label: 'S2 Pro', value: 's2-pro' },
|
|
25
|
+
{ label: 'S2.1 Pro', value: 's2.1-pro' },
|
|
26
|
+
{ label: 'S1', value: 's1' },
|
|
27
|
+
] },
|
|
28
|
+
}),
|
|
29
|
+
format: pieces_framework_1.Property.StaticDropdown({
|
|
30
|
+
displayName: 'Audio format',
|
|
31
|
+
required: true,
|
|
32
|
+
defaultValue: 'mp3',
|
|
33
|
+
options: { options: [
|
|
34
|
+
{ label: 'MP3', value: 'mp3' },
|
|
35
|
+
{ label: 'WAV', value: 'wav' },
|
|
36
|
+
] },
|
|
37
|
+
}),
|
|
38
|
+
referenceId: pieces_framework_1.Property.ShortText({
|
|
39
|
+
displayName: 'Reference voice ID',
|
|
40
|
+
description: 'Optional public or saved Fish voice model ID.',
|
|
41
|
+
required: false,
|
|
42
|
+
}),
|
|
43
|
+
},
|
|
44
|
+
async run(context) {
|
|
45
|
+
const { text, model, format, referenceId } = context.propsValue;
|
|
46
|
+
if (!text.trim()) {
|
|
47
|
+
throw new Error('Text to speak is required.');
|
|
48
|
+
}
|
|
49
|
+
const response = await client_1.fishAudioClient.post({
|
|
50
|
+
token: context.auth.secret_text,
|
|
51
|
+
path: '/fish/tts',
|
|
52
|
+
model,
|
|
53
|
+
body: {
|
|
54
|
+
text,
|
|
55
|
+
format,
|
|
56
|
+
...(referenceId?.trim() ? { reference_id: referenceId.trim() } : {}),
|
|
57
|
+
async: true,
|
|
58
|
+
callback_url: 'https://api.acedata.cloud/health',
|
|
59
|
+
},
|
|
60
|
+
});
|
|
61
|
+
const taskId = client_1.fishAudioClient.taskIdFromSubmission(response);
|
|
62
|
+
if (taskId) {
|
|
63
|
+
return { task_id: taskId, status: 'pending', success: false, media_urls: [] };
|
|
64
|
+
}
|
|
65
|
+
const direct = response !== null && typeof response === 'object' && !Array.isArray(response)
|
|
66
|
+
? response.audio_url : undefined;
|
|
67
|
+
if (typeof direct === 'string' && direct.startsWith('https://')) {
|
|
68
|
+
return { task_id: '', status: 'succeeded', success: true, media_urls: [direct] };
|
|
69
|
+
}
|
|
70
|
+
throw new Error('No task ID or final audio URL was returned. Inspect request history before submitting again.');
|
|
71
|
+
},
|
|
72
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const fishAudioAuth: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fishAudioAuth = void 0;
|
|
4
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
5
|
+
exports.fishAudioAuth = pieces_framework_1.PieceAuth.SecretText({
|
|
6
|
+
displayName: 'Ace Data Cloud API key',
|
|
7
|
+
description: 'Register or sign in at [Applications](https://platform.acedata.cloud/console/applications?utm_source=opensource&utm_medium=referral&utm_campaign=evergreen&utm_content=fish_audio_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
|
+
required: true,
|
|
9
|
+
});
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
declare function post({ token, path, body, model, }: {
|
|
2
|
+
token: string;
|
|
3
|
+
path: '/fish/tts' | '/fish/tasks';
|
|
4
|
+
body: Record<string, unknown>;
|
|
5
|
+
model?: string;
|
|
6
|
+
}): Promise<unknown>;
|
|
7
|
+
declare function normalizeTask({ body, taskId }: {
|
|
8
|
+
body: unknown;
|
|
9
|
+
taskId: string;
|
|
10
|
+
}): TaskResult;
|
|
11
|
+
declare function taskIdFromSubmission(body: unknown): string;
|
|
12
|
+
export declare const fishAudioClient: {
|
|
13
|
+
post: typeof post;
|
|
14
|
+
normalizeTask: typeof normalizeTask;
|
|
15
|
+
taskIdFromSubmission: typeof taskIdFromSubmission;
|
|
16
|
+
};
|
|
17
|
+
export type TaskResult = {
|
|
18
|
+
task_id: string;
|
|
19
|
+
status: 'pending' | 'succeeded' | 'failed';
|
|
20
|
+
success: boolean;
|
|
21
|
+
trace_id: string;
|
|
22
|
+
media_urls: string[];
|
|
23
|
+
result: unknown;
|
|
24
|
+
};
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fishAudioClient = void 0;
|
|
4
|
+
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
5
|
+
const secure_http_1 = require("../secure-http");
|
|
6
|
+
async function post({ token, path, body, model, }) {
|
|
7
|
+
const response = await secure_http_1.httpClient.sendRequest({
|
|
8
|
+
method: pieces_common_1.HttpMethod.POST,
|
|
9
|
+
url: `https://api.acedata.cloud${path}`,
|
|
10
|
+
headers: {
|
|
11
|
+
Authorization: `Bearer ${token}`,
|
|
12
|
+
'Content-Type': 'application/json',
|
|
13
|
+
...(model ? { model } : {}),
|
|
14
|
+
},
|
|
15
|
+
body,
|
|
16
|
+
retries: 0,
|
|
17
|
+
});
|
|
18
|
+
return response.body;
|
|
19
|
+
}
|
|
20
|
+
function normalizeTask({ body, taskId }) {
|
|
21
|
+
const envelope = record(body);
|
|
22
|
+
if (Object.keys(envelope).length === 0) {
|
|
23
|
+
throw new Error('Task not found. Check the task ID and its retention window.');
|
|
24
|
+
}
|
|
25
|
+
const payload = parsePayload('response' in envelope ? envelope.response : body);
|
|
26
|
+
const values = record(payload);
|
|
27
|
+
const states = collectStates(payload);
|
|
28
|
+
const failed = states.some((state) => FAILED_STATES.has(state)) || hasFailure(payload) || Boolean(envelope.error);
|
|
29
|
+
const unfinished = 'finished_at' in envelope && envelope.finished_at === null;
|
|
30
|
+
const finished = !unfinished &&
|
|
31
|
+
!failed &&
|
|
32
|
+
((states.length > 0 && states.every((state) => COMPLETE_STATES.has(state))) ||
|
|
33
|
+
Boolean(envelope.finished_at && hasContent(payload)));
|
|
34
|
+
const traceId = stringValue(values.trace_id) || stringValue(envelope.trace_id);
|
|
35
|
+
return {
|
|
36
|
+
task_id: taskId,
|
|
37
|
+
status: failed ? 'failed' : finished ? 'succeeded' : 'pending',
|
|
38
|
+
success: finished,
|
|
39
|
+
trace_id: traceId,
|
|
40
|
+
media_urls: finished ? collectMediaUrls(payload) : [],
|
|
41
|
+
result: sanitize(payload),
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
function taskIdFromSubmission(body) {
|
|
45
|
+
const value = record(body);
|
|
46
|
+
const nestedTask = record(value.task);
|
|
47
|
+
return stringValue(value.task_id) || stringValue(nestedTask.id);
|
|
48
|
+
}
|
|
49
|
+
function parsePayload(value) {
|
|
50
|
+
if (typeof value !== 'string') {
|
|
51
|
+
return value;
|
|
52
|
+
}
|
|
53
|
+
try {
|
|
54
|
+
return JSON.parse(value);
|
|
55
|
+
}
|
|
56
|
+
catch {
|
|
57
|
+
return {};
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
function record(value) {
|
|
61
|
+
return value !== null && typeof value === 'object' && !Array.isArray(value)
|
|
62
|
+
? Object.fromEntries(Object.entries(value))
|
|
63
|
+
: {};
|
|
64
|
+
}
|
|
65
|
+
function stringValue(value) {
|
|
66
|
+
return typeof value === 'string' ? value : '';
|
|
67
|
+
}
|
|
68
|
+
function collectStates(value) {
|
|
69
|
+
if (Array.isArray(value)) {
|
|
70
|
+
return value.flatMap(collectStates);
|
|
71
|
+
}
|
|
72
|
+
if (value === null || typeof value !== 'object') {
|
|
73
|
+
return [];
|
|
74
|
+
}
|
|
75
|
+
const item = record(value);
|
|
76
|
+
return [
|
|
77
|
+
...['state', 'status'].flatMap((key) => {
|
|
78
|
+
const state = stringValue(item[key]);
|
|
79
|
+
return state ? [state.toLowerCase()] : [];
|
|
80
|
+
}),
|
|
81
|
+
...['data', 'content', 'task'].flatMap((key) => collectStates(item[key])),
|
|
82
|
+
];
|
|
83
|
+
}
|
|
84
|
+
function hasFailure(value) {
|
|
85
|
+
if (Array.isArray(value)) {
|
|
86
|
+
return value.some(hasFailure);
|
|
87
|
+
}
|
|
88
|
+
if (value === null || typeof value !== 'object') {
|
|
89
|
+
return false;
|
|
90
|
+
}
|
|
91
|
+
const item = record(value);
|
|
92
|
+
return Boolean(item.error) ||
|
|
93
|
+
(item.success === false && !['pending', 'running', 'processing'].includes(stringValue(item.status || item.state).toLowerCase())) ||
|
|
94
|
+
['data', 'content', 'task'].some((key) => hasFailure(item[key]));
|
|
95
|
+
}
|
|
96
|
+
function collectMediaUrls(value) {
|
|
97
|
+
if (Array.isArray(value)) {
|
|
98
|
+
return [...new Set(value.flatMap(collectMediaUrls))];
|
|
99
|
+
}
|
|
100
|
+
if (value === null || typeof value !== 'object') {
|
|
101
|
+
return [];
|
|
102
|
+
}
|
|
103
|
+
const item = record(value);
|
|
104
|
+
const urls = Object.entries(item).flatMap(([key, child]) => {
|
|
105
|
+
if (['audio_url', 'file_url', 'url'].includes(key) && typeof child === 'string') {
|
|
106
|
+
return child.startsWith('https://') ? [child] : [];
|
|
107
|
+
}
|
|
108
|
+
return collectMediaUrls(child);
|
|
109
|
+
});
|
|
110
|
+
return [...new Set(urls)];
|
|
111
|
+
}
|
|
112
|
+
function hasContent(value) {
|
|
113
|
+
return Array.isArray(value) ? value.length > 0 : Object.keys(record(value)).length > 0;
|
|
114
|
+
}
|
|
115
|
+
function sanitize(value) {
|
|
116
|
+
if (Array.isArray(value)) {
|
|
117
|
+
return value.map(sanitize);
|
|
118
|
+
}
|
|
119
|
+
if (value === null || typeof value !== 'object') {
|
|
120
|
+
return value;
|
|
121
|
+
}
|
|
122
|
+
return Object.fromEntries(Object.entries(value)
|
|
123
|
+
.filter(([key]) => !SENSITIVE_KEYS.has(key.toLowerCase()) && !SENSITIVE_KEY_PATTERN.test(key))
|
|
124
|
+
.map(([key, child]) => [key, key === 'error' ? 'Task failed; inspect its task or trace ID.' : sanitize(child)]));
|
|
125
|
+
}
|
|
126
|
+
exports.fishAudioClient = { post, normalizeTask, taskIdFromSubmission };
|
|
127
|
+
const COMPLETE_STATES = new Set(['complete', 'completed', 'succeeded', 'succeed', 'success', 'finished']);
|
|
128
|
+
const FAILED_STATES = new Set(['failed', 'error', 'cancelled', 'canceled', 'rejected']);
|
|
129
|
+
const SENSITIVE_KEYS = new Set([
|
|
130
|
+
'request', 'request_body', 'user_id', 'actor_user_id', 'credential_id', 'authorization_id',
|
|
131
|
+
'application_id', 'api_key', 'access_token', 'refresh_token', 'authorization', 'headers',
|
|
132
|
+
'supplier', 'supplier_id', 'provider_route', 'upstream', 'upstream_model', 'actual_model', 'secret',
|
|
133
|
+
]);
|
|
134
|
+
const SENSITIVE_KEY_PATTERN = /(^internal(?:_|$)|supplier|upstream|(?:^|_)secret(?:_|$))/i;
|
|
@@ -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
|
+
};
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -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,118 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "Fish Audio quickstart",
|
|
3
|
+
"type": "SHARED",
|
|
4
|
+
"summary": "",
|
|
5
|
+
"description": "",
|
|
6
|
+
"tags": [],
|
|
7
|
+
"blogUrl": "",
|
|
8
|
+
"metadata": {
|
|
9
|
+
"externalId": "fish-audio-quickstart-20261012"
|
|
10
|
+
},
|
|
11
|
+
"author": "Ace Data Cloud",
|
|
12
|
+
"categories": [],
|
|
13
|
+
"pieces": [
|
|
14
|
+
"@activepieces/piece-manual-trigger",
|
|
15
|
+
"@acedatacloud/piece-fish-audio"
|
|
16
|
+
],
|
|
17
|
+
"flows": [
|
|
18
|
+
{
|
|
19
|
+
"displayName": "Fish Audio 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
|
+
"text": "Hello from Ace Data Cloud.",
|
|
33
|
+
"model": "s2-pro",
|
|
34
|
+
"format": "mp3",
|
|
35
|
+
"referenceId": ""
|
|
36
|
+
},
|
|
37
|
+
"pieceName": "@acedatacloud/piece-fish-audio",
|
|
38
|
+
"actionName": "synthesize_speech",
|
|
39
|
+
"sampleData": {},
|
|
40
|
+
"pieceVersion": "0.1.1",
|
|
41
|
+
"propertySettings": {
|
|
42
|
+
"text": {
|
|
43
|
+
"type": "MANUAL"
|
|
44
|
+
},
|
|
45
|
+
"model": {
|
|
46
|
+
"type": "MANUAL"
|
|
47
|
+
},
|
|
48
|
+
"format": {
|
|
49
|
+
"type": "MANUAL"
|
|
50
|
+
},
|
|
51
|
+
"referenceId": {
|
|
52
|
+
"type": "MANUAL"
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
"errorHandlingOptions": {
|
|
56
|
+
"retryOnFailure": {
|
|
57
|
+
"value": false
|
|
58
|
+
},
|
|
59
|
+
"continueOnFailure": {
|
|
60
|
+
"value": false
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
"nextAction": {
|
|
65
|
+
"name": "step_2",
|
|
66
|
+
"skip": false,
|
|
67
|
+
"type": "PIECE",
|
|
68
|
+
"valid": false,
|
|
69
|
+
"settings": {
|
|
70
|
+
"input": {
|
|
71
|
+
"auth": "",
|
|
72
|
+
"taskId": "{{step_1['output']['task_id']}}"
|
|
73
|
+
},
|
|
74
|
+
"pieceName": "@acedatacloud/piece-fish-audio",
|
|
75
|
+
"actionName": "get_task",
|
|
76
|
+
"sampleData": {},
|
|
77
|
+
"pieceVersion": "0.1.1",
|
|
78
|
+
"propertySettings": {
|
|
79
|
+
"taskId": {
|
|
80
|
+
"type": "MANUAL"
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
"errorHandlingOptions": {
|
|
84
|
+
"retryOnFailure": {
|
|
85
|
+
"value": false
|
|
86
|
+
},
|
|
87
|
+
"continueOnFailure": {
|
|
88
|
+
"value": false
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
"displayName": "Get Fish Audio task",
|
|
93
|
+
"lastUpdatedDate": "2026-10-11T15:59:36.284Z"
|
|
94
|
+
},
|
|
95
|
+
"displayName": "Synthesize Fish Audio speech",
|
|
96
|
+
"lastUpdatedDate": "2026-10-11T15:40:03.227Z"
|
|
97
|
+
},
|
|
98
|
+
"lastUpdatedDate": "2026-10-11T15:29:17.786Z",
|
|
99
|
+
"type": "PIECE_TRIGGER",
|
|
100
|
+
"settings": {
|
|
101
|
+
"propertySettings": {
|
|
102
|
+
"markdown": {
|
|
103
|
+
"type": "MANUAL"
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
"pieceName": "@activepieces/piece-manual-trigger",
|
|
107
|
+
"pieceVersion": "0.0.8",
|
|
108
|
+
"triggerName": "manual_trigger",
|
|
109
|
+
"input": {}
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
"valid": true,
|
|
113
|
+
"schemaVersion": "27",
|
|
114
|
+
"notes": []
|
|
115
|
+
}
|
|
116
|
+
],
|
|
117
|
+
"status": "PUBLISHED"
|
|
118
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,42 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@acedatacloud/piece-fish-audio",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "Fish Audio text-to-speech and task lookup through Ace Data Cloud for Activepieces",
|
|
5
|
+
"type": "commonjs",
|
|
6
|
+
"main": "./dist/src/index.js",
|
|
7
|
+
"types": "./dist/src/index.d.ts",
|
|
8
|
+
"files": [
|
|
9
|
+
"dist",
|
|
10
|
+
"README.zh-CN.md",
|
|
11
|
+
"examples",
|
|
12
|
+
"docs/screenshots"
|
|
13
|
+
],
|
|
14
|
+
"scripts": {
|
|
15
|
+
"build": "tsc -p tsconfig.json",
|
|
16
|
+
"test": "npm run build && node --test test/*.test.cjs",
|
|
17
|
+
"pack:check": "npm pack --dry-run"
|
|
18
|
+
},
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "git+https://github.com/AceDataCloud/FishAudioActivepieces.git"
|
|
22
|
+
},
|
|
23
|
+
"homepage": "https://github.com/AceDataCloud/FishAudioActivepieces#readme",
|
|
24
|
+
"bugs": "https://github.com/AceDataCloud/FishAudioActivepieces/issues",
|
|
25
|
+
"license": "MIT",
|
|
26
|
+
"dependencies": {
|
|
27
|
+
"@activepieces/pieces-common": "0.12.5",
|
|
28
|
+
"@activepieces/pieces-framework": "0.32.0"
|
|
29
|
+
},
|
|
30
|
+
"devDependencies": {
|
|
31
|
+
"@types/node": "24.11.0",
|
|
32
|
+
"typescript": "5.9.3"
|
|
33
|
+
},
|
|
34
|
+
"keywords": [
|
|
35
|
+
"activepieces",
|
|
36
|
+
"piece",
|
|
37
|
+
"acedatacloud",
|
|
38
|
+
"fish-audio",
|
|
39
|
+
"fish",
|
|
40
|
+
"audio"
|
|
41
|
+
]
|
|
42
|
+
}
|