Skip to content

Commit 9463fde

Browse files
jahoomaclaude
andcommitted
Bypass paid+aged-account gate for team@codebuff.com
So SDK integration tests (e.g. the prompt-caching test) can run against a real server without seeding a purchase on every fresh test account. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent c57fd7f commit 9463fde

File tree

1 file changed

+8
-0
lines changed
  • web/src/app/api/v1/chat/completions

1 file changed

+8
-0
lines changed

web/src/app/api/v1/chat/completions/_post.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,11 @@ const FREE_MODE_ALLOWED_COUNTRIES = new Set([
7777
const MIN_ACCOUNT_AGE_DAYS = 3
7878
const MIN_ACCOUNT_AGE_FOR_PAID_MS = MIN_ACCOUNT_AGE_DAYS * 24 * 60 * 60 * 1000
7979

80+
// Emails allowed to bypass the paid+aged-account gate so integration tests
81+
// (e.g. the SDK prompt-caching test) can run against a real server without
82+
// needing to seed a purchase on every fresh test account.
83+
const PAID_GATE_BYPASS_EMAILS = new Set(['team@codebuff.com'])
84+
8085
function extractClientIp(req: NextRequest): string | undefined {
8186
const forwardedFor = req.headers.get('x-forwarded-for')
8287
if (forwardedFor) {
@@ -459,9 +464,12 @@ export async function postChatCompletions(params: {
459464
? Date.now() - new Date(userInfo.created_at).getTime()
460465
: 0
461466
const accountIsTooNew = accountAgeMs < MIN_ACCOUNT_AGE_FOR_PAID_MS
467+
const isBypassedEmail =
468+
!!userInfo.email && PAID_GATE_BYPASS_EMAILS.has(userInfo.email.toLowerCase())
462469
if (
463470
!isFreeModeRequest &&
464471
!openrouterApiKeyHeader &&
472+
!isBypassedEmail &&
465473
(!hasPaidRelationship || accountIsTooNew)
466474
) {
467475
trackEvent({

0 commit comments

Comments
 (0)