Skip to content

Latest commit

 

History

History
972 lines (690 loc) · 12 KB

reference.md

File metadata and controls

972 lines (690 loc) · 12 KB

Reference

ApiStatus

client.apiStatus.get() -> Cartesia.ApiInfo

🔌 Usage

await client.apiStatus.get();

⚙️ Parameters

requestOptions: ApiStatus.RequestOptions

Datasets

client.datasets.list() -> Cartesia.PaginatedDatasets

🔌 Usage

await client.datasets.list();

⚙️ Parameters

requestOptions: Datasets.RequestOptions

client.datasets.create({ ...params }) -> Cartesia.Dataset

🔌 Usage

await client.datasets.create({
    name: "string",
});

⚙️ Parameters

request: Cartesia.CreateDatasetRequest

requestOptions: Datasets.RequestOptions

client.datasets.listFiles(id) -> Cartesia.PaginatedDatasetFiles

🔌 Usage

await client.datasets.listFiles("string");

⚙️ Parameters

id: string

requestOptions: Datasets.RequestOptions

client.datasets.uploadFile(file, id, { ...params }) -> void

🔌 Usage

await client.datasets.uploadFile(fs.createReadStream("/path/to/your/file"), "string", {});

⚙️ Parameters

file: File | fs.ReadStream | Blob

id: string

request: Cartesia.UploadDatasetFileRequest

requestOptions: Datasets.RequestOptions

Tts

client.tts.bytes({ ...params }) -> stream.Readable

🔌 Usage

await client.tts.bytes({
    modelId: "sonic-english",
    transcript: "Hello, world!",
    voice: {
        mode: "id",
        id: "694f9389-aac1-45b6-b726-9d9369183238",
    },
    language: "en",
    outputFormat: {
        container: "mp3",
        sampleRate: 44100,
        bitRate: 128000,
    },
});

⚙️ Parameters

request: Cartesia.TtsRequest

requestOptions: Tts.RequestOptions

client.tts.sse({ ...params }) -> core.Stream

🔌 Usage

const response = await client.tts.sse({
    modelId: "sonic-english",
    transcript: "Hello, world!",
    voice: {
        mode: "id",
        id: "694f9389-aac1-45b6-b726-9d9369183238",
    },
    language: "en",
    outputFormat: {
        container: "raw",
        sampleRate: 44100,
        encoding: "pcm_f32le",
    },
});
for await (const item of response) {
    console.log(item);
}

⚙️ Parameters

request: Cartesia.TtsRequest

requestOptions: Tts.RequestOptions

VoiceChanger

client.voiceChanger.bytes(clip, { ...params }) -> stream.Readable

📝 Description

Takes an audio file of speech, and returns an audio file of speech spoken with the same intonation, but with a different voice.

This endpoint is priced at 15 characters per second of input audio.

🔌 Usage

await client.voiceChanger.bytes(fs.createReadStream("/path/to/your/file"), {
    voiceId: "694f9389-aac1-45b6-b726-9d9369183238",
    outputFormatContainer: "mp3",
    outputFormatSampleRate: 44100,
    outputFormatBitRate: 128000,
});

⚙️ Parameters

clip: File | fs.ReadStream | Blob

request: Cartesia.VoiceChangerBytesRequest

requestOptions: VoiceChanger.RequestOptions

client.voiceChanger.sse(clip, { ...params }) -> core.Stream

🔌 Usage

const response = await client.voiceChanger.sse(fs.createReadStream("/path/to/your/file"), {
    voiceId: "694f9389-aac1-45b6-b726-9d9369183238",
    outputFormatContainer: "mp3",
    outputFormatSampleRate: 44100,
    outputFormatBitRate: 128000,
});
for await (const item of response) {
    console.log(item);
}

⚙️ Parameters

clip: File | fs.ReadStream | Blob

request: Cartesia.VoiceChangerSseRequest

requestOptions: VoiceChanger.RequestOptions

Voices

client.voices.list() -> Cartesia.Voice[]

🔌 Usage

await client.voices.list();

⚙️ Parameters

requestOptions: Voices.RequestOptions

client.voices.create({ ...params }) -> Cartesia.Voice

🔌 Usage

await client.voices.create({
    name: "string",
    description: "string",
    embedding: [
        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
        1, 1, 1, 1, 1, 1, 1,
    ],
    language: "en",
    baseVoiceId: "string",
});

⚙️ Parameters

request: Cartesia.CreateVoiceRequest

requestOptions: Voices.RequestOptions

client.voices.delete(id) -> void

🔌 Usage

await client.voices.delete("string");

⚙️ Parameters

id: Cartesia.VoiceId

requestOptions: Voices.RequestOptions

client.voices.update(id, { ...params }) -> Cartesia.Voice

🔌 Usage

await client.voices.update("string", {
    name: "string",
    description: "string",
});

⚙️ Parameters

id: Cartesia.VoiceId

request: Cartesia.UpdateVoiceRequest

requestOptions: Voices.RequestOptions

client.voices.get(id) -> Cartesia.Voice

🔌 Usage

await client.voices.get("string");

⚙️ Parameters

id: Cartesia.VoiceId

requestOptions: Voices.RequestOptions

client.voices.localize({ ...params }) -> Cartesia.EmbeddingResponse

🔌 Usage

await client.voices.localize({
    embedding: [
        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
        1, 1, 1, 1, 1, 1, 1,
    ],
    language: "en",
    originalSpeakerGender: "male",
    dialect: "au",
});

⚙️ Parameters

request: Cartesia.LocalizeVoiceRequest

requestOptions: Voices.RequestOptions

client.voices.mix({ ...params }) -> Cartesia.EmbeddingResponse

🔌 Usage

await client.voices.mix({
    voices: [
        {
            id: "string",
            weight: 1.1,
        },
    ],
});

⚙️ Parameters

request: Cartesia.MixVoicesRequest

requestOptions: Voices.RequestOptions

client.voices.clone(clip, { ...params }) -> Cartesia.VoiceMetadata

📝 Description

Clone a voice from an audio clip. This endpoint has two modes, stability and similarity.

Similarity mode clones are more similar to the source clip, but may reproduce background noise. For these, use an audio clip about 5 seconds long.

Stability mode clones are more stable, but may not sound as similar to the source clip. For these, use an audio clip 10-20 seconds long.

🔌 Usage

await client.voices.clone(fs.createReadStream("/path/to/your/file"), {
    name: "A high-stability cloned voice",
    description: "Copied from Cartesia docs",
    mode: "stability",
    language: "en",
    enhance: true,
});

⚙️ Parameters

clip: File | fs.ReadStream | Blob

request: Cartesia.CloneVoiceRequest

requestOptions: Voices.RequestOptions