Calling an endpoint when using a FunASR model catalog
After creating an endpoint by using a FunASR model catalog, you can call the endpoint’s OpenAI-compatible API or FunASR native API through the model gateway.
Prerequisites
- You have obtained the API URL of the endpoint. For details, see Getting the API URL.
- You have created an API key that can call the endpoint. For details, see Creating an API key.
Precaution
- All calls access the endpoint through the model gateway. The address format is
http://<gateway>/workspace/<workspace>/endpoint/<endpoint>. - The request header must include
Authorization: Bearer <api_key>, where<api_key>is the API key. - When creating an endpoint by using a FunASR model catalog, the model registry and model name are still required, but they do not take effect for the FunASR image. You can select any valid values to pass validation. The selected values do not affect the deployment result.
- When deploying FunASR on Turing-architecture GPUs such as NVIDIA T4, set
dtype=float32in the engine variables. The corresponding startup parameter is--dtype float32. The defaulthalfprecision cannot be used on this GPU architecture.
Calling the OpenAI-compatible API
Section titled “Calling the OpenAI-compatible API”Run the following commands to initiate a speech recognition request through the OpenAI-compatible API:
curl -sL -o en.mp3 https://huggingface.co/FunAudioLLM/Fun-ASR-Nano-2512/blob/main/example/en.mp3curl -X POST <API_URL>/v1/audio/transcriptions \ -H "Authorization: Bearer <api_key>" \ -F file=@en.mp3Calling the FunASR native API
Section titled “Calling the FunASR native API”Run the following commands to initiate a speech recognition request through the FunASR native API:
curl -sL -o en.mp3 https://huggingface.co/FunAudioLLM/Fun-ASR-Nano-2512/blob/main/example/en.mp3curl -X POST <API_URL>/asr \ -H "Authorization: Bearer <api_key>" \ -F file=@en.mp3After the request succeeds, the API returns the speech recognition result with segments, timestamps, and real-time factor (RTF).