0 · Bootstrap a Next.js project (skip if you already have one)
package.json
— scripts (dev
,build
,start
) and dependencies.tsconfig.json
— already set for Edge Runtime; no changes needed.app/
— where your pages and API routes live.
.env.local
file for local runs (kept out of Git automatically):
1 · Prerequisites
- Node 18+
- Next.js 14+ with the App Router (from step 0)
- Two environment variables:
Name | Purpose |
---|---|
TAKO_API_KEY | Your key from https://trytako.com. |
OPENAI_API_KEY | Model provider key (swap to ANTHROPIC_API_KEY , GROQ_API_KEY , etc. as needed). |
2 · Install packages
WhyOPENAI_API_KEY
? The AI SDK auto‑detects provider‑specific variables (OPENAI_API_KEY
,ANTHROPIC_API_KEY
, etc.), so you don’t need to reference the key in code.
3 · Hello‑World Edge Route
Createapp/api/chat/route.ts
:
vercel --prod
when you’re ready.