|
sherpa-onnx C API 1.0
Public C API and C++ wrapper for sherpa-onnx
|
sherpa-onnx supports many non-streaming ASR model families through the SherpaOnnxCreateOfflineRecognizer() API. Configure exactly one model family by filling in the corresponding sub-struct of SherpaOnnxOfflineModelConfig.
Zipformer transducer is a general-purpose offline ASR model using the encoder-decoder-joiner architecture.
Model package: sherpa-onnx-zipformer-small-en-2023-06-26
Example source: zipformer-c-api.c
Zipformer CTC uses CTC decoding instead of transducer decoding.
Model package: sherpa-onnx-zipformer-ctc-zh-int8-2025-07-03
Whisper is OpenAI's general-purpose speech recognition model. It supports language hints and translation.
Model package: sherpa-onnx-whisper-tiny
Example source: whisper-c-api.c
For automatic language detection with a multilingual ONNX Whisper model, set config.model_config.whisper.language = "" before creating the recognizer. To restrict that detection for one stream, set language_candidates before decoding:
Accept audio and decode the stream as usual. The existing result lang field contains the selected input language. Selection compares only the candidate language-token logits, reuses the encoder output, and produces one transcript; it does not run a separate recognition for each candidate.
The value is a comma-separated list of exact language codes supported by the loaded model. Surrounding whitespace is trimmed; one candidate is allowed. An empty value, empty item (including a trailing comma), duplicate code, or unknown code is invalid. Codes are case-sensitive, with no alias conversion. The first candidate wins an exact logit tie.
For the standard ONNX recognizer, an invalid list, a nonempty fixed language, or an English-only model causes a diagnostic log and an empty result before encoder execution. Any previous result on that stream is cleared. The process is not terminated, and detection does not fall back to unrestricted selection. There is no separate error status: an empty result alone does not distinguish an option error from other empty recognition results. QNN and Ascend Whisper recognizers warn and ignore this option, continuing normal recognition without restricting the language to the candidate list.
Omitting the option preserves the existing behavior. The option does not change the recognizer configuration, other streams, or the separate spoken-language identification API. An empty value does not remove the restriction; use a new stream without the option for unrestricted detection. Candidate restriction does not guarantee transcript accuracy or detect silence or out-of-list speech.
SenseVoice is a multilingual model supporting Chinese, English, Japanese, Korean, and Cantonese. It supports automatic language detection and inverse text normalization.
Model package: sherpa-onnx-sense-voice-zh-en-ja-ko-yue-2024-07-17-int8
Example source: sense-voice-c-api.c
Parakeet TDT is an NVIDIA NeMo transducer model. Set model_type to "nemo_transducer" so the runtime selects the correct decoder implementation.
Model package: sherpa-onnx-nemo-parakeet-tdt-0.6b-v3-int8
Example source: nemo-parakeet-c-api.c
GigaAM v2 is a NeMo transducer model for Russian speech recognition. Like Parakeet, set model_type to "nemo_transducer".
Model package: sherpa-onnx-nemo-transducer-giga-am-v2-russian-2025-04-19
Example source: nemo-giga-am-v2-c-api.c
NeMo CTC models use CTC decoding. They are simpler than NeMo transducer models (no joiner network).
Model package: sherpa-onnx-nemo-ctc-en-citrinet-512
Example source: nemo-ctc-c-api.c
Paraformer is a non-autoregressive ASR model from FunASR.
Model package: sherpa-onnx-paraformer-zh-small-2024-03-09
Example source: paraformer-c-api.c
Moonshine is a compact speech recognition model. It uses a preprocessor, encoder, and decoder (cached or uncached).
Model package: sherpa-onnx-moonshine-tiny-en-int8
Example source: moonshine-c-api.c
FireRedAsr is an encoder-decoder ASR model supporting Chinese and English.
Model package: sherpa-onnx-fire-red-asr-large-zh_en-2025-02-16
Example source: fire-red-asr-c-api.c
CTC variant of FireRedAsr.
Model package: sherpa-onnx-fire-red-asr2-ctc-zh_en-int8-2026-02-25
Example source: fire-red-asr-ctc-c-api.c
Dolphin is a multilingual CTC model.
Model package: sherpa-onnx-dolphin-base-ctc-multi-lang-int8-2025-04-02
Example source: dolphin-ctc-c-api.c
Canary is an NVIDIA NeMo model supporting English, Spanish, German, and French with source/target language selection and punctuation.
Model package: sherpa-onnx-nemo-canary-180m-flash-en-es-de-fr-int8
Example source: nemo-canary-c-api.c
Cohere Transcribe is a multilingual encoder-decoder model with built-in punctuation and inverse text normalization.
Model package: sherpa-onnx-cohere-transcribe-14-lang-int8-2026-04-01
Example source: cohere-transcribe-c-api.c
WeNet CTC models support Chinese, English, and Cantonese.
Model package: sherpa-onnx-wenetspeech-yue-u2pp-conformer-ctc-zh-en-cantonese-int8-2025-09-10
Example source: wenet-ctc-c-api.c
Omnilingual is a CTC model supporting 1600 languages.
Model package: sherpa-onnx-omnilingual-asr-1600-languages-300M-ctc-int8-2025-11-12
Example source: omnilingual-asr-ctc-c-api.c
FunASR Nano is an LLM-based ASR model from FunASR.
Model package: sherpa-onnx-funasr-nano-int8-2025-12-30
Before decoding, use SherpaOnnxOfflineStreamSetOption() to override hotwords, language, itn, or user_prompt for a single stream without reloading the model. Unset options use the recognizer configuration. Explicit empty hotwords, language, and user_prompt strings clear the corresponding defaults. For itn, "0" disables and any nonzero integer enables ITN (normally use "1"); empty, unparsable, or out-of-range values fall back to the configured value. These options do not change other streams.
For a custom context prompt, clear any configured hotwords and language and enable ITN so that the nonempty user_prompt is used verbatim:
Otherwise the prompt is built from hotwords, language, and ITN as before. An empty user_prompt selects the standard transcription prompt.
Example source: funasr-nano-c-api.c
Qwen3-ASR is an LLM-based ASR model from Alibaba.
Model package: sherpa-onnx-qwen3-asr-0.6B-int8-2026-03-25
Example source: qwen3-asr-c-api.c
MedASR is a medical-domain CTC model.
Model package: sherpa-onnx-medasr-ctc-en-int8-2025-12-25
Example source: medasr-ctc-c-api.c
TeleSpeech is a Chinese CTC model. Note the simple string assignment for the model path.
Model package: sherpa-onnx-telespeech-ctc-int8-zh-2024-06-04
Example source: telespeech-c-api.c