Documentation/Core Concepts/Declarative 1-Line API
Declarative 1-Line API
Universal model wrapper supporting string IDs, provider instances, and gateways.
Declarative 1-Line API
The `vibezcheck(model, options)` function acts as a universal decorator for any AI model.
---
1-Line Syntax
You can pass a string model identifier or any Vercel AI SDK language model instance:
typescript
import { generateText } from 'ai';
import { vibezcheck } from 'vibezcheck';
const { text } = await generateText({
model: vibezcheck('openai/gpt-4o-mini', {
customer: 'user@example.com',
}),
prompt: 'What is love?',
});---
Vercel AI SDK Primitives
`vibezcheck` is 100% compatible with all Vercel AI SDK primitives: * `generateText({ model, prompt })` * `streamText({ model, messages })` * `generateObject({ model, schema, prompt })` * `streamObject({ model, schema, prompt })` * Tool calls & function executions
---
Custom Provider Instances (`createOpenAI`)
If you configure custom headers, organizations, or gateways in `createOpenAI`, pass the instance directly:
typescript
import { createOpenAI } from '@ai-sdk/openai';
import { streamText } from 'ai';
import { vibezcheck } from 'vibezcheck';
const openai = createOpenAI({
apiKey: process.env.AI_GATEWAY_API_KEY,
baseURL: 'https://ai-gateway.vercel.sh/v1',
});
export async function POST(req: Request) {
const { messages } = await req.json();
return streamText({
model: vibezcheck(openai('gpt-4o-mini'), { customer: 'alex@company.com' }),
messages,
}).toTextStreamResponse();
}