New:Socket for Asana Is Now Available.Learn more
Sign In

@runapi.ai/fish-audio

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@runapi.ai/fish-audio - npm Package Compare versions

Comparing version
0.2.0
to
0.3.0
+73
-3
dist/index.d.mts

@@ -1,2 +0,2 @@

import { TaskResponse, HttpClient, RequestOptions, BaseClient, ClientOptions } from '@runapi.ai/core';
import { TaskResponse, TaskBillingFacts, HttpClient, RequestOptions, BaseClient, ClientOptions } from '@runapi.ai/core';
export { AuthenticationError, InsufficientCreditsError, NetworkError, NotFoundError, RateLimitError, RunApiError, ServiceUnavailableError, TimeoutError, ValidationError } from '@runapi.ai/core';

@@ -25,3 +25,43 @@

references?: ReferenceAudio[];
/** Reusable voice ID returned by `createVoice`. */
voice_id?: string;
}
/** Parameters for creating an account-owned reusable voice. */
interface CreateVoiceParams {
/** Display name for the voice. */
name: string;
/** Publicly fetchable source audio URL. */
source_audio_url: string;
}
/** Parameters for paginating account-owned reusable voices. */
interface ListVoicesParams {
/** Page number, starting at 1. */
page_number?: number;
/** Number of voices per page, from 1 through 100. */
page_size?: number;
}
/** Parameters for getting one account-owned reusable voice. */
interface GetVoiceParams {
/** Reusable voice ID returned by `createVoice`. */
voice_id: string;
}
/** An account-owned reusable voice. */
interface Voice {
voice_id: string;
name?: string;
state: 'created' | 'training' | 'trained' | 'failed';
}
/** Response containing one reusable voice. */
interface VoiceResponse {
voice: Voice;
billing: TaskBillingFacts;
}
/** Paginated response containing account-owned reusable voices. */
interface VoicesResponse {
voices: Voice[];
total: number;
page_number: number;
page_size: number;
billing: TaskBillingFacts;
}
/** A RunAPI-managed audio result. */

