Documentation/Core Concepts/Declarative 1-Line API

Declarative 1-Line API

Universal wrapper supporting string model IDs, provider instances, and AI gateways.


Declarative 1-Line API

The core philosophy of `vibezcheck` is **zero friction**: you should never have to rewrite your AI logic or switch to a proprietary SDK.

Using String Model IDs

Pass any supported model identifier as a string:

typescript
400 font-semibold">import { 400 font-semibold">generateText } 400 font-semibold">from 400 font-semibold">class="text-emerald-400">'ai';
400 font-semibold">import { 400 font-semibold">vibezcheck } 400 font-semibold">from 400 font-semibold">class="text-emerald-400">'400 font-semibold">vibezcheck';
 
400 font-semibold">const { text } = 400 font-semibold">await 400 font-semibold">generateText({
model: 400 font-semibold">vibezcheck(400 font-semibold">class="text-emerald-400">'openai/gpt-4o-mini', { customer: 400 font-semibold">class="text-emerald-400">'user@example.com' }),
prompt: 400 font-semibold">class="text-emerald-400">'Explain photosynthesis in 1 sentence.',
});

Using Custom Provider Instances

If you have custom gateway endpoints, base URLs, or organization headers, pass your provider instance directly:

typescript
400 font-semibold">import { 400 font-semibold">createOpenAI } 400 font-semibold">from 400 font-semibold">class="text-emerald-400">'@ai-sdk/openai';
400 font-semibold">import { 400 font-semibold">streamText } 400 font-semibold">from 400 font-semibold">class="text-emerald-400">'ai';
400 font-semibold">import { 400 font-semibold">vibezcheck } 400 font-semibold">from 400 font-semibold">class="text-emerald-400">'400 font-semibold">vibezcheck';
 
400 font-semibold">const openai = 400 font-semibold">createOpenAI({
apiKey: process.env.AI_GATEWAY_API_KEY,
baseURL: 400 font-semibold">class="text-emerald-400">'https://ai-gateway.vercel.sh/v1',
});
 
400 font-semibold">const model = 400 font-semibold">vibezcheck(openai(400 font-semibold">class="text-emerald-400">'gpt-4o-mini'), {
customer: 400 font-semibold">class="text-emerald-400">'alex@company.com',
});

Compatibility with AI Primitives

`vibezcheck` works seamlessly with every Vercel AI SDK method: * `generateText()` — Single-turn text generation * `streamText()` — Multi-turn streaming responses * `generateObject()` — Structured JSON generation with Zod * `streamObject()` — Streaming structured JSON * Function calls & multi-step tool loops