Vercel AI SDK is a TypeScript toolkit for building AI-powered applications with React, Next.js, Vue, and Svelte. RedPill works seamlessly with Vercel AI SDK using the OpenAI provider.
Perfect for building streaming chat UIs, AI-powered forms, and interactive AI experiences.
import { streamText } from 'ai';import { createOpenAI } from '@ai-sdk/openai';const redpill = createOpenAI({ apiKey: process.env.REDPILL_API_KEY, baseURL: 'https://api.redpill.ai/v1'});async function main() { const result = streamText({ model: redpill('openai/gpt-5'), prompt: 'Write a story about privacy-first AI' }); for await (const chunk of result.textStream) { process.stdout.write(chunk); }}main();
import { generateText, tool } from 'ai';import { createOpenAI } from '@ai-sdk/openai';import { z } from 'zod';const redpill = createOpenAI({ apiKey: process.env.REDPILL_API_KEY!, baseURL: 'https://api.redpill.ai/v1'});async function main() { const result = await generateText({ model: redpill('openai/gpt-5'), prompt: 'What is the weather in Paris and San Francisco?', tools: { getWeather: tool({ description: 'Get the current weather in a location', parameters: z.object({ location: z.string().describe('The city name'), unit: z.enum(['celsius', 'fahrenheit']).optional() }), execute: async ({ location, unit = 'celsius' }) => { // API call to weather service return { location, temperature: 22, unit, condition: 'sunny' }; } }) }, maxSteps: 5 // Allow multiple tool calls }); console.log(result.text);}main();
import { generateText } from 'ai';import { createOpenAI } from '@ai-sdk/openai';const redpill = createOpenAI({ apiKey: process.env.REDPILL_API_KEY!, baseURL: 'https://api.redpill.ai/v1'});// Use GPT-4o for general tasksconst gpt4Result = await generateText({ model: redpill('openai/gpt-5'), prompt: 'Summarize this article...'});// Use Claude for analysisconst claudeResult = await generateText({ model: redpill('anthropic/claude-sonnet-4.5'), prompt: 'Analyze this data...'});// Use DeepSeek for codingconst deepseekResult = await generateText({ model: redpill('deepseek/deepseek-chat'), prompt: 'Write a React component...'});// Use Phala for sensitive dataconst phalaResult = await generateText({ model: redpill('phala/qwen-2.5-7b-instruct'), prompt: 'Process this confidential information...'});