Tool calls arrive with wrong arguments
The model returned a call whose JSON parses but fails the Zod schema, often because a field is nested or the model prefers camelCase while the schema used snake_case.
Tool calls matching the schema
Building with the Vercel AI SDK?
The Vercel AI SDK is the fastest way to ship an AI feature inside a Next.js app, and the cracks show the moment you pass the toy demo stage: streams that stall on Cloudflare, tool calls that arrive without the arguments they promised, structured outputs that fail schema validation on a Thursday. We take the integration from demo to production.
What it is
The Vercel AI SDK is a TypeScript toolkit for building AI-powered applications, shipped by Vercel and open source under Apache 2.0. The core gives you a unified API across OpenAI, Anthropic, Google, Mistral, Groq and dozens of other providers; the UI layer offers framework hooks for React, Svelte and Vue that handle streaming chat, tool calls and structured output.
It is the default pick for anyone building on Next.js because the integration with App Router, Edge runtime and Vercel Functions is first class. The SDK covers streamText, generateObject, tool-use with Zod schemas, and the message format used by useChat on the client. Pricing is zero because the SDK itself is free; you pay the underlying model providers and your hosting bill.
The honest version
No technology is all upside. This is where Vercel AI SDK earns its place and where it tends to cause trouble.
Sound familiar?
The Vercel AI SDK problems that bring people to us, and what you have once each one is fixed.
The model returned a call whose JSON parses but fails the Zod schema, often because a field is nested or the model prefers camelCase while the schema used snake_case.
Tool calls matching the schema
A model that opened a code fence instead of raw JSON, or a trailing comma that broke the parse. More likely on smaller models and under token limits.
Objects parsed and typed cleanly
The client disconnected, the Edge runtime closed the response early, or an abort signal fired mid-stream. Downstream code that depends on onFinish (billing, logging) silently stops firing.
Finish hooks firing on every stream
A mismatch between the SDK version on the server and the one on the client, or a response that was transformed by a proxy or CDN in a way the stream format did not survive.
Client and server speaking the same format
A rate-limited provider that keeps returning 429, a model that is temporarily unreachable, or a timeout that is too short for a long tool-use chain.
Retries tuned to the real failure mode
An array of objects where one field drifts from the schema under load, usually because the model prefers to emit a string when the schema asked for a number.
Schema and outputs reconciled
A file attachment or image part that works on one provider and is rejected by another, with no graceful fallback in the routing layer.
Content parts normalised per provider
A custom provider pointer that was removed, a model slug that moved under OpenRouter, or an environment variable that is empty in production.
Provider registry aligned with runtime
What we do
Pull us in for one flaky stream, or let us build the whole AI feature in your Next.js stack.
How it works
Tell us what's going wrong. We look at it, then tell you plainly what's wrong and what it will cost.
We fix the cause, not the symptom. If something is down, getting it back up comes first.
Backups, monitoring, updates and access, so the same problem can't quietly come back.
You get a plain-language write-up. Or we stay on for hosting, upkeep and new work.
Often found together
We work on the whole stack, so the problem can be wherever it actually is.
Three usual causes: the client disconnected and the server did not notice, the Edge runtime closed the response body before the final event, or an abort signal fired and the handler branched around onFinish. Make sure consumers do not depend solely on onFinish for billing or logging; also record completion server-side when the stream ends by any path.
Keep tool schemas narrow, name fields in a style the model prefers (usually camelCase on OpenAI, snake_case tends to work everywhere), set a sensible maxSteps so loops do not run forever, and validate the arguments with Zod before you execute the handler. Treat any invalid-arguments error as a retry with a corrective system message rather than a hard failure.
Smaller models still love code fences and trailing commas, even with schema guidance. Use a stronger model for generateObject, prefer providers with native structured output when available, and keep the schema shallow. Deeply nested schemas with optional fields are where most of the parse failures live.
Yes. It runs on Node, Bun, Deno, Cloudflare Workers, AWS Lambda and anywhere TypeScript runs. The ergonomics are best inside Next.js on Vercel because the response types and streaming helpers are tuned for Vercel Functions, but there is nothing in the SDK that requires Vercel hosting.
The SDK exposes experimental telemetry hooks that integrate with OpenTelemetry, Langfuse and LangSmith. The right choice depends on the rest of your stack: if you already ship traces to Langfuse or LangSmith for LangChain code, use the same tool so the agent and the SDK runs sit in one place.
Estimates come back free of charge. Describe the behaviour, whether it is a stream that will not close, a tool that will not fire or a model switch that broke something, and you get a number before work begins.
Free estimate
Tell us what you're running and what's going wrong. A person reads it and comes back with an estimate.
Your message is with a real person, and we'll get back to you soon.
Rather talk now? Call us: