Getting Started with the OpenAI API
The OpenAI API provides programmatic access to GPT-4o, GPT-4o mini, DALL-E 3, Whisper (speech-to-text), and TTS (text-to-speech). You pay per token — roughly $0.15 per million input tokens for GPT-4o mini and $5 per million for GPT-4o. For most projects, GPT-4o mini provides 90 percent of the capability at 3 percent of the cost.
Create an account at platform.openai.com, navigate to API keys, and generate a new secret key. Store it as OPENAI_API_KEY in your environment variables — never hardcode it in your source code or commit it to Git. Install the SDK with npm install openai for JavaScript or pip install openai for Python.


