Bỏ qua để đến nội dung
Helix Voice Tài liệu
Trang webMở bảng điều khiển

Tham khảo API

Lỗi và giới hạn yêu cầu

Handle HTTP errors, key permissions, and layered request budgets.

The developer API uses HTTP status codes. Successful JSON requests return data; deletions return 204 without a body. Audio downloads return WAV bytes.

This JavaScript example runs on your server, with the key stored in the server environment:

const response = await fetch("https://api.helixvoice.net/v1/voices", {
redirect: "error",
headers: { Authorization: `Bearer ${process.env.HELIXVOICE_API_KEY}` },
});
if (!response.ok) throw new Error(`Voice API failed: ${response.status}`);
const { data: voices } = await response.json();

A backend error has this shape:

{
"error": {
"code": "invalid_api_key",
"message": "A valid, unexpired API key is required.",
"requestId": "request-id"
}
}

Gateway errors may use HTML or another format. Check status and Content-Type before parsing JSON or saving WAV bytes. Anonymous preview errors use a separate response format.

Status Code Action
400 / 413 / 415 invalid_request Correct the JSON, fields, language, file size, or Content-Type
401 invalid_api_key Supply a valid, unexpired, unrevoked production key
403 insufficient_scope Obtain a key with the required scope
404 not_found Check the endpoint, ownership, retention, or deletion
405 method_not_allowed Use the documented HTTP method
429 rate_limit_exceeded Honor Retry-After and check all applicable budgets
502 / 503 / 504 service_unavailable Handle temporary unavailability and avoid duplicate work
500 internal_error Keep the request ID and contact your service administrator

Each key has a fixed UTC minute request limit and a fixed UTC day request limit. Every authorized request reaching an endpoint counts, including lists, downloads, cached generation requests, and requests that subsequently fail input validation or upstream processing. Missing/invalid keys, insufficient permissions, and requests rejected by the key limit do not consume another key budget. A minute or daily key limit returns 429 and Retry-After.

Key limits are additional to the existing account speech-operation and shared service limits. Creating multiple keys cannot bypass account or global budgets. Account daily reset follows the service’s configured timezone, which can differ from the key’s UTC reset.

Generation, transcription, and voice creation share the account operation budget; failed upstream attempts also count. Listing, downloading, and deleting do not consume that operation budget, but still count as key requests. Cached generation requests count toward request rates. Shared concurrency can produce 429 while other budgets remain.

Anonymous previews have a separate shared quota.

Wait for Retry-After when present. Use bounded backoff for temporary failures. Do not automatically retry 400, 401, or 403. Generation and voice creation do not provide an idempotency-key contract; retries can repeat work and consume quota.

Keep X-Request-ID, or error.requestId for backend errors, along with the timestamp, endpoint, and status. Do not share API keys or private recordings in diagnostic messages.