Calling LLM APIs
Every GenAI app is built on top of a handful of API calls, so this is the foundational skill.
Learn it
Follow the official OpenAI quickstart to create a key, install the SDK, and run your first text-generation call from Python. Then read the text-generation guide to learn how system/user messages and generation parameters shape the output. Store your key in an environment variable, never in code.
By the end you’ll be able to
- Make an authenticated API call from Python and parse the response
- Control output with temperature, max tokens, and system messages
Free resources
Practice
Write a Python script that takes a topic from the command line and returns a 3-bullet summary, exposing temperature as a tunable argument.
Build it — your output
A reusable Python function that wraps an LLM call with configurable system prompt and parameters.
Prove it — check yourself
You’re ready to move on when you can honestly say yes to each:
- Can you make an API call and read the model's text from the response?
- Can you explain what temperature and max tokens do?
- Are your API keys kept out of source control?
Do it with AI
Use a free AI tool as your tutor and pair-programmer. Copy a prompt below into Claude, ChatGPT, or Gemini (for building, try Cursor or Copilot).
The habit: Try it yourself first — a little struggle is where the learning actually happens. Then ask for a hint before the answer — never copy blindly.
- Understand itClaude / ChatGPT / Gemini
I'm a beginner learning "Calling LLM APIs". Explain it in simple terms with a real-world analogy, then ask me ONE question to check my understanding — don't reveal the answer.
- PracticeClaude / ChatGPT / Gemini
Give me 3 short practice problems on "Calling LLM APIs" (my goal: make an authenticated api call from python and parse the response), from easy to hard. Don't include the solutions yet — I'll try them first, then ask you to check.
- Get unstuckClaude / ChatGPT / Gemini
I'm stuck on this exercise about "Calling LLM APIs": [paste your attempt here]. Give me ONE small hint to move forward — do NOT give me the full solution.
- Build & reviewCursor / Copilot
Here is my work for a "Calling LLM APIs" task: [paste your code or answer]. Review it: point out what's wrong and WHY, and suggest improvements — but let me make the fixes myself.
- Prove itClaude / ChatGPT / Gemini
Quiz me on "Calling LLM APIs". Ask me 5 questions one at a time, wait for my answer each time, then tell me if I'm right and briefly why.