LLM API Integration
Call hosted and locally served LLMs from application code, with text, image and audio inputs, streaming, timeouts and retries, behind a provider-neutral interface that tests can replace with a mock.
5 objectives 6 steps about 130 min
Learn it step by step
Read the lessons in order, try the practice checks, then prove the skill with the knowledge check.
This skill page is a public outline. Its lessons and knowledge check appear here as subject-matter experts approve them.
Learning objectives
- Send multi-turn requests with system instructions and generation parameters (temperature, top-p, maximum output tokens, stop sequences), and read content, stop reason and token usage from the response.
- Handle rate limits, timeouts and transient errors with bounded retries and exponential backoff with jitter.
- Stream a response to a client and cancel an in-flight request cleanly.
- Wrap hosted providers and a locally served open-weight model (through an OpenAI-compatible endpoint) behind one interface, with a mock implementation so tests run without network access or API keys.
- Send image and PDF inputs to a multimodal model and transcribe audio with a speech-to-text model, accounting for their token cost and size limits.
Lesson plan
6 steps, about 130 min · 5 of 5 lessons available so far
- Anatomy of a Request: Messages, Parameters and Media Concept · 15 min
- First Calls: Parameters, Usage, Images and Audio Worked example · 25 min
- Lab: Retries, Backoff and Timeouts Lab · 25 min
- Streaming and Cancellation Worked example · 20 min
- Lab: One Client for Hosted, Local and Mock Models Lab · 30 min
- Check: Diagnose Failing API Calls Knowledge check · 10 questions
Practise it
Build a client module that calls one hosted model and one locally served open-weight model through the same interface, streams output to the terminal, retries 429 and 5xx responses up to three times with jittered backoff, enforces a 30-second timeout, logs token usage per call, accepts an image or PDF attachment and transcribes a short audio clip, and passes a test suite that runs against a mock provider.
Build it from scratch
Practice builds that exercise this skill by re-creating a real technology.
- Build your own AI Chat BotIntermediate · 6–12 h
References
Hard prerequisites
Unlocks
On these roadmaps
Progress and evidence for this skill are shared across all of them.