severity: warnpack: vercelv1.0 core
vercel/serverless-budget-guard
Long-running AI call with no `maxDuration`
npx @pitcheye/check . --pack vercelwhyItBreaks
Serverless functions get the plan default duration (10s on Hobby). An LLM completion routinely exceeds it, so the request is killed mid-flight: the user sees a 504, the provider still bills the tokens, and the retry bills them again.
✖ Bad — triggers warnfixtures/vercel-serverless-budget-guard/bad
export async function POST(req: Request) {
return generateText({ model, prompt });
}✓ Good — passes checkfixtures/vercel-serverless-budget-guard/good
export const maxDuration = 60;
export async function POST(req: Request) {
return generateText({ model, prompt });
}suggestedFix
Export `export const maxDuration = 60` (plan-dependent) from the route, and stream the response for anything user-facing so the connection outlives the first token.
explain_rule({"vercel/serverless-budget-guard"})Agent & MCP JSON output contract
{
"ruleId": "vercel/serverless-budget-guard",
"pack": "vercel",
"severity": "warn",
"file": "vercel.json",
"line": 6,
"message": "a route handler calling an LLM SDK with no `export const maxDuration`",
"whyItBreaks": "Serverless functions get the plan default duration (10s on Hobby). An LLM completion routinely exceeds it, so the request is killed mid-flight: the user sees a 504, the provider still bills the tokens, and the retry bills them again.",
"suggestedFix": "Export `export const maxDuration = 60` (plan-dependent) from the route, and stream the response for anything user-facing so the connection outlives the first token.",
"docsUrl": "https://pitcheye.dev/rules/vercel-serverless-budget-guard"
}Markdown: curl -H "Accept: text/markdown" https://pitcheye.dev/rules/vercel-serverless-budget-guard
raw markdown
# vercel/serverless-budget-guard
- **severity:** warn
- **pack:** vercel
- **docs:** https://pitcheye.dev/rules/vercel-serverless-budget-guard
## whyItBreaks
Serverless functions get the plan default duration (10s on Hobby). An LLM completion routinely exceeds it, so the request is killed mid-flight: the user sees a 504, the provider still bills the tokens, and the retry bills them again.
## bad
```ts
export async function POST(req: Request) {
return generateText({ model, prompt });
}
```
## good
```ts
export const maxDuration = 60;
export async function POST(req: Request) {
return generateText({ model, prompt });
}
```
## suggestedFix
Export `export const maxDuration = 60` (plan-dependent) from the route, and stream the response for anything user-facing so the connection outlives the first token.
## commands
```bash
npx @pitcheye/check . --pack vercel
```
```json
{"tool":"explain_rule","arguments":{"ruleId":"vercel/serverless-budget-guard"}}
```