@respeecher/respeecher-js
Version:
[](https://buildwithfern.com?utm_source=github&utm_medium=github&utm_campaign=readme&utm_source=https%3A%2F%2Fgithub.com%2Frespeecher%2Frespeecher-js) [ • 2.51 kB
TypeScript
/**
* This file was auto-generated by Fern from our API Definition.
*/
import * as environments from "../../../../environments.js";
import * as core from "../../../../core/index.js";
import * as Respeecher from "../../../index.js";
import * as stream from "stream";
import { TtsSocket } from "./Socket.js";
export declare namespace Tts {
interface Options {
environment?: core.Supplier<environments.RespeecherEnvironment | environments.RespeecherEnvironmentUrls>;
/** Specify a custom URL to connect the client to. */
baseUrl?: core.Supplier<string>;
apiKey?: core.Supplier<string>;
/** Additional headers to include in requests. */
headers?: Record<string, string | core.Supplier<string | undefined> | undefined>;
}
interface RequestOptions {
/** The maximum time to wait for a response in seconds. */
timeoutInSeconds?: number;
/** The number of times to retry the request. Defaults to 2. */
maxRetries?: number;
/** A hook to abort the request. */
abortSignal?: AbortSignal;
/** Additional headers to include in the request. */
headers?: Record<string, string | core.Supplier<string | undefined> | undefined>;
}
interface ConnectArgs {
/** Arbitrary headers to send with the websocket connect request. */
headers?: Record<string, unknown>;
/** Enable debug mode on the websocket. Defaults to false. */
debug?: boolean;
/** Number of reconnect attempts. Defaults to 30. */
reconnectAttempts?: number;
}
}
export declare class Tts {
protected readonly _options: Tts.Options;
constructor(_options?: Tts.Options);
/**
* The easiest way to generate text-to-speech audio. Not suitable for latency-sensitive applications.
*/
bytes(request: Respeecher.tts.BytesGenerationRequest, requestOptions?: Tts.RequestOptions): core.HttpResponsePromise<stream.Readable>;
private __bytes;
/**
* Stream text-to-speech audio as JSONL (JSON lines) objects over HTTP. A less performant alternative to WebSockets, without text input streaming.
*/
sse(request: Respeecher.tts.StreamingGenerationRequest, requestOptions?: Tts.RequestOptions): core.HttpResponsePromise<core.Stream<Respeecher.tts.ServerSentEvent>>;
private __sse;
connect(args?: Tts.ConnectArgs): Promise<TtsSocket>;
protected _getCustomAuthorizationHeaders(): Promise<{
"X-API-Key": string | undefined;
}>;
}