Monetize by framework
How to Monetize a Vercel AI SDK (Next.js) AI App
Vercel AI SDK (Next.js) is a typeScript toolkit for building streaming AI UIs in Next.js/React with streamText and useChat. Teams reach for it to build streaming chat UIs, Next.js AI apps, and edge/serverless LLM routes. Those are exactly the always-on, conversational experiences where a subscription wall or a banner ad tends to feel out of place, which is where a contextual, in-conversation ad model fits better.
What building with Vercel AI SDK (Next.js) usually looks like
A typical Vercel AI SDK (Next.js) project centers on streaming chat UIs, Next.js AI apps, and edge/serverless LLM routes. The interface is a conversation, and value is delivered turn by turn rather than behind a checkout.
That shape is great for users and hard for revenue: the moment you gate it behind a paywall, casual usage, the majority of traffic for most Vercel AI SDK (Next.js) apps, drops off before it ever converts.
Why subscriptions and display ads are awkward for this stack
Subscriptions force a paying decision before the user has felt the value, and they leave every non-paying session earning nothing. Display networks (banners, sidebars) were built for static pages, not for a streaming Vercel AI SDK (Next.js) response, they compete with the conversation for attention instead of belonging to it.
Monetzly takes the other path: relevant, clearly-marked ads are placed inside the assistant's response stream, so free users can stay free while the app still earns on every session.
How Monetzly integrates with Vercel AI SDK (Next.js)
Vercel's streamText() exposes a textStream of plain strings. Wrap it in an async generator that yields { content: text } and pass that into sdk.inject(); then stream the injected tokens back in your Route Handler Response. Both APIs are documented, so this is a direct fit.
Monetzly's server SDK consumes any async stream of tokens, so you keep your existing Vercel AI SDK (Next.js) model call and pass its streaming output into sdk.inject(), contextual ads are injected into the token stream keyed on the session and live prompt, with no UI rework.
Integration snippet
import { streamText } from "ai";
import { google } from "@ai-sdk/google";
import { MonetzlySDK } from "@monetzly/server-sdk";
const sdk = new MonetzlySDK({
apiKey: process.env.MONETZLY_API_KEY!,
serverAddress: process.env.MONETZLY_SERVER_ADDRESS!,
});
export async function POST(req: Request) {
const { prompt } = await req.json();
await sdk.connect();
const { textStream } = streamText({ model: google("gemini-2.0-flash"), prompt });
// Adapt Vercel's string stream to Monetzly's TokenChunk shape.
async function* asChunks() {
for await (const text of textStream) yield { content: text };
}
const enc = new TextEncoder();
const body = new ReadableStream({
async start(c) {
for await (const t of sdk.inject(asChunks(), { prompt }))
c.enqueue(enc.encode(t.content ?? ""));
await sdk.disconnect();
c.close();
},
});
return new Response(body, { headers: { "Content-Type": "text/plain; charset=utf-8" } });
}Frequently asked questions
Start monetizing in about 5 minutes
Wrap your existing LLM response stream with the Monetzly SDK and earn on every session, no paywall required.