Question · Vibe coding with Claude Code course · Module 10: TikTok clone

Key for the image API

Why does Claude call the image API from a Route Handler and not from a component with "use client"?

Answer options

  • Because client components cannot send fetch requests
  • Because a key from process.env without NEXT_PUBLIC_ exists only on the server, and the openai package is blocked in the browser by default
  • Because a Route Handler generates the image faster than the browser
  • Because the b64_json field can be read only in Node.js

You can check the correct answer by solving this task in the CodeWorlds game.