Vercel Deployment
Use Hypery Hub instead of Vercel's Hypery
Overview
Vercel offers an Hypery feature that routes AI SDK requests through their proxy. Hypery Hub provides the same functionality with more features - 2000+ models, team management, unified billing, and custom admin panels.
This guide shows how to use Hypery Hub instead of Vercel's Hypery.
Replace Vercel Hypery
Instead of using Vercel's Hypery, configure your app to use Hypery Hub.
Option 1: Environment Variables (Recommended)
Set these in your Vercel project settings:
# For OpenAI SDK (auto-detects OPENAI_API_BASE)
OPENAI_API_KEY=your-gateway-api-key
OPENAI_API_BASE=https://hypery.ai/api/v1
# For Vercel AI SDK
AI_GATEWAY_BASE_URL=https://hypery.ai/api/v1Option 2: Vercel AI SDK Provider Config
Configure the provider directly in code:
import { createOpenAI } from '@ai-sdk/openai'
// Instead of Vercel's default gateway
const provider = createOpenAI({
apiKey: process.env.OPENAI_API_KEY,
baseURL: process.env.AI_GATEWAY_BASE_URL || 'https://hypery.ai/api/v1'
})With OpenAI SDK
The OpenAI SDK automatically uses OPENAI_API_BASE if set:
import OpenAI from 'openai'
// Uses OPENAI_API_BASE env var automatically
const client = new OpenAI({
apiKey: process.env.OPENAI_API_KEY
})
// Or configure explicitly
const client = new OpenAI({
apiKey: process.env.AI_GATEWAY_API_KEY,
baseURL: process.env.AI_GATEWAY_BASE_URL || 'https://hypery.ai/api/v1'
})With Vercel AI SDK
import { createOpenAI } from '@ai-sdk/openai'
const aiGateway = createOpenAI({
apiKey: process.env.AI_GATEWAY_API_KEY,
baseURL: process.env.AI_GATEWAY_BASE_URL || 'https://hypery.ai/api/v1'
})
// Use in your app
import { generateText } from 'ai'
const { text } = await generateText({
model: aiGateway('anthropic/claude-3.5-sonnet'),
prompt: 'Hello!'
})Vercel Edge Functions
Hypery Hub works perfectly with Vercel Edge Functions:
// app/api/chat/route.ts
import { OpenAI } from 'openai'
import { OpenAIStream, StreamingTextResponse } from 'ai'
export const runtime = 'edge'
const client = new OpenAI({
apiKey: process.env.AI_GATEWAY_API_KEY,
baseURL: 'https://hypery.ai/api/v1'
})
export async function POST(req: Request) {
const { messages } = await req.json()
const response = await client.chat.completions.create({
model: 'anthropic/claude-3.5-sonnet',
messages,
stream: true
})
const stream = OpenAIStream(response)
return new StreamingTextResponse(stream)
}Why Use Hypery Hub Instead?
Migration Steps
-
Get API Key from Hypery Hub dashboard
-
Update Environment Variables in Vercel:
OPENAI_API_KEY=your-gateway-api-key OPENAI_API_BASE=https://hypery.ai/api/v1 -
No code changes needed - Environment variables handle everything
-
Deploy and test