Skip to content
WebDev Path
Back

Week 21: Calling AI APIs safely

Next video

WebDev Path video lesson

About this lesson

Module:
AI features, deployment and jobs
Time:
about 10 hours
Video:
2 min

Add AI to an app without leaking keys or spending too much.

By the end of this week you can

  • Call an AI API from the server only
  • Get structured JSON back with a schema
  • Limit cost per request

Learn

  • How AI APIs work: prompts, tokens, models
  • Keeping API keys on the server
  • Structured output with Zod
  • Cost and rate limits

Read or watch

Practice

  1. Summarize text and return JSON
  2. Set a spending limit in your provider account

Build

Add an AI summary feature to Project 5.

Check your understanding

Score 4 out of 5 to complete this week.

  1. 1. Where should you call an AI API from?
  2. 2. What is a token, for AI pricing?
  3. 3. What is a system prompt (or instructions) for?
  4. 4. How do you protect an AI endpoint from abuse?
  5. 5. What should the app do when the AI call fails?
0 of 5 answered