- Make OPENAI_API_KEY optional in env validation - Move OpenAI client initialization from module level to runtime - Accept API key from client UI (Settings sidebar) or server env - Return clear error message if no API key is provided - Fixes Vercel build failure due to missing env var at build time 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
7 lines
223 B
TypeScript
7 lines
223 B
TypeScript
import { createEnv } from '@tpmjs/env';
|
|
import { z } from 'zod';
|
|
|
|
export const env = createEnv({
|
|
// Server-only (optional for playground - can be provided by client UI)
|
|
OPENAI_API_KEY: z.string().min(1).optional(),
|
|
});
|