aisdk / xai
Official xAI provider for the PHP AI SDK.
Fund package maintenance!
v0.11.0
2026-10-31 02:59 UTC
Requires
- php: ^8.3
- aisdk/core: ^0.11.0
- aisdk/openai-compatible: ^0.11.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
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
Text, image, audio, embedding, and video generation, plus live voice sessions with xAI. Part of the framework-agnostic PHP AI SDK.
Installation
composer require aisdk/xai
Set XAI_API_KEY in your environment.
Usage
use AiSdk\Generate; use AiSdk\XAI; $result = Generate::text('Explain closures in PHP in one sentence.') ->model(XAI::model('grok-4.3-latest')) ->run(); echo $result->text;
Documentation
Read the documentation for configuration, supported features, and more examples.
License
The MIT License (MIT). See LICENSE for details.