TypeScript SDK
Use the AudioLasso TypeScript SDK for the core workflow with fewer raw HTTP calls.
The TypeScript SDK wraps the same HTTP API shown in the rest of the docs.
Use it if you want a simpler developer workflow in Node.js, scripts, backends, or agent tools.
waitForResult follows the queue API and polls status until the job completes. Use streamStatus only when you specifically want live Server-Sent Events.
Install
Install from npm:
npm install audiolassoCreate a client
import { createAudioLasso } from "audiolasso";
const client = createAudioLasso({
apiKey: process.env.AUDIOLASSO_API_KEY,
});Simplest workflow
const job = await client.separate({
audioUrl: "https://example.com/audio.wav",
prompt: "isolate the lead vocal",
idempotencyKey: "workflow-job-123",
});
const result = await client.waitForResult(job.request_id, {
logs: true,
interval: 3,
});
console.log(result.data.target.url);
console.log(result.data.residual.url);The SDK generates an idempotency key when you omit one and safely retries transient failures. Use a stable key when the same logical workflow may restart in another process. Configure transport behavior with requestTimeoutMs and maxRetries; see Reliability and retries.
Upload a local file
const upload = await client.uploadFile("./song.wav");
const job = await client.separate({
fileId: upload.file_id,
prompt: "separate the piano",
});
const result = await client.waitForResult(job.request_id);Flat methods
The flat methods are the easiest ones to learn first:
client.separate(...)client.getStatus(...)client.getResult(...)client.cancel(...)client.waitForResult(...)client.streamStatus(...)client.createUpload(...)client.uploadFile(...)client.getFile(...)client.listModels()
Namespaced methods
If you prefer grouping by area, the same client also exposes:
client.audio.separate(...)client.queue.status(...)client.queue.result(...)client.queue.cancel(...)client.queue.waitForResult(...)client.queue.streamStatus(...)client.files.createUpload(...)client.files.upload(...)client.files.get(...)client.models.list()
Cancel queued or running work with await client.cancel(job.request_id). Cancellation releases the job's reserved credits.
When to use the SDK vs raw HTTP
Use the SDK when:
- you are writing TypeScript or Node.js
- you want fewer raw endpoint strings in application code
- you want upload helpers for local files
Use raw HTTP when:
- you are working in another language
- you need exact wire-level control
- you are debugging requests against the API reference