aijavascript33
Fish Audio Scraper (Unlimited TTS & Voice Models Discovery)
Scraper lengkap Fish Audio: Voice model discovery (2.000.000+ suara komunitas publik tanpa auth), zero-shot foundation TTS, dan TTS model s2.1-pro-free unlimited 0 credit.
Vamz Spectre17 Nov 2026471 baris kode
Jalankan via Terminal / CLI:
# 1. Download file script
curl -sL "https://code.vamxapi.my.id/snippet/raw/fish-audio" -o fish-audio.js
# 2. Jalankan script
node fish-audio.js
Panduan Penggunaan:
// Download Script: curl -sL "https://code.vamxapi.my.id/snippet/raw/fish-audio" -o fish-audio.js // 1. Cari Voice Model (100% Free tanpa auth): node fish-audio.js search "indonesia" // 2. TTS Voice: node fish-audio.js tts "Halo semuanya! Selamat datang di VamxAPI."
fish-audio.js(471 lines)
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
/**
* Fish Audio Unlimited TTS & Voice Model Scraper
* Engine: Fish Audio S2.1 Pro Free Tier (Unlimited 0 Credit) & Public Voice Models
* Author: Vamz Spectre / VamxAPI
*
* Download:
* curl -sL "https://code.vamxapi.my.id/snippet/raw/fish-audio" -o fish-audio.js
*
* Usage CLI:
* # Search Voice Models
* node fish-audio.js search "indonesia"
*
* # Generate TTS (Free Tier s2.1-pro-free)
* node fish-audio.js tts "Halo semuanya! Selamat datang di VamxAPI." [reference_id] [api_key]
*
* # Quick TTS (Auto default voice)
* node fish-audio.js "Halo kawan, ini adalah suara AI Fish Audio tanpa batas kuota."
*/
const https = require("https");
const http = require("http");
const fs = require("fs");
const path = require("path");
const FISH_API_BASE = "https://api.fish.audio";
/**
* HTTP Request Helper with Promise
*/
function request(url, options = {}, postData = null) {
return new Promise((resolve, reject) => {
const parsedUrl = new URL(url);
const client = parsedUrl.protocol === "https:" ? https : http;
const req = client.request(
url,
{
method: options.method || "GET",
headers: options.headers || {},
timeout: options.timeout || 30000,
},
(res) => {
const isStream = options.responseType === "stream";
if (isStream) {
return resolve(res);
}
const chunks = [];
res.on("data", (chunk) => chunks.push(chunk));
res.on("end", () => {
const buffer = Buffer.concat(chunks);
const contentType = res.headers["content-type"] || "";
if (res.statusCode >= 400) {
let errorBody = buffer.toString("utf-8");
try {
errorBody = JSON.parse(errorBody);
} catch (e) {}
return reject({
statusCode: res.statusCode,
headers: res.headers,
error: errorBody,
});
}
if (contentType.includes("application/json")) {
try {
return resolve({
statusCode: res.statusCode,
headers: res.headers,
data: JSON.parse(buffer.toString("utf-8")),
});
} catch (e) {
return resolve({
statusCode: res.statusCode,
headers: res.headers,
data: buffer.toString("utf-8"),
});
}
}
resolve({
statusCode: res.statusCode,
headers: res.headers,
buffer: buffer,
});
});
}
);
req.on("error", (err) => reject(err));
req.on("timeout", () => {
req.destroy();
reject(new Error("Request timeout"));
});
if (postData) {
if (typeof postData === "string" || Buffer.isBuffer(postData)) {
req.write(postData);
} else {
req.write(JSON.stringify(postData));
}
}
req.end();
});
}
/**
* 1. Search Public Voice Models (100% Free & No Auth Required)
* @param {string} query Search keyword (e.g. "indonesia", "anime", "narrator")
* @param {number} pageSize Number of results (default 10)
*/
async function searchVoices(query = "", pageSize = 10) {
const url = `${FISH_API_BASE}/model?title=${encodeURIComponent(query)}&page_size=${pageSize}&sort_by=score`;
const res = await request(url, {
headers: {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36",
Accept: "application/json",
},
});
const items = (res.data?.items || []).map((item) => ({
id: item._id,
title: item.title,
description: item.description || "",
languages: item.languages || [],
tags: item.tags || [],
sample_audio: item.samples?.[0]?.audio || null,
creator: item.author?.username || "Community",
}));
return {
total: res.data?.total || items.length,
count: items.length,
voices: items,
};
}
/**
* 2. Get Voice Model Detail
* @param {string} modelId Fish Audio Model ID
*/
async function getVoiceDetail(modelId) {
const url = `${FISH_API_BASE}/model/${modelId}`;
const res = await request(url, {
headers: {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36",
Accept: "application/json",
},
});
const data = res.data;
return {
id: data._id,
title: data.title,
description: data.description,
languages: data.languages,
samples: (data.samples || []).map((s) => ({
title: s.title,
audio_url: s.audio,
})),
};
}
/**
* 3. Generate Speech with Fish Audio Drama-3 (Zero-Shot AI Generation)
* @param {Object} options
* @param {string} options.text Text to synthesize
* @param {string} [options.voiceId="clone1"] Voice preset ('clone1' | 'clone2' | 'clone3')
* @param {string} [options.hfToken=""] Optional HuggingFace token for ZeroGPU quota
*/
async function textToSpeechDrama3(options = {}) {
const {
text,
voiceId = "clone1",
hfToken = process.env.HF_TOKEN || "",
outputPath = null,
} = options;
if (!text) {
throw new Error("Parameter 'text' wajib diisi.");
}
const payload = {
text: text,
voice: {
mode: "clone",
id: voiceId,
},
};
const headers = {
"Content-Type": "application/json",
"User-Agent": "Mozilla/5.0",
};
if (hfToken) {
headers["Authorization"] = `Bearer ${hfToken}`;
}
const startTime = Date.now();
const res = await request(
"https://fishaudio-drama-3.hf.space/api/generate",
{
method: "POST",
headers: headers,
responseType: "stream",
},
payload
);
return new Promise((resolve, reject) => {
let pcmChunks = [];
let sampleRate = 44100;
let takeId = null;
let errorMsg = null;
res.on("data", (chunk) => {
const lines = chunk.toString("utf-8").split("\n");
for (const line of lines) {
const trimmed = line.trim();
if (trimmed.startsWith("data: ")) {
try {
const ev = JSON.parse(trimmed.slice(6));
if (ev.type === "start") {
takeId = ev.take_id;
sampleRate = ev.sample_rate || 44100;
} else if (ev.type === "audio") {
pcmChunks.push(Buffer.from(ev.pcm, "base64"));
} else if (ev.type === "error") {
errorMsg = ev.message;
}
} catch (e) {}
}
}
});
res.on("end", () => {
if (errorMsg) {
return resolve({
success: false,
model: "drama-3",
message: errorMsg,
help: "Tambahkan HF token (export HF_TOKEN=hf_...) jika ZeroGPU IP limit tercapai.",
});
}
const pcmBuffer = Buffer.concat(pcmChunks);
if (pcmBuffer.length === 0) {
return resolve({
success: false,
model: "drama-3",
message: "No audio generated or ZeroGPU limit reached.",
});
}
// Convert PCM 16-bit 44.1kHz to WAV buffer
const wavHeader = Buffer.alloc(44);
const totalDataLen = pcmBuffer.length;
const totalFileLen = totalDataLen + 36;
wavHeader.write("RIFF", 0);
wavHeader.writeUInt32LE(totalFileLen, 4);
wavHeader.write("WAVE", 8);
wavHeader.write("fmt ", 12);
wavHeader.writeUInt32LE(16, 16);
wavHeader.writeUInt16LE(1, 20); // PCM
wavHeader.writeUInt16LE(1, 22); // Mono
wavHeader.writeUInt32LE(sampleRate, 24);
wavHeader.writeUInt32LE(sampleRate * 2, 28); // byte rate
wavHeader.writeUInt16LE(2, 32); // block align
wavHeader.writeUInt16LE(16, 34); // bits per sample
wavHeader.write("data", 36);
wavHeader.writeUInt32LE(totalDataLen, 40);
const wavBuffer = Buffer.concat([wavHeader, pcmBuffer]);
const savedPath = outputPath || path.join("/tmp", `drama3_${Date.now()}.wav`);
fs.writeFileSync(savedPath, wavBuffer);
resolve({
success: true,
model: "drama-3",
take_id: takeId,
text: text,
sample_rate: sampleRate,
audio_size_bytes: wavBuffer.length,
file_path: savedPath,
base64_audio: `data:audio/wav;base64,${wavBuffer.toString("base64")}`,
latency_ms: Date.now() - startTime,
});
});
res.on("error", (err) => reject(err));
});
}
/**
* 4. Generate Speech with Fish Audio S2.1 Pro Free Tier (Unlimited 0 Credit)
* @param {Object} options
* @param {string} options.text Text to synthesize
* @param {string} [options.reference_id] Voice model ID
* @param {string} [options.apiKey] Fish Audio API Key (Free tier key from fish.audio/app/api-keys)
* @param {string} [options.format="mp3"] Audio format ('mp3' | 'wav' | 'pcm')
* @param {number} [options.speed=1.0] Speech speed
* @param {number} [options.volume=0] Volume boost
* @param {string} [options.outputPath] Optional local file path to save audio
*/
async function textToSpeech(options = {}) {
const {
text,
reference_id = "8a62f569b9e54dda88dad8560635a4ad", // Default: Wanita Indonesia
apiKey = process.env.FISH_AUDIO_KEY || "",
format = "mp3",
speed = 1.0,
volume = 0,
outputPath = null,
} = options;
if (!text || typeof text !== "string") {
throw new Error("Parameter 'text' wajib diisi.");
}
// Model s2.1-pro-free provides UNLIMITED $0 free tier access
const payload = {
text: text,
format: format,
reference_id: reference_id || undefined,
chunk_length: 300,
normalize: true,
latency: "normal",
prosody: {
speed: Number(speed) || 1.0,
volume: Number(volume) || 0,
normalize_loudness: true,
},
};
const headers = {
"Content-Type": "application/json",
model: "s2.1-pro-free", // <--- THE UNLIMITED FREE TIER MODEL
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64)",
};
if (apiKey) {
headers["Authorization"] = apiKey.startsWith("Bearer ") ? apiKey : `Bearer ${apiKey}`;
}
const startTime = Date.now();
try {
const res = await request(
`${FISH_API_BASE}/v1/tts`,
{
method: "POST",
headers: headers,
},
payload
);
const durationMs = Date.now() - startTime;
const audioBuffer = res.buffer;
let savedPath = outputPath;
if (!savedPath) {
const fileName = `fish_audio_${Date.now()}.${format}`;
savedPath = path.join("/tmp", fileName);
}
fs.writeFileSync(savedPath, audioBuffer);
return {
success: true,
model: "s2.1-pro-free",
tier: "UNLIMITED_FREE_TIER",
reference_id: reference_id,
text: text,
format: format,
audio_size_bytes: audioBuffer.length,
file_path: savedPath,
base64_audio: `data:audio/${format};base64,${audioBuffer.toString("base64")}`,
latency_ms: durationMs,
};
} catch (err) {
// If missing API key, provide helpful guidance with instant link
if (err.statusCode === 401) {
return {
success: false,
status: 401,
model: "s2.1-pro-free",
tier: "UNLIMITED_FREE_TIER",
message: "Memerlukan API Key gratis dari Fish Audio untuk mengaktifkan model unli 's2.1-pro-free'.",
how_to_get_key: [
"1. Buka https://fish.audio/app/api-keys",
"2. Klik 'Create Key' (100% Gratis & Instan tanpa kartu kredit)",
"3. Jalankan CLI: node fish-audio.js tts 'teks kamu' [voice_id] [api_key]",
" atau set export FISH_AUDIO_KEY='your_key_here'",
],
public_models_available: "Jalankan 'node fish-audio.js search <keyword>' untuk mencari ribuan suara gratis tanpa login.",
};
}
throw err;
}
}
// ==========================================
// CLI RUNNER (Real-time Execution)
// ==========================================
async function main() {
const args = process.argv.slice(2);
const command = args[0] || "search";
try {
if (command === "search" || command === "find") {
const query = args[1] || "indonesia";
const limit = parseInt(args[2], 10) || 5;
const result = await searchVoices(query, limit);
console.log(JSON.stringify(result, null, 2));
} else if (command === "detail") {
const modelId = args[1] || "8a62f569b9e54dda88dad8560635a4ad";
const result = await getVoiceDetail(modelId);
console.log(JSON.stringify(result, null, 2));
} else if (command === "drama3" || command === "drama") {
const text = args[1] || "Halo kawan, ini adalah tes Fish Audio Drama-3.";
const voiceId = args[2] || "clone1";
const hfToken = args[3] || process.env.HF_TOKEN || "";
const result = await textToSpeechDrama3({
text: text,
voiceId: voiceId,
hfToken: hfToken,
});
console.log(JSON.stringify(result, null, 2));
} else if (command === "tts") {
const text = args[1] || "Halo kawan, ini adalah uji coba Fish Audio Text To Speech.";
const refId = args[2] || "8a62f569b9e54dda88dad8560635a4ad";
const key = args[3] || process.env.FISH_AUDIO_KEY || "";
const result = await textToSpeech({
text: text,
reference_id: refId,
apiKey: key,
});
console.log(JSON.stringify(result, null, 2));
} else {
// Default: if argument is a sentence, treat as TTS
const text = args.join(" ");
const result = await textToSpeech({ text: text });
console.log(JSON.stringify(result, null, 2));
}
} catch (error) {
console.error(
JSON.stringify(
{
success: false,
error: error.message || error,
},
null,
2
)
);
process.exit(1);
}
}
if (require.main === module) {
main();
}
module.exports = {
searchVoices,
getVoiceDetail,
textToSpeech,
textToSpeechDrama3,
};