Check my levelCoursesProgramsFor teamsPricing
UKSign inSign up
Check my levelCoursesProgramsFor teamsPricingClaude quizPromptsBlogFAQSearchSign upUK
AcademlCoursesOpenAI API from A to ZSDK install and first call
Retries after a 429 error: each pause is twice as long, then successA workflow map: a Telegram message branches into command, voice and text and reaches the agentA form request lands in a spreadsheet row labelled “Complaint”
Course

OpenAI API from A to Z

Module 1 · API Basics
01SDK install and first call02Choosing an OpenAI model03Tokens, context, and cost
Module 2 · Chat Completions
04Developer messages, reasoning effort and sampling parameters05Structured Outputs and JSON Schema06Multimodality: vision, speech-to-text and voice
Module 3 · Assistants API v2
07From Assistants to Responses: conversation memory08File Search and vector store09Code Interpreter10Combining tools and tool_choice
Module 4 · Function Calling
11Function calling: the full cycle12Parallel function calls13Patterns: designing reliable functions
Module 5 · Production
14Streaming responses15Embeddings and semantic search16Production: limits, retries, monitoring
OpenAI API from A to Z · Lesson 1

SDK install and first call

Install the openai SDK, create a client and make your first call with the Responses API on gpt-6-luna, then the same request with Chat Completions. Parse the response, status and finish_reason, usage, length limits and reasoning effort.

25 min readUpdated Nov 9, 20263 questions in quizReady prompt included

Install

npm install openai
# or for Python
pip install openai

Create a key at platform.openai.com/api-keys and put it in the OPENAI_API_KEY environment variable. Never hardcode the key in your repo.

The rest of this lesson opens after a free sign-up

Sign up with email or Google: the first two lessons of every course stay open for good, and the whole catalog is open for 7 days. No card needed.

Sign up freeOr a trial lesson, no sign-up →
In this lesson
InstallWhich API to useFirst call with the Responses API (TypeScript)What's in a Responses responseSame call with Chat CompletionsSame in PythonLimiting response length and reasoningPracticeReady promptQuiz
CoursesLLM coursesFor teamsPricingFAQBlogAboutPrivacy
© 2026 AcademlDevelopment & promotion —MMIX — Marketing Mix
Get started free