Vercel AI SDK with unoblox
Call Claude, GPT-4o, Qwen, or DeepSeek from Next.js with the Vercel AI SDK, routed through unoblox and billed monthly in rupees with GST.
Vercel AI SDK is the default choice for streaming AI apps in Next.js. unoblox integrates with a one-line provider swap: keep the SDK's hooks and streaming helpers, and unlock Claude, GPT-4o, Qwen, and DeepSeek behind a single endpoint billed in rupees.
Why Vercel AI SDK + unoblox
- Next.js native: streaming, SSR, and TypeScript support out of the box
- One custom provider: configure
createOpenAIonce, reuse it everywhere - 40+ models: all through one OpenAI-compatible endpoint
- ₹ billing: monthly GST invoice, input-tax-credit eligible
- Deploy anywhere: Vercel, or any Node.js host — unoblox doesn't require Vercel specifically
Two-line integration
// lib/unoblox.ts
import { createOpenAI } from '@ai-sdk/openai';
export const unoblox = createOpenAI({
baseURL: 'https://api.unoblox.ai/v1',
apiKey: process.env.UNOBLOX_API_KEY,
});
// Anywhere in your app
import { generateText } from 'ai';
import { unoblox } from '@/lib/unoblox';
const { text } = await generateText({
model: unoblox('openai/gpt-4o'),
prompt: 'Build me a React component that shows a pricing table.',
});
Streaming API route (App Router)
// app/api/chat/route.ts
import { streamText } from 'ai';
import { unoblox } from '@/lib/unoblox';
export async function POST(req: Request) {
const { messages } = await req.json();
const result = streamText({
model: unoblox('anthropic/claude-sonnet-5'),
messages,
});
return result.toTextStreamResponse();
}
Quick React example
import { useCompletion } from 'ai/react';
export default function Chat() {
const { completion, input, handleInputChange, handleSubmit } = useCompletion({
api: '/api/chat',
});
return (
<form onSubmit={handleSubmit}>
<input value={input} onChange={handleInputChange} placeholder="Ask me anything..." />
<button type="submit">Send</button>
<div>{completion}</div>
</form>
);
}
Environment setup
# .env.local
UNOBLOX_API_KEY=ub-gw-YOUR_KEY
Model selection
| Model | ₹ per 1M input | Best for |
|---|---|---|
| Qwen3 1.7B | FREE | chat responses, ideation |
| DeepSeek V4 Flash | ₹9.07 | fast coding, translation |
| GPT-4o | ₹252 | complex analysis |
| Claude Opus | ₹504 | long-context reasoning |
Frequently asked questions
Do I need a Vercel account? No. The AI SDK runs on any Node.js host — Vercel just makes edge streaming convenient.
Can I use streaming, JSON mode, and tool use together?
Yes. The Vercel AI SDK exposes all three, and unoblox passes them through unchanged — check /models for per-model tool and vision support.
How do I handle rate limiting?
Catch the error from generateText or streamText, check for a 429, and retry with backoff — or add your own circuit-breaker middleware.
Can I switch models per request?
Yes. Pick the provider call dynamically, e.g. unoblox(isComplex ? 'anthropic/claude-opus-5' : 'deepseek-ai/deepseek-v4-flash').
What if unoblox has downtime? unoblox targets 99.95% uptime. For extra resilience, wrap calls in your own fallback logic that retries against a second model.
Do tokens count the same way as raw OpenAI calls? Yes — the SDK's usage reporting reflects the same input and output token counts unoblox bills on, visible per-call on your dashboard.
Get started in rupees → https://unoblox.ai/sign-in
Start building in rupees
Call every major model through one OpenAI-compatible endpoint, billed in ₹ on a GST invoice.