Vercel AI Gateway provider for the PHP AI Client SDK. Works as a Composer package and WordPress plugin.
The Vercel AI Gateway allows you to use hundreds of generative AI models from over 40 different providers, to generate text, images, video, and more.
Make sure you're using WordPress/php-ai-client 1.3.0 or higher.
composer require vercel-labs/ai-gateway-providerMake sure you're using WordPress 7.0 or higher.
- Visit Plugins > Add New.
- Search for Vercel AI Gateway, then install and activate the AI Gateway Provider plugin.
- Visit Settings > Connectors and paste your AI Gateway API key.
- Upload the entire
vercel-ai-gateway-providerfolder to the/wp-content/plugins/directory. - Visit Plugins, and activate the Vercel AI Gateway Provider plugin.
- Visit Settings > Connectors and paste your AI Gateway API key.
The provider automatically registers itself with the PHP AI Client on the init hook. Simply configure the API key under Settings > Connectors, and you can start using all the models via the AI Gateway.
// Use the provider
$result = wp_ai_client_prompt( 'Hello, world!' )
->using_provider( 'ai_gateway' )
->generate_text_result();See docs/wordpress.md for more examples.
use WordPress\AiClient\AiClient;
use Vercel\AiGatewayProvider\Provider\AiGatewayProvider;
// Register the provider
$registry = AiClient::defaultRegistry();
$registry->registerProvider(AiGatewayProvider::class);
// Set your API key
putenv('AI_GATEWAY_API_KEY=your-api-key');
// Generate text
$result = AiClient::prompt('Explain quantum computing')
->usingProvider('ai_gateway')
->generateTextResult();
echo $result->toText();See docs/php.md for more examples.
MIT