OpenAI API로 만드는 멀티모달 시스템
James Chapman
Curriculum Manager, DataCamp
$$

from openai import OpenAI# Create the OpenAI client client = OpenAI(api_key="<OPENAI_API_TOKEN>")# Create a request to the Chat Completions endpoint response = client.chat.completions.create(model="gpt-4o-mini", messages=[{"role": "user", "content": "What is the OpenAI API?"}])
# Extract the content from the response
print(response.choices[0].message.content)
The OpenAI API is a cloud-based service provided by OpenAI that allows developers
to integrate advanced AI models into their applications.
$$
음성 → 텍스트 기능:
mp3, mp4, mpeg, mpga, m4a, wav, webm 지원 (25 MB 제한)
활용 사례:

예시: meeting_recording.mp3 전사
audio_file = open("meeting_recording.mp3", "rb")
$$
파일이 다른 디렉터리에 있을 때
audio_file = open("path/to/file/meeting_recording.mp3", "rb")
audio_file= open("meeting_recording.mp3", "rb")response = client.audio.transcriptions.create(model="whisper-1",file=audio_file)print(response)
Transcription(text="Welcome everyone to the June product monthly. We'll get started in...)
print(response.text)
Welcome everyone to the June product monthly. We'll get started in just a minute.
Alright, let's get started. Today's agenda will start with a spotlight from Chris
on the new mobile user onboarding flow, then we'll review how we're tracking on
our quarterly targets, and finally, we'll finish with another spotlight from Katie
who will discuss the upcoming branding updates...

전사 워크플로:
open()으로 오디오 열기audio_file = open("non_english_audio.m4a", "rb")response = client.audio.translations.create(model="whisper-1",file=audio_file)print(response.text)
The search volume for keywords like A I has increased rapidly since the launch of
Cha GTP.
![]()
OpenAI API로 만드는 멀티모달 시스템