Where the SDK call lives
In Next.js App Router, the SDK call belongs in a Server Component, a Server Action, or a Route Handler — never a Client Component. The API key never reaches the browser. cwk-site treats app/api/*/route.ts as the canonical home for SDK calls.
Edge vs Node runtime
Edge runtime is faster cold-starts and runs on Vercel's edge network. It restricts to web-standard APIs (fetch, ReadableStream, no Node fs). The SDK works on Edge for streaming and non-streaming Messages calls. Some helpers (file uploads via Files API) require Node runtime. Pick Edge by default; fall back to Node when an SDK feature requires it.
Caching at the right layer
Combine three layers: Next.js fetch cache for static prompts, prompt caching at the Anthropic API for long stable prefixes, and your own response cache for repeated identical user inputs. Each layer handles a different failure mode; do not collapse them into one.