Unify AI Provider Access
Example workflow demonstrating Vercel AI Gateway integration to access multiple AI providers through a single unified API endpoint.
Why it matters
Access multiple AI providers through a single, unified API. This asset simplifies integration with various AI models, offering a consistent interface for diverse AI tasks.
Outcomes
What it gets done
Integrate with Vercel AI Gateway
Access multiple AI providers via a unified API
Simplify AI model integration
Install
Add it to your toolbox
Run in your project directory:
curl -fsSL https://spark.entire.vc/get/pfoo-ai-gateway | bash Capabilities
What this chain does
Handles multi-turn conversations within a defined domain.
Condenses long documents or threads into key takeaways.
Searches the web and retrieves relevant sources.
Overview
Ai Gateway
What it does
This example demonstrates a working integration with Vercel AI Gateway, showing how to configure and use the gateway to access multiple AI providers through a single, unified API. It provides a reference implementation for routing AI requests through Vercel's gateway infrastructure.
How it connects
Use this example when you're building applications that need to work with multiple AI providers and want to avoid managing separate API integrations for each one. It's ideal when you need a consistent interface across different AI services or want to simplify provider switching and multi-provider strategies.
Source README
integration-vercel/ai-gateway (Vercel AI Gateway Example)
This example demonstrates how to use Vercel AI Gateway to access multiple AI providers through a unified API.
Prerequisites
- A Vercel account with AI Gateway enabled
- Your Vercel AI Gateway API key
Setup
Set the required environment variable:
export VERCEL_AI_GATEWAY_API_KEY=your_api_key
Running the Example
npx promptfoo@latest init --example integration-vercel/ai-gateway
npx promptfoo eval
Or run directly:
npx promptfoo eval -c examples/integration-vercel/ai-gateway/promptfooconfig.yaml
What This Example Does
The configuration compares responses from three different providers, all accessed through Vercel AI Gateway:
- OpenAI (gpt-4o-mini)
- Anthropic (claude-haiku-4.5)
- Google (gemini-2.5-flash)
Each provider answers questions about technical topics, and the assertions verify that responses contain relevant keywords.
Documentation
See the Vercel AI Gateway provider documentation for more details.
Discussion
Questions & comments · 0
Sign In Sign in to leave a comment.