Skip to content
Draft
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
7 changes: 7 additions & 0 deletions app/api/app-idea-chat/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,13 @@ export async function POST(request: NextRequest) {
return NextResponse.json({ error: 'Message is required' }, { status: 400 })
}

if (!process.env.ANTHROPIC_API_KEY) {
return NextResponse.json(
{ error: 'App Idea Chat is not configured. Missing ANTHROPIC_API_KEY.' },
{ status: 503 },
)
}

const creditResult = await deductCredits(
user.id,
CREDITS.PATTERN_ANALYZER_COST,
Expand Down
7 changes: 7 additions & 0 deletions app/api/pattern-analyzer/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,13 @@ export async function POST(request: NextRequest) {
return NextResponse.json({ error: 'analysisId is required' }, { status: 400 })
}

if (!process.env.ANTHROPIC_API_KEY) {
return NextResponse.json(
{ error: 'Pattern Analyzer is not configured. Missing ANTHROPIC_API_KEY.' },
{ status: 503 },
)
}

const creditResult = await deductCredits(user.id, CREDITS.PATTERN_ANALYZER_COST, 'pattern_analyzer', { analysisId })
if (!creditResult.success) {
return NextResponse.json({ error: creditResult.error || 'Insufficient credits' }, { status: 402 })
Expand Down
Loading