PHPackages                             jordandalton/tackle-grok - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. jordandalton/tackle-grok

ActiveLibrary

jordandalton/tackle-grok
========================

Grok provider for Laravel Tackle — run your in-app AI coding agent on your grok.com subscription via the Grok CLI's sign-in, or an xAI API key.

v0.1.0(yesterday)00MITPHPPHP ^8.3CI passing

Since Aug 16Pushed yesterdayCompare

[ Source](https://github.com/JordanDalton/tackle-grok)[ Packagist](https://packagist.org/packages/jordandalton/tackle-grok)[ RSS](/packages/jordandalton-tackle-grok/feed)WikiDiscussions main Synced today

READMEChangelogDependencies (7)Versions (2)Used By (0)

Tackle Grok
===========

[](#tackle-grok)

**A Grok (xAI) provider for [Laravel Tackle](https://github.com/JordanDalton/laravel-tackle)— run your in-app AI coding agent on Grok models.**

> 📚 **Full documentation: [tackle.jordandalton.com](https://tackle.jordandalton.com)**

```
AI_CODE_PROVIDER=grok
```

That's the whole switch. Every Tackle agent — `ai:code`, `ai:run`, `ai:fix`, `ai:review`, the self-healer — now runs on xAI's Grok models.

This is a [`laravel/ai`](https://github.com/laravel/ai) provider under the hood, so it also works in any `laravel/ai` app without Tackle.

Two ways to authenticate
------------------------

[](#two-ways-to-authenticate)

ModeWhat it doesStatus**`api-key`**Uses an xAI API key from [console.x.ai](https://console.x.ai) against the public `api.x.ai` endpoint.**Recommended** — xAI's documented path for CI/CD, automation, and custom apps.`subscription`Uses the session token from the [Grok CLI](https://x.ai/cli)'s sign-in against the CLI backend, on your grok.com plan.Best-effort — see [the honest caveat](#subscription-mode-the-honest-version).`GROK_AUTH` selects the mode (`auto` by default: `subscription` when a Grok CLI sign-in exists, otherwise `api-key`). If you want the recommended path unconditionally, set `GROK_AUTH=api-key`.

Installation
------------

[](#installation)

The easiest path from a Tackle app:

```
php artisan tackle:install grok
```

Or via Composer directly:

```
composer require jordandalton/tackle-grok
php artisan vendor:publish --tag=tackle-grok-config   # optional
```

The service provider registers a `grok` driver with `laravel/ai`automatically — no `config/ai.php` edits required (add a `'grok' => ['driver' => 'grok']` entry if you prefer it explicit).

API-key mode (recommended)
--------------------------

[](#api-key-mode-recommended)

Get a key from [console.x.ai](https://console.x.ai) and set it:

```
GROK_AUTH=api-key
XAI_API_KEY=xai-...
```

This is the stock, documented xAI integration path — the same `api.x.ai`endpoint and API-key auth xAI publishes for building custom apps. Billing is metered per token, so pin rates in `config/tackle.php` under `pricing.models`to keep budget enforcement meaningful.

```
php artisan grok:status
php artisan ai:code --provider=grok --model=grok-4.6
```

Subscription mode: the honest version
-------------------------------------

[](#subscription-mode-the-honest-version)

Subscription mode runs the agents on your **grok.com plan** by reusing the [Grok CLI](https://x.ai/cli)'s sign-in — the same `~/.grok/auth.json` session token, sent to the CLI backend (`cli-chat-proxy.grok.com`).

**What you should know before using it:**

- **This mimics the official Grok CLI.** The CLI backend rejects requests that don't identify as the CLI (HTTP 426, "your Grok CLI version is outdated"), so this mode sends the same client-version headers the Grok CLI sends. It is **not** a documented third-party integration path — xAI's documented paths for custom apps are the [API](#api-key-mode-recommended) and [Agent mode/ACP](https://x.ai/cli). Treat subscription mode as best-effort.
- **xAI can change or gate it at any time.** Every endpoint and header lives in config (`GROK_BASE_URL`, `GROK_CLIENT_VERSION`, …), so a change is an `.env` edit rather than a package release — but there is no guarantee it keeps working, and plan usage is subject to your grok.com subscription's terms.
- **The Grok CLI owns the session.** This package reads the token read-only and never mints one. The CLI refreshes its own session in the background; when it lapses, run `grok login`.

If your usage matters, prefer api-key mode, or confirm subscription-backend use with xAI developer support first.

```
# Sign in once with the Grok CLI, then:
php artisan grok:status
```

```
  Mode ............................ subscription (plan-covered)
  Default model ................... grok-4.6
  Auth file ....................... /Users/you/.grok/auth.json
  Session token ................... valid, expires 2026-08-17 02:53 UTC

```

Configuration
-------------

[](#configuration)

Everything is env-tunable; publish the config for the full list:

VariableDefaultDescription`GROK_AUTH``auto``auto` | `subscription` | `api-key``XAI_API_KEY` / `GROK_API_KEY`—Key for api-key mode`GROK_API_BASE_URL``https://api.x.ai/v1`Endpoint for api-key mode`GROK_AUTH_FILE``~/.grok/auth.json`Grok CLI auth file (subscription mode)`GROK_BASE_URL`CLI backendEndpoint for subscription mode`GROK_MODEL``grok-4.6`Default model in subscription mode`GROK_CLIENT_VERSION``1.0.3`Client-version header the CLI backend requiresTackle integration
------------------

[](#tackle-integration)

When subscription mode is active and `grok` is the active provider, the CLI backend's models are registered in Tackle's pricing catalog at **$0/MTok** — the budget tracker stays accurate because your plan covers usage. The zero rates apply *only* when this provider is active, so an api-key setup keeps real rates. A leftover `claude-*`/`gpt-*` model default from another provider is swapped for the Grok default automatically.

How it works
------------

[](#how-it-works)

`laravel/ai`'s xAI gateway already speaks the Responses API. This package extends it with a `GrokProvider` that:

- in api-key mode, is the stock xAI provider — `api.x.ai`, `Authorization: Bearer `, stock model defaults;
- in subscription mode, swaps the bearer for the Grok CLI session token, points the base URL at the CLI backend, and (via `GrokGateway`) attaches the client-version headers that backend requires.

Development
-----------

[](#development)

```
composer install
./vendor/bin/pest
./vendor/bin/pint
```

License
-------

[](#license)

MIT

###  Health Score

37

—

LowBetter than 81% of packages

Maintenance100

Actively maintained with recent releases

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity38

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

1d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1389886?v=4)[Jordan Dalton](/maintainers/jordandalton)[@JordanDalton](https://github.com/JordanDalton)

---

Top Contributors

[![JordanDalton](https://avatars.githubusercontent.com/u/1389886?v=4)](https://github.com/JordanDalton "JordanDalton (1 commits)")

---

Tags

laravelaigrokx.aicoding-assistanttackle

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/jordandalton-tackle-grok/health.svg)

```
[![Health](https://phpackages.com/badges/jordandalton-tackle-grok/health.svg)](https://phpackages.com/packages/jordandalton-tackle-grok)
```

###  Alternatives

[unopim/unopim

UnoPim Laravel PIM

10.8k2.5k](/packages/unopim-unopim)[bagisto/bagisto

Bagisto Laravel E-Commerce

28.0k175.2k9](/packages/bagisto-bagisto)[elegantly/laravel-translator

All on one translations management for Laravel

6339.5k](/packages/elegantly-laravel-translator)[backstage/mails

View logged mails and events in a beautiful Filament UI.

16429.7k](/packages/backstage-mails)[slimani/filament-media-manager

A media manager plugin for Filament.

179.7k1](/packages/slimani-filament-media-manager)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
