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 AI 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 AI 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. - Endpoints for the FunASR model catalog do not require a platform model to be configured. During creation, the model fields are handled by the model catalog and engine configuration. You do not need to enter arbitrary model repository or model name values to pass validation. If the creation form does not display model fields, create the instance directly according to the configuration provided by the model catalog.
- 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).