OpenAI starter module
Setup
Maps API keys, approved models, spending limits, and app integration points.
- Files
- 17
- Lines
- 627
- Languages
- Config + Markdown + TypeScript + JSON
Included files
This page lists paths and purposes, not source contents.
.env.example
Configuration required by this starter pack.
Config
25 lines
ADAPT.md
Give these instructions to the coding agent working in the buyer's Next.js project.
Markdown
118 lines
app/api/openai/ask/route.ts
POST /api/openai/ask returns one guarded OpenAI answer.
TypeScript
5 lines
app/api/openai/background/route.ts
POST /api/openai/background starts a guarded background response.
TypeScript
5 lines
app/api/openai/stream/route.ts
POST /api/openai/stream returns one guarded OpenAI text stream.
TypeScript
5 lines
app/api/openai/tools/route.ts
POST /api/openai/tools executes one guarded OpenAI tool loop.
TypeScript
5 lines
app/api/openai/verify/route.ts
GET /api/openai/verify reports missing settings and confirms OpenAI model access.
TypeScript
5 lines
app/api/openai/webhook/route.ts
POST /api/openai/webhook receives signed background response events from OpenAI.
TypeScript
5 lines
app/chat/route.ts
A clickable chat page for trying the guarded OpenAI ask and streaming routes.
TypeScript
127 lines
app/usage/route.ts
GET /usage is a working usage page for the signed-in account.
TypeScript
5 lines
OPERATIONS.md
The code handles the machines.
Markdown
29 lines
package.json
Configuration required by this starter pack.
JSON
17 lines
README.md
This starter gives a Next.js App Router application a guarded server-side OpenAI integration: model requests with spending checks, streaming, tool calling, structured outputs, usage metering, signed background-response webhooks, and a readable verification route.
Markdown
87 lines
src/setup/check-setup.ts
Checks OpenAI access, approved models, and optional modules without creating anything.
TypeScript
96 lines
starter.json
Configuration required by this starter pack.
JSON
6 lines
TROUBLESHOOTING.md
Find your symptom, apply the fix.
Markdown
72 lines
tsconfig.json
Configuration required by this starter pack.
JSON
15 lines
Questions about setup
Is this an OpenAI Next.js starter?
Yes. The pack is built for Next.js apps that need trusted server calls, streamed answers, tool calling, structured outputs, retries, spending limits, and usage records.