Python uses speech to text

Request Sandbox
1from openai import OpenAI
2
3client = OpenAI(
4 base_url="https://api.AiApiGiaRe.io/v1",
5 api_key=key
6)
7
8# Basic transcription
9audio_file = open("/path/to/file/audio.mp3", "rb")
10transcription = client.audio.transcriptions.create(
11 model="whisper-1",
12 file=audio_file
13)
14print(transcription.text)
15
16# Specify output format
17transcription = client.audio.transcriptions.create(
18 model="whisper-1",
19 file=audio_file,
20 response_format="text"
21)
Target: api.aiapigiare.io.vn
TLS 1.3 Active

Speech-to-Text API Guide

Request Sandbox
1from openai import OpenAI
2
3client = OpenAI(
4 base_url="https://api.AiApiGiaRe.io/v1",
5 api_key=key
6)
7
8# Basic transcription
9audio_file = open("/path/to/file/audio.mp3", "rb")
10transcription = client.audio.transcriptions.create(
11 model="whisper-1",
12 file=audio_file
13)
14print(transcription.text)
15
16# Specify output format
17transcription = client.audio.transcriptions.create(
18 model="whisper-1",
19 file=audio_file,
20 response_format="text"
21)
Target: api.aiapigiare.io.vn
TLS 1.3 Active

Overview

The Audio API provides two main endpoints:

  • 📝 transcriptions: Convert audio to text in the original language.
  • 🔄 translations: Translate audio into English text.

Supported Formats

  • 📁 File Size: Up to 25 MB
  • 🎵 Supported Formats: mp3, mp4, mpeg, mpg, m4a, wav, webm

Usage Instructions

1. Transcription

Convert audio into text in its original language.

(Code extracted to sandbox)


2. Translation

Convert audio in any language into English text.

(Code extracted to sandbox)


3. Timestamp Functionality

(Code extracted to sandbox)


4. Handling Large Files

Use PyDub to split files larger than 25 MB:

(Code extracted to sandbox)


Optimization Tips

Prompt Usage Techniques

  1. 🔍 Correct specific word recognition.
  2. 📜 Maintain contextual continuity.
  3. ✍️ Control punctuation output.
  4. 🗣️ Retain filler words.
  5. 📝 Control text output style (e.g., simplified or traditional Chinese).

Supported Languages

The API supports 98 languages, including:

  • Major Asian Languages: Chinese, Japanese, Korean, etc.
  • European Languages: English, French, German, etc.
  • Other Regional Languages: Arabic, Hindi, etc.

Note: Only languages with a Word Error Rate (WER) below 50% are listed. Other languages are supported but may have lower quality.

Infrastructure: AiApiGiaRe-v10.0
Gateway Status: Operational