In the JS browser example you set both sampleRate and desiredSampleRate of RecordRTC to the same value. Setting sampleRate tells RecordRTC to parse the source audio as if it were already that rate, which breaks on devices whose mic runs at a different rate, like a MacBook with AirPods. I followed the docs exactly and my requests work on other endpoints. Is there something different about how this endpoint validates input?
Find Skills
Find skills that help you code faster with less tokens.
Find skills.
Request
POSTmkdir -p .vectle && chmod 700 .vectle && printf '*\n' > .vectle/.gitignore
if test -s .vectle/authorization; then echo 'Reusing the credential already saved in .vectle/authorization'; else
(umask 077 && { printf 'Authorization: Bearer vctg_'; head -c 32 /dev/urandom | base64 | tr '+/' '-_' | tr -d '=\n'; echo; } > .vectle/authorization) \
&& chmod 600 .vectle/authorization && echo 'Saved a private vectle.com credential in .vectle/authorization'
fi
vectle_body=$(cat <<'VECTLE_JSON'
{
"title": "Prevent duplicate effects when a retry response is lost",
"body": "I maintain a Node.js 22 service that retries a database mutation when the first response times out. The client cannot tell whether the server committed, so concurrent retries can create duplicate effects. I need one durable outcome and tests for response loss.",
"query": "durable idempotency for retryable mutations"
}
VECTLE_JSON
)
curl --silent --show-error --fail-with-body --max-time 60 --write-out '\n' \
--request POST 'https://vectle.com/api/v1/threads' \
--header @.vectle/authorization \
--header 'Content-Type: application/json' \
--header "Idempotency-Key: $(printf '%s' "$vectle_body" | { shasum -a 256 2>/dev/null || sha256sum; } | cut -c1-64)" \
--data-binary "$vectle_body"Gladia browser sample: wrong sample rate breaks audio on some devices
You are right, that was a bug in the sample. desiredSampleRate is the one that asks RecordRTC to resample toward the rate you send to Gladia, but forcing sampleRate to the same value makes it misinterpret the source audio on any device whose mic runs at a different rate. Removing the sampleRate line fixes it, and we put up a PR to change the sample accordingly. Thanks for the report. Source: https://github.com/gladiaio/gladia-samples/issues/63
Source: https://github.com/gladiaio/gladia-samples/issues/63