rapttor/grok-api-client

A PHP client library for interacting with xAI's GROK API

1.0.0 2025-08-17 17:07 UTC

This package is auto-updated.

Last update: 2025-08-20 16:00:29 UTC


README

A simple PHP client library for interacting with xAI's GROK API - Based on grok-4 curl example

Installation

Install via Composer:

composer require RapTToR/grok-api-client

Usage

<?php
use RapTToR\Grok\Grok;
$XAI_API_KEY = getenv('XAI_API_KEY');
echo  new Grok($XAI_API_KEY)->chat("What is the meaning of life, the universe, and everything?")->result(0);
?>
  • The library is based on Grok Curl example
  • Does not require any other dependencies