Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions apps/web/.env.example
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
# AI Gateway API Key (required for /api/generate endpoint)
# Uses Vercel AI Gateway - automatically authenticated when deployed on Vercel
# Vercel AI Gateway
# Automatically authenticated when deployed on Vercel
# For local development, get your key from https://vercel.com/ai-gateway
AI_GATEWAY_API_KEY=

# AI Model Configuration
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ai

# Override the default model used for UI generation
# Default: anthropic/claude-haiku-4.5
AI_GATEWAY_MODEL=anthropic/claude-haiku-4.5
3 changes: 2 additions & 1 deletion apps/web/app/api/generate/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,15 @@ EXAMPLE (Blog with responsive grid):
Generate JSONL:`;

const MAX_PROMPT_LENGTH = 140;
const DEFAULT_MODEL = "anthropic/claude-haiku-4.5";

export async function POST(req: Request) {
const { prompt } = await req.json();

const sanitizedPrompt = String(prompt || "").slice(0, MAX_PROMPT_LENGTH);

const result = streamText({
model: "anthropic/claude-opus-4.5",
model: process.env.AI_GATEWAY_MODEL || DEFAULT_MODEL,
system: SYSTEM_PROMPT,
prompt: sanitizedPrompt,
temperature: 0.7,
Expand Down
2 changes: 1 addition & 1 deletion apps/web/app/docs/ai-sdk/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export async function POST(req: Request) {
: '';

const result = streamText({
model: 'anthropic/claude-opus-4.5',
model: 'anthropic/claude-haiku-4.5',
system: systemPrompt + contextPrompt,
prompt,
});
Expand Down
2 changes: 1 addition & 1 deletion apps/web/app/docs/quick-start/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ export async function POST(req: Request) {
const systemPrompt = generateCatalogPrompt(catalog);

const result = streamText({
model: 'anthropic/claude-opus-4.5',
model: 'anthropic/claude-haiku-4.5',
system: systemPrompt,
prompt,
});
Expand Down
2 changes: 1 addition & 1 deletion apps/web/app/docs/streaming/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ function App() {
const { prompt } = await req.json();

const result = streamText({
model: 'anthropic/claude-opus-4.5',
model: 'anthropic/claude-haiku-4.5',
system: generateCatalogPrompt(catalog),
prompt,
});
Expand Down
9 changes: 7 additions & 2 deletions examples/dashboard/.env.example
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
# AI Gateway API Key (required for /api/generate endpoint)
# Uses Vercel AI Gateway - automatically authenticated when deployed on Vercel
# Vercel AI Gateway
# Automatically authenticated when deployed on Vercel
# For local development, get your key from https://vercel.com/ai-gateway
AI_GATEWAY_API_KEY=

# AI Model Configuration
# Override the default model used for dashboard generation
# Default: anthropic/claude-haiku-4.5
AI_GATEWAY_MODEL=anthropic/claude-haiku-4.5
4 changes: 3 additions & 1 deletion examples/dashboard/app/api/generate/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ EXAMPLE - Revenue Dashboard:

Generate JSONL patches now:`;

const DEFAULT_MODEL = "anthropic/claude-haiku-4.5";

export async function POST(req: Request) {
const { prompt, context } = await req.json();

Expand All @@ -69,7 +71,7 @@ export async function POST(req: Request) {
}

const result = streamText({
model: "anthropic/claude-opus-4.5",
model: process.env.AI_GATEWAY_MODEL || DEFAULT_MODEL,
system: SYSTEM_PROMPT,
prompt: fullPrompt,
temperature: 0.7,
Expand Down
1 change: 1 addition & 0 deletions turbo.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"$schema": "https://turborepo.dev/schema.json",
"ui": "tui",
"globalEnv": ["AI_GATEWAY_MODEL"],
"tasks": {
"build": {
"dependsOn": ["^build"],
Expand Down