AI

Vercel Hobby Plan AI SDK Streaming Timeout Workarounds Next.js

Vercel Hobby Plan AI SDK Streaming Timeout Workarounds Next.js

The Vercel Hobby plan’s 10-second function timeout has killed more AI streaming demos than any bug ever could. And with AI SDK v5 now shipping server-sent events through Next.js App Router by default, that ceiling hits faster than ever.

Key Takeaways

  • Vercel’s Hobby plan enforces a hard 10-second serverless function timeout, which AI SDK v5 streaming responses from models like GPT-4o routinely exceed.
  • The streamText function in AI SDK v5 initiates streaming correctly server-side, but the response can be silently cut off at the edge before the UI receives a complete stream.
  • Three viable workarounds exist: Edge Runtime migration, chunked polling via Inngest, and self-hosted inference endpoints.
  • Upgrading to Vercel Pro ($20/month) raises the timeout to 300 seconds and is the cleanest fix — but it’s not always realistic for side projects or indie developers.

Background: How a 10-Second Wall Became a 2026 Developer Problem

Vercel’s Hobby plan has had a 10-second serverless function limit for years. That was fine in 2022. Node APIs responded fast. Nobody was streaming 800-token completions through a Route Handler.

That calculus changed fast.

The Vercel AI SDK crossed 1 million weekly npm downloads in late 2025, according to the npm download tracker. AI SDK v5 — released in early 2026 — shifted the default transport layer to server-sent events (SSE) and leaned harder into the Next.js App Router’s streaming primitives. The useChat hook now pipes directly through app/api/chat/route.ts, which runs as a serverless function on Vercel.

The problem is structural. When you call streamText from ai in a Route Handler, Vercel starts a serverless function execution. That function must complete — or at least keep writing to the response — within the platform’s timeout window. On Hobby, that’s 10 seconds. On Pro, it’s 300 seconds.

GPT-4o’s median response latency for a 500-token completion sits around 8–12 seconds under normal load, according to Artificial Analysis’s 2025 benchmark data. Claude Sonnet 3.7 runs slightly faster, averaging 6–9 seconds for similar lengths. Both straddle the Hobby timeout boundary constantly.

And the failure mode is nasty. The stream starts. The UI shows partial tokens. Then it stops, silently. No 500 error. No timeout message. Just nothing. The Vercel community thread on AI SDK v5 streaming with OpenRouter documents dozens of developers hitting this exact pattern — server logs confirm the stream works, but the client receives a truncated response.


Main Analysis

Why AI SDK v5 Made This Worse

AI SDK v4 used a custom streaming protocol with ReadableStream. Developers could often work around timeouts by chunking responses manually or using edge functions with extended limits. AI SDK v5 changed the default to SSE-based transport, which is cleaner and more standards-compliant — but it also means the entire response lifecycle runs through a single HTTP connection tied to that serverless function execution.

The practical result: you can’t escape the timeout through clever response flushing the way you could before. The function has to stay alive for the full stream duration. On Hobby, it won’t.

There’s also a second failure surface. Next.js App Router’s app/api routes default to Node.js runtime. Node functions on Vercel Hobby have the 10-second cap. But Edge Runtime functions have a 60-second soft limit and no cold start penalty — a meaningful difference that most developers miss entirely.

The Three Workarounds That Actually Work

Option 1: Switch to Edge Runtime. Adding export const runtime = 'edge' to your Route Handler moves execution to Vercel’s Edge Network. The timeout floor jumps to 60 seconds on Hobby, which covers most single-turn AI completions. The LogRocket analysis of Next.js and Vercel AI SDK streaming confirms Edge Runtime handles streamText correctly with AI SDK v5 when configured properly.

The catch: Edge Runtime doesn’t support all Node.js APIs. If your Route Handler does database writes, file I/O, or calls packages that rely on Node built-ins, you’ll hit compatibility errors fast. This approach can fail quickly in ways that aren’t always obvious from the error messages.

