aisdk / vercel
Official Vercel AI Gateway provider for the PHP AI SDK.
Fund package maintenance!
v0.8.1
2026-07-22 06:36 UTC
Requires
- php: ^8.3
- aisdk/core: ^0.8.0
- aisdk/openai-compatible: ^0.8.0
Requires (Dev)
- laravel/pint: ^1.18
- nyholm/psr7: ^1.8
- pestphp/pest: ^3.0 || ^4.0
- phpstan/phpstan: ^2.0
- rector/rector: ^2.0
README
Official Vercel AI Gateway provider for the PHP AI SDK. Uses Vercel's OpenAI-compatible Chat Completions API.
Installation
composer require aisdk/vercel
Basic Usage
use AiSdk\Generate; use AiSdk\Vercel; Vercel::create(['apiKey' => $_ENV['AI_GATEWAY_API_KEY']]); $result = Generate::text('Explain this code briefly.') ->model(Vercel::model('anthropic/claude-sonnet-4.5')) ->run();
Configuration
| Variable | Description | Default |
|---|---|---|
AI_GATEWAY_API_KEY |
Vercel AI Gateway API key | Required |
VERCEL_BASE_URL |
Base URL for API requests | https://ai-gateway.vercel.sh/v1 |
Supported Capabilities
| Capability | Support |
|---|---|
| Text generation and streaming | Native OpenAI-compatible chat |
| Tool calling, structured output, reasoning | Passed through for selected gateway models |
| Image input | Passed through for compatible gateway models |
Provider Options
Use providerOptions('vercel', ['raw' => [...]]) for documented AI Gateway fields outside the portable SDK surface. Model IDs use Vercel's provider/model form and remain opaque strings.