@@ -43,2 +83,26 @@ interface Audio {

/** Create an account-owned reusable voice from source audio. */
declare class CreateVoice {
private readonly http;
constructor(http: HttpClient);
/** Create a reusable voice synchronously. */
run(params: CreateVoiceParams, options?: RequestOptions): Promise<VoiceResponse>;
}
/** Get one reusable voice owned by the current account. */
declare class GetVoice {
private readonly http;
constructor(http: HttpClient);
/** Get one account-owned reusable voice synchronously. */
run(params: GetVoiceParams, options?: RequestOptions): Promise<VoiceResponse>;
}
/** List reusable voices owned by the current account. */
declare class ListVoices {
private readonly http;
constructor(http: HttpClient);
/** List account-owned reusable voices synchronously. */
run(params?: ListVoicesParams, options?: RequestOptions): Promise<VoicesResponse>;
}
/** Generate RunAPI-managed MP3 or WAV audio from text. */

@@ -52,9 +116,15 @@ declare class TextToSpeech {

/** Fish Audio speech generation client. */
/** Fish Audio reusable voice and speech generation client. */
declare class FishAudioClient extends BaseClient {
/** Generate speech from text. */
readonly textToSpeech: TextToSpeech;
/** Create an account-owned reusable voice. */
readonly createVoice: CreateVoice;
/** List reusable voices owned by the current account. */
readonly listVoices: ListVoices;
/** Get one reusable voice owned by the current account. */
readonly getVoice: GetVoice;
constructor(options?: ClientOptions);
}
export { type Audio, FishAudioClient, type ReferenceAudio, type TextToSpeechParams, type TextToSpeechResponse };
export { type Audio, type CreateVoiceParams, FishAudioClient, type GetVoiceParams, type ListVoicesParams, type ReferenceAudio, type TextToSpeechParams, type TextToSpeechResponse, type Voice, type VoiceResponse, type VoicesResponse };

@@ -1,2 +0,2 @@

import { TaskResponse, HttpClient, RequestOptions, BaseClient, ClientOptions } from '@runapi.ai/core';
import { TaskResponse, TaskBillingFacts, HttpClient, RequestOptions, BaseClient, ClientOptions } from '@runapi.ai/core';
export { AuthenticationError, InsufficientCreditsError, NetworkError, NotFoundError, RateLimitError, RunApiError, ServiceUnavailableError, TimeoutError, ValidationError } from '@runapi.ai/core';

@@ -25,3 +25,43 @@

references?: ReferenceAudio[];
/** Reusable voice ID returned by `createVoice`. */
voice_id?: string;
}
/** Parameters for creating an account-owned reusable voice. */
interface CreateVoiceParams {
/** Display name for the voice. */
name: string;
/** Publicly fetchable source audio URL. */
source_audio_url: string;
}
/** Parameters for paginating account-owned reusable voices. */
interface ListVoicesParams {
/** Page number, starting at 1. */
page_number?: number;
/** Number of voices per page, from 1 through 100. */
page_size?: number;
}
/** Parameters for getting one account-owned reusable voice. */
interface GetVoiceParams {
/** Reusable voice ID returned by `createVoice`. */
voice_id: string;
}
/** An account-owned reusable voice. */
interface Voice {
voice_id: string;
name?: string;
state: 'created' | 'training' | 'trained' | 'failed';
}
/** Response containing one reusable voice. */
interface VoiceResponse {
voice: Voice;
billing: TaskBillingFacts;
}
/** Paginated response containing account-owned reusable voices. */
interface VoicesResponse {
voices: Voice[];
total: number;
page_number: number;
page_size: number;
billing: TaskBillingFacts;
}
/** A RunAPI-managed audio result. */

@@ -43,2 +83,26 @@ interface Audio {

/** Create an account-owned reusable voice from source audio. */
declare class CreateVoice {
private readonly http;
constructor(http: HttpClient);
/** Create a reusable voice synchronously. */
run(params: CreateVoiceParams, options?: RequestOptions): Promise<VoiceResponse>;
}
/** Get one reusable voice owned by the current account. */
declare class GetVoice {
private readonly http;
constructor(http: HttpClient);
/** Get one account-owned reusable voice synchronously. */
run(params: GetVoiceParams, options?: RequestOptions): Promise<VoiceResponse>;
}
/** List reusable voices owned by the current account. */
declare class ListVoices {
private readonly http;
constructor(http: HttpClient);
/** List account-owned reusable voices synchronously. */
run(params?: ListVoicesParams, options?: RequestOptions): Promise<VoicesResponse>;
}
/** Generate RunAPI-managed MP3 or WAV audio from text. */

@@ -52,9 +116,15 @@ declare class TextToSpeech {

/** Fish Audio speech generation client. */
/** Fish Audio reusable voice and speech generation client. */
declare class FishAudioClient extends BaseClient {
/** Generate speech from text. */
readonly textToSpeech: TextToSpeech;
/** Create an account-owned reusable voice. */
readonly createVoice: CreateVoice;
/** List reusable voices owned by the current account. */
readonly listVoices: ListVoices;
/** Get one reusable voice owned by the current account. */
readonly getVoice: GetVoice;
constructor(options?: ClientOptions);
}
export { type Audio, FishAudioClient, type ReferenceAudio, type TextToSpeechParams, type TextToSpeechResponse };
export { type Audio, type CreateVoiceParams, FishAudioClient, type GetVoiceParams, type ListVoicesParams, type ReferenceAudio, type TextToSpeechParams, type TextToSpeechResponse, type Voice, type VoiceResponse, type VoicesResponse };

@@ -23,12 +23,12 @@ "use strict";

__export(index_exports, {
AuthenticationError: () => import_core3.AuthenticationError,
AuthenticationError: () => import_core6.AuthenticationError,
FishAudioClient: () => FishAudioClient,
InsufficientCreditsError: () => import_core3.InsufficientCreditsError,
NetworkError: () => import_core3.NetworkError,
NotFoundError: () => import_core3.NotFoundError,
RateLimitError: () => import_core3.RateLimitError,
RunApiError: () => import_core3.RunApiError,
ServiceUnavailableError: () => import_core3.ServiceUnavailableError,
TimeoutError: () => import_core3.TimeoutError,
ValidationError: () => import_core3.ValidationError
InsufficientCreditsError: () => import_core6.InsufficientCreditsError,
NetworkError: () => import_core6.NetworkError,
NotFoundError: () => import_core6.NotFoundError,
RateLimitError: () => import_core6.RateLimitError,
RunApiError: () => import_core6.RunApiError,
ServiceUnavailableError: () => import_core6.ServiceUnavailableError,
TimeoutError: () => import_core6.TimeoutError,
ValidationError: () => import_core6.ValidationError
});

@@ -38,5 +38,5 @@ module.exports = __toCommonJS(index_exports);

// src/client.ts
var import_core2 = require("@runapi.ai/core");
var import_core5 = require("@runapi.ai/core");
// src/resources/text-to-speech.ts
// src/resources/create-voice.ts
var import_core = require("@runapi.ai/core");

@@ -46,2 +46,41 @@

var contract = {
"create-voice": {
"models": [],
"fields_by_model": {
"_": {
"name": {
"required": true
},
"source_audio_url": {
"required": true
}
}
}
},
"get-voice": {
"models": [],
"fields_by_model": {
"_": {
"voice_id": {
"required": true
}
}
}
},
"list-voices": {
"models": [],
"fields_by_model": {
"_": {
"page_number": {
"min": 1,
"type": "integer"
},
"page_size": {
"min": 1,
"max": 100,
"type": "integer"
}
}
}
},
"text-to-speech": {

@@ -188,4 +227,56 @@ "models": [

// src/resources/create-voice.ts
var ENDPOINT = "/api/v1/fish_audio/voices";
var CreateVoice = class {
constructor(http) {
this.http = http;
}
http;
/** Create a reusable voice synchronously. */
async run(params, options) {
const body = (0, import_core.compactParams)(params);
(0, import_core.validateParams)(contract["create-voice"], body);
return this.http.request("POST", ENDPOINT, { body, ...options });
}
};
// src/resources/get-voice.ts
var import_core2 = require("@runapi.ai/core");
var ENDPOINT2 = "/api/v1/fish_audio/voices";
var GetVoice = class {
constructor(http) {
this.http = http;
}
http;
/** Get one account-owned reusable voice synchronously. */
async run(params, options) {
const input = (0, import_core2.compactParams)(params);
(0, import_core2.validateParams)(contract["get-voice"], input);
const path = `${ENDPOINT2}/${encodeURIComponent(params.voice_id)}`;
return this.http.request("GET", path, options ?? {});
}
};
// src/resources/list-voices.ts
var import_core3 = require("@runapi.ai/core");
var ENDPOINT3 = "/api/v1/fish_audio/voices";
var ListVoices = class {
constructor(http) {
this.http = http;
}
http;
/** List account-owned reusable voices synchronously. */
async run(params = {}, options) {
const query = (0, import_core3.compactParams)(params);
(0, import_core3.validateParams)(contract["list-voices"], query);
return this.http.request("GET", ENDPOINT3, {
query,
...options
});
}
};
// src/resources/text-to-speech.ts
var ENDPOINT = "/api/v1/fish_audio/text_to_speech";
var import_core4 = require("@runapi.ai/core");
var ENDPOINT4 = "/api/v1/fish_audio/text_to_speech";
var TextToSpeech = class {

@@ -198,5 +289,5 @@ constructor(http) {

async run(params, options) {
const body = (0, import_core.compactParams)(params);
(0, import_core.validateParams)(contract["text-to-speech"], body);
return this.http.request("POST", ENDPOINT, { body, ...options });
const body = (0, import_core4.compactParams)(params);
(0, import_core4.validateParams)(contract["text-to-speech"], body);
return this.http.request("POST", ENDPOINT4, { body, ...options });
}

@@ -206,8 +297,17 @@ };

// src/client.ts
var FishAudioClient = class extends import_core2.BaseClient {
var FishAudioClient = class extends import_core5.BaseClient {
/** Generate speech from text. */
textToSpeech;
/** Create an account-owned reusable voice. */
createVoice;
/** List reusable voices owned by the current account. */
listVoices;
/** Get one reusable voice owned by the current account. */
getVoice;
constructor(options = {}) {
super(options);
this.textToSpeech = new TextToSpeech(this.http);
this.createVoice = new CreateVoice(this.http);
this.listVoices = new ListVoices(this.http);
this.getVoice = new GetVoice(this.http);
}

@@ -217,3 +317,3 @@ };

// src/index.ts
var import_core3 = require("@runapi.ai/core");
var import_core6 = require("@runapi.ai/core");
// Annotate the CommonJS export names for ESM import in node:

@@ -220,0 +320,0 @@ 0 && (module.exports = {

+1
-1

@@ -1,1 +0,1 @@

{"version":3,"sources":["../src/index.ts","../src/client.ts","../src/resources/text-to-speech.ts","../src/contract_gen.ts"],"sourcesContent":["export { FishAudioClient } from './client';\nexport * from './types';\n\nexport {\n AuthenticationError,\n InsufficientCreditsError,\n NetworkError,\n NotFoundError,\n RateLimitError,\n RunApiError,\n ServiceUnavailableError,\n TimeoutError,\n ValidationError,\n} from '@runapi.ai/core';\n","import { BaseClient, type ClientOptions } from '@runapi.ai/core';\nimport { TextToSpeech } from './resources/text-to-speech';\n\n/** Fish Audio speech generation client. */\nexport class FishAudioClient extends BaseClient {\n /** Generate speech from text. */\n public readonly textToSpeech: TextToSpeech;\n\n constructor(options: ClientOptions = {}) {\n super(options);\n this.textToSpeech = new TextToSpeech(this.http);\n }\n}\n","import type { ActionSchema, HttpClient, RequestOptions } from '@runapi.ai/core';\nimport { compactParams, validateParams } from '@runapi.ai/core';\nimport { contract } from '../contract_gen';\nimport type { TextToSpeechParams, TextToSpeechResponse } from '../types';\n\nconst ENDPOINT = '/api/v1/fish_audio/text_to_speech';\n\n/** Generate RunAPI-managed MP3 or WAV audio from text. */\nexport class TextToSpeech {\n constructor(private readonly http: HttpClient) {}\n\n /** Generate speech synchronously. */\n async run(params: TextToSpeechParams, options?: RequestOptions): Promise<TextToSpeechResponse> {\n const body = compactParams(params);\n validateParams(contract['text-to-speech'] as ActionSchema, body as Record<string, unknown>);\n return this.http.request<TextToSpeechResponse>('POST', ENDPOINT, { body, ...options });\n }\n}\n","export const contract = {\n \"text-to-speech\": {\n \"models\": [\n \"s1\",\n \"s2-pro\",\n \"s2.1-pro\"\n ],\n \"fields_by_model\": {\n \"s1\": {\n \"bitrate_kbps\": {\n \"enum\": [\n 64,\n 128,\n 192\n ],\n \"type\": \"integer\"\n },\n \"model\": {\n \"required\": true\n },\n \"output_format\": {\n \"enum\": [\n \"mp3\",\n \"wav\"\n ]\n },\n \"sample_rate_hz\": {\n \"enum\": [\n 8000,\n 16000,\n 24000,\n 32000,\n 44100\n ],\n \"type\": \"integer\"\n },\n \"text\": {\n \"required\": true\n }\n },\n \"s2-pro\": {\n \"bitrate_kbps\": {\n \"enum\": [\n 64,\n 128,\n 192\n ],\n \"type\": \"integer\"\n },\n \"model\": {\n \"required\": true\n },\n \"output_format\": {\n \"enum\": [\n \"mp3\",\n \"wav\"\n ]\n },\n \"sample_rate_hz\": {\n \"enum\": [\n 8000,\n 16000,\n 24000,\n 32000,\n 44100\n ],\n \"type\": \"integer\"\n },\n \"text\": {\n \"required\": true\n }\n },\n \"s2.1-pro\": {\n \"bitrate_kbps\": {\n \"enum\": [\n 64,\n 128,\n 192\n ],\n \"type\": \"integer\"\n },\n \"model\": {\n \"required\": true\n },\n \"output_format\": {\n \"enum\": [\n \"mp3\",\n \"wav\"\n ]\n },\n \"sample_rate_hz\": {\n \"enum\": [\n 8000,\n 16000,\n 24000,\n 32000,\n 44100\n ],\n \"type\": \"integer\"\n },\n \"text\": {\n \"required\": true\n }\n }\n },\n \"rules\": [\n {\n \"when\": {\n \"output_format\": \"wav\"\n },\n \"forbidden\": [\n \"bitrate_kbps\"\n ]\n },\n {\n \"enum\": {\n \"sample_rate_hz\": [\n 32000,\n 44100\n ]\n },\n \"when\": {\n \"output_format\": \"mp3\"\n }\n },\n {\n \"enum\": {\n \"sample_rate_hz\": [\n 32000,\n 44100\n ]\n },\n \"when\": {\n \"output_format\": {\n \"present\": false\n }\n }\n }\n ]\n }\n} as const;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,IAAAA,eAA+C;;;ACC/C,kBAA8C;;;ACDvC,IAAM,WAAW;AAA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index.ts","../src/client.ts","../src/resources/create-voice.ts","../src/contract_gen.ts","../src/resources/get-voice.ts","../src/resources/list-voices.ts","../src/resources/text-to-speech.ts"],"sourcesContent":["export { FishAudioClient } from './client';\nexport * from './types';\n\nexport {\n AuthenticationError,\n InsufficientCreditsError,\n NetworkError,\n NotFoundError,\n RateLimitError,\n RunApiError,\n ServiceUnavailableError,\n TimeoutError,\n ValidationError,\n} from '@runapi.ai/core';\n","import { BaseClient, type ClientOptions } from '@runapi.ai/core';\nimport { CreateVoice } from './resources/create-voice';\nimport { GetVoice } from './resources/get-voice';\nimport { ListVoices } from './resources/list-voices';\nimport { TextToSpeech } from './resources/text-to-speech';\n\n/** Fish Audio reusable voice and speech generation client. */\nexport class FishAudioClient extends BaseClient {\n /** Generate speech from text. */\n public readonly textToSpeech: TextToSpeech;\n /** Create an account-owned reusable voice. */\n public readonly createVoice: CreateVoice;\n /** List reusable voices owned by the current account. */\n public readonly listVoices: ListVoices;\n /** Get one reusable voice owned by the current account. */\n public readonly getVoice: GetVoice;\n\n constructor(options: ClientOptions = {}) {\n super(options);\n this.textToSpeech = new TextToSpeech(this.http);\n this.createVoice = new CreateVoice(this.http);\n this.listVoices = new ListVoices(this.http);\n this.getVoice = new GetVoice(this.http);\n }\n}\n","import type { ActionSchema, HttpClient, RequestOptions } from '@runapi.ai/core';\nimport { compactParams, validateParams } from '@runapi.ai/core';\nimport { contract } from '../contract_gen';\nimport type { CreateVoiceParams, VoiceResponse } from '../types';\n\nconst ENDPOINT = '/api/v1/fish_audio/voices';\n\n/** Create an account-owned reusable voice from source audio. */\nexport class CreateVoice {\n constructor(private readonly http: HttpClient) {}\n\n /** Create a reusable voice synchronously. */\n async run(params: CreateVoiceParams, options?: RequestOptions): Promise<VoiceResponse> {\n const body = compactParams(params);\n validateParams(contract['create-voice'] as ActionSchema, body as Record<string, unknown>);\n return this.http.request<VoiceResponse>('POST', ENDPOINT, { body, ...options });\n }\n}\n","export const contract = {\n \"create-voice\": {\n \"models\": [],\n \"fields_by_model\": {\n \"_\": {\n \"name\": {\n \"required\": true\n },\n \"source_audio_url\": {\n \"required\": true\n }\n }\n }\n },\n \"get-voice\": {\n \"models\": [],\n \"fields_by_model\": {\n \"_\": {\n \"voice_id\": {\n \"required\": true\n }\n }\n }\n },\n \"list-voices\": {\n \"models\": [],\n \"fields_by_model\": {\n \"_\": {\n \"page_number\": {\n \"min\": 1,\n \"type\": \"integer\"\n },\n \"page_size\": {\n \"min\": 1,\n \"max\": 100,\n \"type\": \"integer\"\n }\n }\n }\n },\n \"text-to-speech\": {\n \"models\": [\n \"s1\",\n \"s2-pro\",\n \"s2.1-pro\"\n ],\n \"fields_by_model\": {\n \"s1\": {\n \"bitrate_kbps\": {\n \"enum\": [\n 64,\n 128,\n 192\n ],\n \"type\": \"integer\"\n },\n \"model\": {\n \"required\": true\n },\n \"output_format\": {\n \"enum\": [\n \"mp3\",\n \"wav\"\n ]\n },\n \"sample_rate_hz\": {\n \"enum\": [\n 8000,\n 16000,\n 24000,\n 32000,\n 44100\n ],\n \"type\": \"integer\"\n },\n \"text\": {\n \"required\": true\n }\n },\n \"s2-pro\": {\n \"bitrate_kbps\": {\n \"enum\": [\n 64,\n 128,\n 192\n ],\n \"type\": \"integer\"\n },\n \"model\": {\n \"required\": true\n },\n \"output_format\": {\n \"enum\": [\n \"mp3\",\n \"wav\"\n ]\n },\n \"sample_rate_hz\": {\n \"enum\": [\n 8000,\n 16000,\n 24000,\n 32000,\n 44100\n ],\n \"type\": \"integer\"\n },\n \"text\": {\n \"required\": true\n }\n },\n \"s2.1-pro\": {\n \"bitrate_kbps\": {\n \"enum\": [\n 64,\n 128,\n 192\n ],\n \"type\": \"integer\"\n },\n \"model\": {\n \"required\": true\n },\n \"output_format\": {\n \"enum\": [\n \"mp3\",\n \"wav\"\n ]\n },\n \"sample_rate_hz\": {\n \"enum\": [\n 8000,\n 16000,\n 24000,\n 32000,\n 44100\n ],\n \"type\": \"integer\"\n },\n \"text\": {\n \"required\": true\n }\n }\n },\n \"rules\": [\n {\n \"when\": {\n \"output_format\": \"wav\"\n },\n \"forbidden\": [\n \"bitrate_kbps\"\n ]\n },\n {\n \"enum\": {\n \"sample_rate_hz\": [\n 32000,\n 44100\n ]\n },\n \"when\": {\n \"output_format\": \"mp3\"\n }\n },\n {\n \"enum\": {\n \"sample_rate_hz\": [\n 32000,\n 44100\n ]\n },\n \"when\": {\n \"output_format\": {\n \"present\": false\n }\n }\n }\n ]\n }\n} as const;\n","import type { ActionSchema, HttpClient, RequestOptions } from '@runapi.ai/core';\nimport { compactParams, validateParams } from '@runapi.ai/core';\nimport { contract } from '../contract_gen';\nimport type { GetVoiceParams, VoiceResponse } from '../types';\n\nconst ENDPOINT = '/api/v1/fish_audio/voices';\n\n/** Get one reusable voice owned by the current account. */\nexport class GetVoice {\n constructor(private readonly http: HttpClient) {}\n\n /** Get one account-owned reusable voice synchronously. */\n async run(params: GetVoiceParams, options?: RequestOptions): Promise<VoiceResponse> {\n const input = compactParams(params);\n validateParams(contract['get-voice'] as ActionSchema, input as Record<string, unknown>);\n const path = `${ENDPOINT}/${encodeURIComponent(params.voice_id)}`;\n return this.http.request<VoiceResponse>('GET', path, options ?? {});\n }\n}\n","import type { ActionSchema, HttpClient, QueryParams, RequestOptions } from '@runapi.ai/core';\nimport { compactParams, validateParams } from '@runapi.ai/core';\nimport { contract } from '../contract_gen';\nimport type { ListVoicesParams, VoicesResponse } from '../types';\n\nconst ENDPOINT = '/api/v1/fish_audio/voices';\n\n/** List reusable voices owned by the current account. */\nexport class ListVoices {\n constructor(private readonly http: HttpClient) {}\n\n /** List account-owned reusable voices synchronously. */\n async run(params: ListVoicesParams = {}, options?: RequestOptions): Promise<VoicesResponse> {\n const query = compactParams(params);\n validateParams(contract['list-voices'] as ActionSchema, query as Record<string, unknown>);\n return this.http.request<VoicesResponse>('GET', ENDPOINT, {\n query: query as QueryParams,\n ...options,\n });\n }\n}\n","import type { ActionSchema, HttpClient, RequestOptions } from '@runapi.ai/core';\nimport { compactParams, validateParams } from '@runapi.ai/core';\nimport { contract } from '../contract_gen';\nimport type { TextToSpeechParams, TextToSpeechResponse } from '../types';\n\nconst ENDPOINT = '/api/v1/fish_audio/text_to_speech';\n\n/** Generate RunAPI-managed MP3 or WAV audio from text. */\nexport class TextToSpeech {\n constructor(private readonly http: HttpClient) {}\n\n /** Generate speech synchronously. */\n async run(params: TextToSpeechParams, options?: RequestOptions): Promise<TextToSpeechResponse> {\n const body = compactParams(params);\n validateParams(contract['text-to-speech'] as ActionSchema, body as Record<string, unknown>);\n return this.http.request<TextToSpeechResponse>('POST', ENDPOINT, { body, ...options });\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,IAAAA,eAA+C;;;ACC/C,kBAA8C;;;ACDvC,IAAM,WAAW;AAAA,EACtB,gBAAgB;AAAA,IACd,UAAU,CAAC;AAAA,IACX,mBAAmB;AAAA,MACjB,KAAK;AAAA,QACH,QAAQ;AAAA,UACN,YAAY;AAAA,QACd;AAAA,QACA,oBAAoB;AAAA,UAClB,YAAY;AAAA,QACd;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA,EACA,aAAa;AAAA,IACX,UAAU,CAAC;AAAA,IACX,mBAAmB;AAAA,MACjB,KAAK;AAAA,QACH,YAAY;AAAA,UACV,YAAY;AAAA,QACd;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA,EACA,eAAe;AAAA,IACb,UAAU,CAAC;AAAA,IACX,mBAAmB;AAAA,MACjB,KAAK;AAAA,QACH,eAAe;AAAA,UACb,OAAO;AAAA,UACP,QAAQ;AAAA,QACV;AAAA,QACA,aAAa;AAAA,UACX,OAAO;AAAA,UACP,OAAO;AAAA,UACP,QAAQ;AAAA,QACV;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA,EACA,kBAAkB;AAAA,IAChB,UAAU;AAA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T","import_core","ENDPOINT","import_core","ENDPOINT","import_core"]}
// src/client.ts
import { BaseClient } from "@runapi.ai/core";
// src/resources/text-to-speech.ts
// src/resources/create-voice.ts
import { compactParams, validateParams } from "@runapi.ai/core";

@@ -9,2 +9,41 @@

var contract = {
"create-voice": {
"models": [],
"fields_by_model": {
"_": {
"name": {
"required": true
},
"source_audio_url": {
"required": true
}
}
}
},
"get-voice": {
"models": [],
"fields_by_model": {
"_": {
"voice_id": {
"required": true
}
}
}
},
"list-voices": {
"models": [],
"fields_by_model": {
"_": {
"page_number": {
"min": 1,
"type": "integer"
},
"page_size": {
"min": 1,
"max": 100,
"type": "integer"
}
}
}
},
"text-to-speech": {

@@ -151,4 +190,56 @@ "models": [

// src/resources/create-voice.ts
var ENDPOINT = "/api/v1/fish_audio/voices";
var CreateVoice = class {
constructor(http) {
this.http = http;
}
http;
/** Create a reusable voice synchronously. */
async run(params, options) {
const body = compactParams(params);
validateParams(contract["create-voice"], body);
return this.http.request("POST", ENDPOINT, { body, ...options });
}
};
// src/resources/get-voice.ts
import { compactParams as compactParams2, validateParams as validateParams2 } from "@runapi.ai/core";
var ENDPOINT2 = "/api/v1/fish_audio/voices";
var GetVoice = class {
constructor(http) {
this.http = http;
}
http;
/** Get one account-owned reusable voice synchronously. */
async run(params, options) {
const input = compactParams2(params);
validateParams2(contract["get-voice"], input);
const path = `${ENDPOINT2}/${encodeURIComponent(params.voice_id)}`;
return this.http.request("GET", path, options ?? {});
}
};
// src/resources/list-voices.ts
import { compactParams as compactParams3, validateParams as validateParams3 } from "@runapi.ai/core";
var ENDPOINT3 = "/api/v1/fish_audio/voices";
var ListVoices = class {
constructor(http) {
this.http = http;
}
http;
/** List account-owned reusable voices synchronously. */
async run(params = {}, options) {
const query = compactParams3(params);
validateParams3(contract["list-voices"], query);
return this.http.request("GET", ENDPOINT3, {
query,
...options
});
}
};
// src/resources/text-to-speech.ts
var ENDPOINT = "/api/v1/fish_audio/text_to_speech";
import { compactParams as compactParams4, validateParams as validateParams4 } from "@runapi.ai/core";
var ENDPOINT4 = "/api/v1/fish_audio/text_to_speech";
var TextToSpeech = class {

@@ -161,5 +252,5 @@ constructor(http) {

async run(params, options) {
const body = compactParams(params);
validateParams(contract["text-to-speech"], body);
return this.http.request("POST", ENDPOINT, { body, ...options });
const body = compactParams4(params);
validateParams4(contract["text-to-speech"], body);
return this.http.request("POST", ENDPOINT4, { body, ...options });
}

@@ -172,5 +263,14 @@ };

textToSpeech;
/** Create an account-owned reusable voice. */
createVoice;
/** List reusable voices owned by the current account. */
listVoices;
/** Get one reusable voice owned by the current account. */
getVoice;
constructor(options = {}) {
super(options);
this.textToSpeech = new TextToSpeech(this.http);
this.createVoice = new CreateVoice(this.http);
this.listVoices = new ListVoices(this.http);
this.getVoice = new GetVoice(this.http);
}

@@ -177,0 +277,0 @@ };

@@ -1,1 +0,1 @@

{"version":3,"sources":["../src/client.ts","../src/resources/text-to-speech.ts","../src/contract_gen.ts","../src/index.ts"],"sourcesContent":["import { BaseClient, type ClientOptions } from '@runapi.ai/core';\nimport { TextToSpeech } from './resources/text-to-speech';\n\n/** Fish Audio speech generation client. */\nexport class FishAudioClient extends BaseClient {\n /** Generate speech from text. */\n public readonly textToSpeech: TextToSpeech;\n\n constructor(options: ClientOptions = {}) {\n super(options);\n this.textToSpeech = new TextToSpeech(this.http);\n }\n}\n","import type { ActionSchema, HttpClient, RequestOptions } from '@runapi.ai/core';\nimport { compactParams, validateParams } from '@runapi.ai/core';\nimport { contract } from '../contract_gen';\nimport type { TextToSpeechParams, TextToSpeechResponse } from '../types';\n\nconst ENDPOINT = '/api/v1/fish_audio/text_to_speech';\n\n/** Generate RunAPI-managed MP3 or WAV audio from text. */\nexport class TextToSpeech {\n constructor(private readonly http: HttpClient) {}\n\n /** Generate speech synchronously. */\n async run(params: TextToSpeechParams, options?: RequestOptions): Promise<TextToSpeechResponse> {\n const body = compactParams(params);\n validateParams(contract['text-to-speech'] as ActionSchema, body as Record<string, unknown>);\n return this.http.request<TextToSpeechResponse>('POST', ENDPOINT, { body, ...options });\n }\n}\n","export const contract = {\n \"text-to-speech\": {\n \"models\": [\n \"s1\",\n \"s2-pro\",\n \"s2.1-pro\"\n ],\n \"fields_by_model\": {\n \"s1\": {\n \"bitrate_kbps\": {\n \"enum\": [\n 64,\n 128,\n 192\n ],\n \"type\": \"integer\"\n },\n \"model\": {\n \"required\": true\n },\n \"output_format\": {\n \"enum\": [\n \"mp3\",\n \"wav\"\n ]\n },\n \"sample_rate_hz\": {\n \"enum\": [\n 8000,\n 16000,\n 24000,\n 32000,\n 44100\n ],\n \"type\": \"integer\"\n },\n \"text\": {\n \"required\": true\n }\n },\n \"s2-pro\": {\n \"bitrate_kbps\": {\n \"enum\": [\n 64,\n 128,\n 192\n ],\n \"type\": \"integer\"\n },\n \"model\": {\n \"required\": true\n },\n \"output_format\": {\n \"enum\": [\n \"mp3\",\n \"wav\"\n ]\n },\n \"sample_rate_hz\": {\n \"enum\": [\n 8000,\n 16000,\n 24000,\n 32000,\n 44100\n ],\n \"type\": \"integer\"\n },\n \"text\": {\n \"required\": true\n }\n },\n \"s2.1-pro\": {\n \"bitrate_kbps\": {\n \"enum\": [\n 64,\n 128,\n 192\n ],\n \"type\": \"integer\"\n },\n \"model\": {\n \"required\": true\n },\n \"output_format\": {\n \"enum\": [\n \"mp3\",\n \"wav\"\n ]\n },\n \"sample_rate_hz\": {\n \"enum\": [\n 8000,\n 16000,\n 24000,\n 32000,\n 44100\n ],\n \"type\": \"integer\"\n },\n \"text\": {\n \"required\": true\n }\n }\n },\n \"rules\": [\n {\n \"when\": {\n \"output_format\": \"wav\"\n },\n \"forbidden\": [\n \"bitrate_kbps\"\n ]\n },\n {\n \"enum\": {\n \"sample_rate_hz\": [\n 32000,\n 44100\n ]\n },\n \"when\": {\n \"output_format\": \"mp3\"\n }\n },\n {\n \"enum\": {\n \"sample_rate_hz\": [\n 32000,\n 44100\n ]\n },\n \"when\": {\n \"output_format\": {\n \"present\": false\n }\n }\n }\n ]\n }\n} as const;\n","export { FishAudioClient } from './client';\nexport * from './types';\n\nexport {\n AuthenticationError,\n InsufficientCreditsError,\n NetworkError,\n NotFoundError,\n RateLimitError,\n RunApiError,\n ServiceUnavailableError,\n TimeoutError,\n ValidationError,\n} from '@runapi.ai/core';\n"],"mappings":";AAAA,SAAS,kBAAsC;;;ACC/C,SAAS,eAAe,sBAAsB;;;ACDvC,IAAM,WAAW;AAAA,EACtB,kBAAkB;AAAA,IAChB,UAAU;AAAA,MACR;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,IACA,mBAAmB;AAAA,MACjB,MAAM;AAAA,QACJ,gBAAgB;AAAA,UACd,QAAQ;AAAA,YACN;AAAA,YACA;AAAA,YACA;AAAA,UACF;AAAA,UACA,QAAQ;AAAA,QACV;AAAA,QACA,SAAS;AAAA,UACP,YAAY;AAAA,QACd;AAAA,QACA,iBAAiB;AAAA,UACf,QAAQ;AAAA,YACN;AAAA,YACA;AAAA,UACF;AAAA,QACF;AAAA,QACA,kBAAkB;AAAA,UAChB,QAAQ;AAAA,YACN;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,UACF;AAAA,UACA,QAAQ;AAAA,QACV;AAAA,QACA,QAAQ;AAAA,UACN,YAAY;AAAA,QACd;AAAA,MACF;AAAA,MACA,UAAU;AAAA,QACR,gBAAgB;AAAA,UACd,QAAQ;AAAA,YACN;AAAA,YACA;AAAA,YACA;AAAA,UACF;AAAA,UACA,QAAQ;AAAA,QACV;AAAA,QACA,SAAS;AAAA,UACP,YAAY;AAAA,QACd;AAAA,QACA,iBAAiB;AAAA,UACf,QAAQ;AAAA,YACN;AAAA,YACA;AAAA,UACF;AAAA,QACF;AAAA,QACA,kBAAkB;AAAA,UAChB,QAAQ;AAAA,YACN;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,UACF;AAAA,UACA,QAAQ;AAAA,QACV;AAAA,QACA,QAAQ;AAAA,UACN,YAAY;AAAA,Q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M,GAAG,QAAQ,CAAC;AAAA,EACvF;AACF;;;ADbO,IAAM,kBAAN,cAA8B,WAAW;AAAA;AAAA,EAE9B;AAAA,EAEhB,YAAY,UAAyB,CAAC,GAAG;AACvC,UAAM,OAAO;AACb,SAAK,eAAe,IAAI,aAAa,KAAK,IAAI;AAAA,EAChD;AACF;;;AGTA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;","names":[]}
{"version":3,"sources":["../src/client.ts","../src/resources/create-voice.ts","../src/contract_gen.ts","../src/resources/get-voice.ts","../src/resources/list-voices.ts","../src/resources/text-to-speech.ts","../src/index.ts"],"sourcesContent":["import { BaseClient, type ClientOptions } from '@runapi.ai/core';\nimport { CreateVoice } from './resources/create-voice';\nimport { GetVoice } from './resources/get-voice';\nimport { ListVoices } from './resources/list-voices';\nimport { TextToSpeech } from './resources/text-to-speech';\n\n/** Fish Audio reusable voice and speech generation client. */\nexport class FishAudioClient extends BaseClient {\n /** Generate speech from text. */\n public readonly textToSpeech: TextToSpeech;\n /** Create an account-owned reusable voice. */\n public readonly createVoice: CreateVoice;\n /** List reusable voices owned by the current account. */\n public readonly listVoices: ListVoices;\n /** Get one reusable voice owned by the current account. */\n public readonly getVoice: GetVoice;\n\n constructor(options: ClientOptions = {}) {\n super(options);\n this.textToSpeech = new TextToSpeech(this.http);\n this.createVoice = new CreateVoice(this.http);\n this.listVoices = new ListVoices(this.http);\n this.getVoice = new GetVoice(this.http);\n }\n}\n","import type { ActionSchema, HttpClient, RequestOptions } from '@runapi.ai/core';\nimport { compactParams, validateParams } from '@runapi.ai/core';\nimport { contract } from '../contract_gen';\nimport type { CreateVoiceParams, VoiceResponse } from '../types';\n\nconst ENDPOINT = '/api/v1/fish_audio/voices';\n\n/** Create an account-owned reusable voice from source audio. */\nexport class CreateVoice {\n constructor(private readonly http: HttpClient) {}\n\n /** Create a reusable voice synchronously. */\n async run(params: CreateVoiceParams, options?: RequestOptions): Promise<VoiceResponse> {\n const body = compactParams(params);\n validateParams(contract['create-voice'] as ActionSchema, body as Record<string, unknown>);\n return this.http.request<VoiceResponse>('POST', ENDPOINT, { body, ...options });\n }\n}\n","export const contract = {\n \"create-voice\": {\n \"models\": [],\n \"fields_by_model\": {\n \"_\": {\n \"name\": {\n \"required\": true\n },\n \"source_audio_url\": {\n \"required\": true\n }\n }\n }\n },\n \"get-voice\": {\n \"models\": [],\n \"fields_by_model\": {\n \"_\": {\n \"voice_id\": {\n \"required\": true\n }\n }\n }\n },\n \"list-voices\": {\n \"models\": [],\n \"fields_by_model\": {\n \"_\": {\n \"page_number\": {\n \"min\": 1,\n \"type\": \"integer\"\n },\n \"page_size\": {\n \"min\": 1,\n \"max\": 100,\n \"type\": \"integer\"\n }\n }\n }\n },\n \"text-to-speech\": {\n \"models\": [\n \"s1\",\n \"s2-pro\",\n \"s2.1-pro\"\n ],\n \"fields_by_model\": {\n \"s1\": {\n \"bitrate_kbps\": {\n \"enum\": [\n 64,\n 128,\n 192\n ],\n \"type\": \"integer\"\n },\n \"model\": {\n \"required\": true\n },\n \"output_format\": {\n \"enum\": [\n \"mp3\",\n \"wav\"\n ]\n },\n \"sample_rate_hz\": {\n \"enum\": [\n 8000,\n 16000,\n 24000,\n 32000,\n 44100\n ],\n \"type\": \"integer\"\n },\n \"text\": {\n \"required\": true\n }\n },\n \"s2-pro\": {\n \"bitrate_kbps\": {\n \"enum\": [\n 64,\n 128,\n 192\n ],\n \"type\": \"integer\"\n },\n \"model\": {\n \"required\": true\n },\n \"output_format\": {\n \"enum\": [\n \"mp3\",\n \"wav\"\n ]\n },\n \"sample_rate_hz\": {\n \"enum\": [\n 8000,\n 16000,\n 24000,\n 32000,\n 44100\n ],\n \"type\": \"integer\"\n },\n \"text\": {\n \"required\": true\n }\n },\n \"s2.1-pro\": {\n \"bitrate_kbps\": {\n \"enum\": [\n 64,\n 128,\n 192\n ],\n \"type\": \"integer\"\n },\n \"model\": {\n \"required\": true\n },\n \"output_format\": {\n \"enum\": [\n \"mp3\",\n \"wav\"\n ]\n },\n \"sample_rate_hz\": {\n \"enum\": [\n 8000,\n 16000,\n 24000,\n 32000,\n 44100\n ],\n \"type\": \"integer\"\n },\n \"text\": {\n \"required\": true\n }\n }\n },\n \"rules\": [\n {\n \"when\": {\n \"output_format\": \"wav\"\n },\n \"forbidden\": [\n \"bitrate_kbps\"\n ]\n },\n {\n \"enum\": {\n \"sample_rate_hz\": [\n 32000,\n 44100\n ]\n },\n \"when\": {\n \"output_format\": \"mp3\"\n }\n },\n {\n \"enum\": {\n \"sample_rate_hz\": [\n 32000,\n 44100\n ]\n },\n \"when\": {\n \"output_format\": {\n \"present\": false\n }\n }\n }\n ]\n }\n} as const;\n","import type { ActionSchema, HttpClient, RequestOptions } from '@runapi.ai/core';\nimport { compactParams, validateParams } from '@runapi.ai/core';\nimport { contract } from '../contract_gen';\nimport type { GetVoiceParams, VoiceResponse } from '../types';\n\nconst ENDPOINT = '/api/v1/fish_audio/voices';\n\n/** Get one reusable voice owned by the current account. */\nexport class GetVoice {\n constructor(private readonly http: HttpClient) {}\n\n /** Get one account-owned reusable voice synchronously. */\n async run(params: GetVoiceParams, options?: RequestOptions): Promise<VoiceResponse> {\n const input = compactParams(params);\n validateParams(contract['get-voice'] as ActionSchema, input as Record<string, unknown>);\n const path = `${ENDPOINT}/${encodeURIComponent(params.voice_id)}`;\n return this.http.request<VoiceResponse>('GET', path, options ?? {});\n }\n}\n","import type { ActionSchema, HttpClient, QueryParams, RequestOptions } from '@runapi.ai/core';\nimport { compactParams, validateParams } from '@runapi.ai/core';\nimport { contract } from '../contract_gen';\nimport type { ListVoicesParams, VoicesResponse } from '../types';\n\nconst ENDPOINT = '/api/v1/fish_audio/voices';\n\n/** List reusable voices owned by the current account. */\nexport class ListVoices {\n constructor(private readonly http: HttpClient) {}\n\n /** List account-owned reusable voices synchronously. */\n async run(params: ListVoicesParams = {}, options?: RequestOptions): Promise<VoicesResponse> {\n const query = compactParams(params);\n validateParams(contract['list-voices'] as ActionSchema, query as Record<string, unknown>);\n return this.http.request<VoicesResponse>('GET', ENDPOINT, {\n query: query as QueryParams,\n ...options,\n });\n }\n}\n","import type { ActionSchema, HttpClient, RequestOptions } from '@runapi.ai/core';\nimport { compactParams, validateParams } from '@runapi.ai/core';\nimport { contract } from '../contract_gen';\nimport type { TextToSpeechParams, TextToSpeechResponse } from '../types';\n\nconst ENDPOINT = '/api/v1/fish_audio/text_to_speech';\n\n/** Generate RunAPI-managed MP3 or WAV audio from text. */\nexport class TextToSpeech {\n constructor(private readonly http: HttpClient) {}\n\n /** Generate speech synchronously. */\n async run(params: TextToSpeechParams, options?: RequestOptions): Promise<TextToSpeechResponse> {\n const body = compactParams(params);\n validateParams(contract['text-to-speech'] as ActionSchema, body as Record<string, unknown>);\n return this.http.request<TextToSpeechResponse>('POST', ENDPOINT, { body, ...options });\n }\n}\n","export { FishAudioClient } from './client';\nexport * from './types';\n\nexport {\n AuthenticationError,\n InsufficientCreditsError,\n NetworkError,\n NotFoundError,\n RateLimitError,\n RunApiError,\n ServiceUnavailableError,\n TimeoutError,\n ValidationError,\n} from '@runapi.ai/core';\n"],"mappings":";AAAA,SAAS,kBAAsC;;;ACC/C,SAAS,eAAe,sBAAsB;;;ACDvC,IAAM,WAAW;AAAA,EACtB,gBAAgB;AAAA,IACd,UAAU,CAAC;AAAA,IACX,mBAAmB;AAAA,MACjB,KAAK;AAAA,QACH,QAAQ;AAAA,UACN,YAAY;AAAA,QACd;AAAA,QACA,oBAAoB;AAAA,UAClB,YAAY;AAAA,QACd;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA,EACA,aAAa;AAAA,IACX,UAAU,CAAC;AAAA,IACX,mBAAmB;AAAA,MACjB,KAAK;AAAA,QACH,YAAY;AAAA,UACV,YAAY;AAAA,QACd;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA,EACA,eAAe;AAAA,IACb,UAAU,CAAC;A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AA;AAAA,EAEA;AAAA;AAAA,EAEA;AAAA;AAAA,EAEA;AAAA,EAEhB,YAAY,UAAyB,CAAC,GAAG;AACvC,UAAM,OAAO;AACb,SAAK,eAAe,IAAI,aAAa,KAAK,IAAI;AAC9C,SAAK,cAAc,IAAI,YAAY,KAAK,IAAI;AAC5C,SAAK,aAAa,IAAI,WAAW,KAAK,IAAI;AAC1C,SAAK,WAAW,IAAI,SAAS,KAAK,IAAI;AAAA,EACxC;AACF;;;AMrBA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;","names":["compactParams","validateParams","ENDPOINT","compactParams","validateParams","compactParams","validateParams","ENDPOINT","compactParams","validateParams","compactParams","validateParams","ENDPOINT","compactParams","validateParams"]}

@@ -6,4 +6,4 @@ {

},
"version": "0.2.0",
"description": "RunAPI Fish Audio SDK for speech generation in JavaScript, Python, Ruby, Go, Java, and PHP",
"version": "0.3.0",
"description": "RunAPI Fish Audio SDK for account-owned voice resources and speech generation in JavaScript, Python, Ruby, Go, Java, and PHP",
"main": "./dist/index.js",

@@ -34,3 +34,3 @@ "module": "./dist/index.mjs",

"dependencies": {
"@runapi.ai/core": "^0.3.3"
"@runapi.ai/core": "^0.4.0"
},

@@ -37,0 +37,0 @@ "devDependencies": {

# Fish Audio JavaScript SDK for RunAPI
Install `@runapi.ai/fish-audio`, create `FishAudioClient`, and call `client.textToSpeech.run({ model: 's2.1-pro', text: 'Hello [excited]', output_format: 'wav', sample_rate_hz: 44100 })`.
Install `@runapi.ai/fish-audio` and create a `FishAudioClient`.
```javascript
const created = await client.createVoice.run({ name: 'Narrator', source_audio_url: 'https://cdn.runapi.ai/public/samples/voice.mp3' });
const voice = await client.getVoice.run({ voice_id: created.voice.voice_id });
if (voice.voice.state !== 'trained') throw new Error(`Voice is ${voice.voice.state}`);
const result = await client.textToSpeech.run({ model: 's2.1-pro', text: 'Hello [excited]', voice_id: created.voice.voice_id, output_format: 'wav', sample_rate_hz: 44100 });
```
Pass optional `references` entries with base64-encoded raw audio bytes and exact transcripts for request-scoped voice matching.
Use `listVoices` and `getVoice` to inspect account-owned voice resources. Only `trained` voices can be submitted for speech generation; a returned `voice_id` is a best-effort reference and may stop working later. Update, delete, revoke, or voice-library management methods are not provided; voice retention is not promised.
The output defaults to MP3. Select WAV with `output_format`; `bitrate_kbps` applies only to MP3.

@@ -8,0 +17,0 @@