echonova_ai 0.0.2
echonova_ai: ^0.0.2 copied to clipboard
Official Dart and Flutter SDK for the EchoNova speech API: Text to Speech, Speech to Text and Sound Cleaning, over REST and WebSocket streaming.
Changelog #
0.0.2 #
Security fixes. Upgrading is recommended.
verifyWebhookchecks that a delivery's body matches its event. The signature doesn't cover theX-Webhook-Eventheader, so a signed delivery could otherwise be replayed under another event name:- a
job.completedmust carry its result (audioUrlortranscription); - a
job.failedmust not carry one; spending.warningandspending.exhaustedmust carry finitecreditsUsedandcreditLimit. These two events share a body shape, so one can still be relabelled as the other until the API signs the event name.
- a
verifyWebhookrefuses a timestamp header longer than 15 characters before parsing it.- A path ID of
.or..throwsUsageExceptionbefore any request is sent, like an empty one. - When
downloadTois given a directory, it names the filedownloadif the link's file name contains:or a control character. - A plain
httpbase URL to a host other than this machine logs a warning once, because the API key or auth headers would cross the network unencrypted. - At most 64 KiB of an error response's body is read.
- The
httpClientdocumentation says that streams don't use it: they open their own connection with the platform's proxy and certificate settings.
0.0.1 #
EchoNova(apiKey:)for server-side Dart andEchoNova.proxy(baseUrl:, auth:)for Flutter apps, which call your own backend so the API key never ships in the app.- Text to Speech:
generate,voices.list, andjobs.create,get,list,listAll,delete,wait,download,downloadToandfindCandidates. - Speech to Text:
transcribe, andjobs.create,get,list,listAll,delete,wait,export,exportJsonandfindCandidates. - Sound Cleaning:
clean, andjobs.get,list,listAll,delete,downloadanddownloadTo. - Website widgets:
widgets.createTicket. - Agent sessions:
agents.sessions.start,getandend. The room token is kept out oftoString()and out of exceptions. - Uploads from bytes, streams and (except on the web) paths, with the audio type named from the file extension or the file's first bytes.
- Typed, immutable results that keep the API's JSON in
rawand the response'srequestId. Unknown statuses and channels are kept as they are. Pageresults withnextPage(), andlistAll()streams that skip jobs they already returned.- Retries that never resend a request that may already have run, a shared throttle per endpoint, rate-limit preflight, per-call
RequestOptionsand a totaldeadline. - Idempotency keys:
textToSpeech.generate,speechToText.transcribeandsoundCleaning.cleansend anIdempotency-Key(a new UUID per call, orRequestOptions(idempotencyKey:)), the same on every retry, so they are retried safely after a lost response or a 500, 502, 503 or 504. Their exceptions carryidempotencyKey. RequestInProgressException(409): the first request with the same key is still running. The SDK sends the request again with the key every 5 s (or after a longerRetry-After), and throws it only when the wait runs out, or at once for an upload it can't send again.retryDisabledReason(body_not_replayable), on status and connection exceptions, says why a request wasn't sent again.- A synchronous call the API answers with
202 Processingwaits for its job and returns the usual result.RequestOptions(waitTimeout:)bounds this wait and the in-progress one (default 20 minutes, never past the call'sdeadline). textToSpeech.generatereads for 240 s, so the API's202(at 220 s) can arrive.- Speech to Text
languageis optional (auto,aroren) ontranscribe,jobs.create,connectandtranscribeStream; left out, the API detects Arabic or English. …WithResponsemethods returningRawResponse(status, headers, request ID, rate limit).- Downloads of signed links without credentials; an expired link throws
DownloadExpiredException. - Webhook verification with
verifyWebhook. - Streaming Text to Speech (
textToSpeech.connect,speak): synthesize, enqueue,speakStreamfor LLM text, cancel and interrupt,Stream<Uint8List>audio, and the final cost of every synthesis.TtsSession.sampleRategives the rate ofspeakStreamaudio. streamKeepaliveonEchoNovaandEchoNova.proxy: the stream keepalive interval (default 30 s);nullturns keepalive off.- Streaming Speech to Text (
speechToText.connect,transcribeStream): framed audio with backpressure, segments, terminology,stop, saved sessions (SessionSaved,jobId), and rollover past the session limit. - Flutter web streaming through a proxy, authenticated with cookies or
EchoNova.proxy(streamQuery:). Theauthhook isn't called for streams there, since a browser can't send its headers. - Connection errors name the server they couldn't reach:
EchoNova, or your proxy's host. Audioand WAV helpers.