OpenAI Launches ChatGPT and Whisper APIs: Features, Pricing, and Sample Code
The article introduces OpenAI's newly released ChatGPT and Whisper APIs, explains their reduced costs, outlines usage details and model versions, and provides Python code examples for integrating these powerful conversational and speech‑to‑text models into third‑party applications.
OpenAI announced that developers can now integrate the ChatGPT conversational model and the Whisper speech‑to‑text model into their own applications via public APIs, offering a much cheaper alternative to using the standard language models.
Since its debut in November 2022, ChatGPT has become a major AI phenomenon, reaching over 100 million monthly active users within two months and sparking widespread interest in AI‑driven chat interfaces.
The new ChatGPT API uses the gpt‑3.5‑turbo model, priced at $0.002 per 1,000 tokens—a 90 % cost reduction compared to previous GPT‑3.5 offerings—and is suitable for many non‑chat use cases, with support for the Chat Markup Language (ChatML) message format.
OpenAI also released a Whisper API for the large‑v2 model, priced at $0.006 per minute of audio, supporting various audio formats (m4a, mp3, mp4, wav, etc.) and offering both transcription and translation endpoints.
Sample Python code for the ChatGPT API:
<code>import openai
completion = openai.ChatCompletion.create(
model="gpt-3.5-turbo",
messages=[{"role": "user", "content": "Tell the world about the ChatGPT API in the style of a pirate."}]
)
print(completion)</code>Sample Python code for the Whisper API:
<code>import openai
audio_file = open("/path/to/file/openai.mp3", "rb")
transcription = openai.Audio.transcribe("whisper-1", audio_file)
print(transcription)</code>OpenAI plans continuous improvements to the ChatGPT model, with version updates such as gpt‑3.5‑turbo‑0301 guaranteed support until at least June 1, and a stable version update scheduled for April.
These APIs enable third‑party developers to build next‑generation applications powered by advanced conversational and speech‑to‑text capabilities.
Python Programming Learning Circle
A global community of Chinese Python developers offering technical articles, columns, original video tutorials, and problem sets. Topics include web full‑stack development, web scraping, data analysis, natural language processing, image processing, machine learning, automated testing, DevOps automation, and big data.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.