Try this endpoint →

Service endpoints

Service URL: https://api.fourhz.ai

Method / ProtocolPathContent-Type / FramesAuth
POST/v1/asr/syncmultipart/form-dataAuthorization: <API Key>

Authentication

Use the raw API key without Bearer. Put it in the HTTP Authorization header; keep long-lived keys on the server.

Authorization: $FOURHZ_API_KEY

Request parameters

FieldTypeDescription
audiofileRequired audio file, 80 ms–30 s, up to 40 MB.
configJSON objectOptional multipart config JSON containing the fields below; model defaults to fourhz-spectrum.
modelstringfourhz-spectrum
sample_rate / channelsintegerRequired for raw PCM only; channels must be 1.
language_codesstring[]Optional ["zh"] or ["en"]; omit for auto-detection.
keyterms_promptstring[]Up to 100 direct keyterms, 64 characters each. word_boost is an alias; send only one.
cleanup_levelstringoff (default), light or standard. Standard removes clear filler words and adjacent repetitions.
translate_modebooleanDefaults to false. When combined with cleanup, translates the cleaned source.
target_languagestringRequired when translate_mode=true; e.g. en or zh.
text_emotionbooleanDefaults to false, independently of cleanup and translation. Returns emotion results and status.
hotword_pool_idstringReference a complete enabled pool of up to 1,000 words; the 100-term direct realtime/sync limit does not apply. Create and manage pools →
reject_background_speechbooleanBackground-speech rejection. Optional; defaults to true (enabled). Set to false to disable. multipart/form-data field; also accepted inside the config JSON.

Response fields

FieldTypeMeaning and availability
textstringFull transcript; target mode contains the target speaker’s output.
audio_duration_msnumberSYNC processed audio duration in milliseconds.
session_idstringSYNC task/correlation ID.
request_time_msnumberSYNC server processing time in milliseconds.
error_codestringStable error code on failure.
messagestringHuman-readable error message.

Independent enhancement results

Cleanup, translation and emotion may be enabled independently or together. Realtime fields arrive in FourHzPostprocessing events; Turn retains the raw transcript. Sync/pre-recorded text prefers translation, then cleanup or keyterm correction, while preserving the independent result fields.

FieldTypeDescription
cleaned_textstringCleaned or keyterm-corrected source-language text.
translated_textstringTarget-language translation, using the cleaned source when combined.
cleanup_status / translation_statusstringcompleted indicates success; degraded_raw_only/degraded_partial indicates fallback or incomplete processing.
emotion_statusstringcompleted or degraded. Failure is not silently reported as success.
emotionsobject[]Sync/pre-recorded emotion results with mode, label and text; realtime uses emotion.bucket events.

Request examples

Code samples

curl -X POST 'https://api.fourhz.ai/v1/asr/sync' \
  -H "Authorization: $FOURHZ_API_KEY" \
  -F 'audio=@sample.wav' \
  -F 'model=fourhz-spectrum'

Sending and receiving

Response and results

{
  "text": "Hello world.",
  "audio_duration_ms": 4200,
  "session_id": "task-example",
  "request_time_ms": 1834.6
}

Error codes

Every HTTP error body contains error_code (machine-readable) and message (human-readable). Legacy fields such as detail, code/msg or an upstream error object are kept and status codes are unchanged. Clients should read error_code and message first.

HTTP values are status codes. Except for detail responses such as 401/402, the body uses {"error_code":"…","message":"…"}. These codes apply to the synchronous API.

HTTPResponse codeMeaning
HTTP 400bad_audio / audio_too_short / invalid_candidatesAudio cannot be decoded, is too short, or the candidate voiceprint set is invalid.
HTTP 401detailMissing or invalid API key.
HTTP 402detailInsufficient balance.
HTTP 413audio_too_largeDecoded audio exceeds the duration limit.
HTTP 415unsupported_media_typeUnsupported container format, or the file content is not audio (for example a text file renamed to .mp3).
HTTP 422unsupported_capability / enrollment_*The selected model/capability is unavailable, or enrollment constraints are not met.
HTTP 429capacity_exceededCapacity is currently exhausted; follow Retry-After.
HTTP 500/504inference_error / inference_timeoutUpstream inference failed or exceeded the wait budget.
HTTP 503service_unavailableThe selected backend is unavailable.