Option 2: Use Inngest for long-running tasks. Inngest’s approach, documented in their Next.js timeout guide, treats the AI call as a background step function. The Route Handler returns immediately with a job ID. A separate Inngest function handles the actual model call and streams results back via their real-time event system.

This is overkill for a chat demo. It’s the right call for production apps where the AI response feeds into a database, triggers downstream actions, or needs retry logic. The operational overhead is real — factor that in before committing.

Option 3: Proxy through a persistent server. Running a small Express or Hono server on Railway or Fly.io — both offer free tiers — removes Vercel’s timeout entirely. The Next.js frontend calls the external endpoint. The AI stream runs on infrastructure with no arbitrary function limit.

This isn’t always the answer. It splits your deployment across two platforms, adds latency, and creates a dependency you now have to monitor and maintain.

Comparison: Which Workaround Fits Your Situation

ApproachTimeout LimitSetup ComplexityNode.js CompatBest For
Edge Runtime (Hobby)~60 secondsLowPartialSimple chat demos
Vercel Pro upgrade300 secondsNoneFullProduction apps
Inngest background jobsUnlimitedMedium-HighFullComplex workflows
External server proxyUnlimitedMediumFullBudget-conscious production
Self-hosted inferenceUnlimitedHighFullFull control needed

The Pro upgrade is the cleanest path. $20/month removes the timeout problem entirely and keeps everything on one platform. For a side project generating no revenue, that $20 stings — but the engineering time spent maintaining workarounds costs more. That math is worth doing honestly before reaching for a clever solution.

Edge Runtime works for roughly 80% of hobby use cases. It’s the right first move before considering anything more complex.


Practical Implications: What to Do Based on Your Setup

Scenario 1: You’re building a portfolio project or demo. Switch to Edge Runtime immediately. Add export const runtime = 'edge' and verify your Route Handler doesn’t use Node-only dependencies. For most simple demos, this solves the problem with minimal effort.

Scenario 2: You’re building a production app, still on Hobby. Upgrade to Pro. The 300-second limit handles even long-form generation tasks. Maintaining an Inngest integration or external proxy instead introduces operational complexity that compounds over time — and that complexity rarely stays contained.

Scenario 3: You’re running a complex AI pipeline — summarization feeding into a database write triggering a notification. Inngest or a dedicated background worker is the right architecture regardless of Vercel plan. These tasks don’t belong in a synchronous HTTP handler, full stop.

Worth checking before you assume: Vercel has been gradually expanding Edge Runtime’s Node.js compatibility. As of Q1 2026, more packages work in Edge than in 2024. The Vercel Edge Runtime compatibility list is worth reviewing before you assume a dependency will block you — it may have been added recently.


Conclusion & Future Outlook

This timeout problem isn’t going away on its own. Vercel’s Hobby plan economics depend on that 10-second limit. AI model outputs are getting longer, not shorter.

The path forward, broken down simply:

  • Edge Runtime is the fastest fix — 60-second limit, zero cost, low setup friction
  • Vercel Pro at $20/month eliminates the problem entirely for production
  • Inngest solves complex pipelines but adds real operational overhead
  • AI SDK v5’s SSE transport makes the timeout more visible, not more forgiving

Over the next 6–12 months, watch for AI SDK v5 adding native support for streaming heartbeats — small keep-alive signals that could prevent edge proxies from terminating connections early. That’s been discussed in the Vercel AI SDK GitHub issues and would meaningfully reduce Edge Runtime’s effective timeout risk.

Pick the simplest fix that matches your current stage. Edge Runtime for demos. Pro for production. Everything else is engineering debt you’ll pay later, usually at the worst possible time.

What’s your current workaround — are you on Edge Runtime, or did you bite the bullet and upgrade to Pro?

References

  1. AI SDK v5 Streaming Works Server-Side But Not in UI - OpenRouter - AI SDK - Vercel Community
  2. How to solve Next.js timeouts - Inngest Blog
  3. Real-time AI in Next.js: How to stream responses with the Vercel AI SDK - LogRocket Blog

Photo by Surface on Unsplash