Skip to content

Commit 5097a0f

Browse files
hubyrodclaude
andcommitted
Use ANTHROPIC_API_KEY directly instead of shared scoring client
The shared getAnthropicClient() triggers validation of all Scout env vars (Reddit, DB) which aren't set in production for this feature. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 678c209 commit 5097a0f

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

app/api/summary/route.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { auth } from "@clerk/nextjs/server";
22
import { NextResponse } from "next/server";
3+
import Anthropic from "@anthropic-ai/sdk";
34
import { getGroups, getAuthToken } from "@/src/db";
4-
import { getAnthropicClient } from "@/src/lib/scoring/client";
55

66
const FETCH_POSTS_QUERY = `
77
query FetchGroupPosts($groupId: ID!, $first: Int!) {
@@ -221,7 +221,11 @@ export async function POST(request: Request) {
221221
const formatted = formatPosts(weekPosts);
222222

223223
try {
224-
const anthropic = getAnthropicClient();
224+
const apiKey = process.env.ANTHROPIC_API_KEY;
225+
if (!apiKey) {
226+
return NextResponse.json({ error: "ANTHROPIC_API_KEY not configured" }, { status: 500 });
227+
}
228+
const anthropic = new Anthropic({ apiKey });
225229
const aiResponse = await anthropic.messages.create({
226230
model: "claude-sonnet-4-5-20250514",
227231
max_tokens: 2048,

0 commit comments

Comments
 (0)