PHPackages                             ursamajeur/laravel-ai-gemini-driver - 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. [API Development](/categories/api)
4. /
5. ursamajeur/laravel-ai-gemini-driver

ActiveLibrary[API Development](/categories/api)

ursamajeur/laravel-ai-gemini-driver
===================================

Laravel AI provider that proxies Gemini CLI and Antigravity endpoints

v0.2.0(3mo ago)01MITPHPPHP ^8.3

Since Mar 11Pushed 3mo agoCompare

[ Source](https://github.com/iqbalhprahara/laravel-ai-gemini-driver)[ Packagist](https://packagist.org/packages/ursamajeur/laravel-ai-gemini-driver)[ Docs](https://github.com/iqbalhprahara/laravel-ai-gemini-driver)[ RSS](/packages/ursamajeur-laravel-ai-gemini-driver/feed)WikiDiscussions main Synced 3w ago

READMEChangelog (2)Dependencies (13)Versions (3)Used By (0)

Laravel AI Gemini Driver
========================

[](#laravel-ai-gemini-driver)

A [Laravel AI](https://github.com/laravel/ai) provider that proxies [Gemini CLI](https://github.com/google-gemini/gemini-cli) and Antigravity endpoints to access Google's CloudCode-PA v1internal API. Use Gemini, Claude, and GPT models through a single unified interface with automatic rate-limit cascading, multi-endpoint fallback, and SSE streaming.

Warning

**Use at Your Own Risk**

This package accesses Google's internal CloudCode-PA API through undocumented endpoints using OAuth credentials intended for Gemini CLI. This is **not an officially supported method** of accessing these models. Using this package may violate Google's Terms of Service and **could result in your Google account being suspended or banned**. The authors accept no responsibility for any consequences arising from its use.

Requirements
------------

[](#requirements)

- PHP 8.3+
- Laravel 12 or 13
- [Laravel AI](https://github.com/laravel/ai) ^0.1 | ^0.2 (pre-release — expect breaking changes)
- OAuth credentials JSON produced by [Gemini CLI](https://github.com/google-gemini/gemini-cli)

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

[](#installation)

```
composer require ursamajeur/laravel-ai-gemini-driver
```

The service provider is auto-discovered — no manual registration needed.

Publish the configuration file:

```
php artisan vendor:publish --tag=cloudcode-pa-config
```

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

[](#configuration)

### Authentication

[](#authentication)

This package requires an OAuth credentials JSON file produced by [Gemini CLI](https://github.com/google-gemini/gemini-cli). Run Gemini CLI at least once and authenticate — this generates the OAuth JSON that this package uses. The package handles token refresh automatically after that.

Set the path to your OAuth credentials in `.env`:

```
CLOUDCODE_PA_CREDENTIALS_PATH=storage/cloudcode-pa/oauth_creds.json
```

If not set, it defaults to `storage/cloudcode-pa/oauth_creds.json`. The package handles token refresh automatically.

### Project ID

[](#project-id)

The CloudCode-PA project ID is obtained during Gemini CLI onboarding. If not configured, the package will auto-discover it via the `loadCodeAssist` RPC.

```
CLOUDCODE_PA_PROJECT=your-project-id
```

### Models

[](#models)

Configure default models via environment variables:

```
CLOUDCODE_PA_DEFAULT_MODEL=claude-opus-4
CLOUDCODE_PA_CHEAPEST_MODEL=gemini-2.5-flash
CLOUDCODE_PA_SMARTEST_MODEL=claude-opus-4
CLOUDCODE_PA_RERANKING_MODEL=gemini-2.5-flash
```

Supported Models
----------------

[](#supported-models)

### Partner Models

[](#partner-models)

ModelAliasClaude Opus 4`claude-opus-4`Claude Sonnet 4.5`claude-sonnet-4-5`Claude Sonnet 4`claude-sonnet-4`Claude Haiku 4.5`claude-haiku-4-5`GPT-4.1`gpt-4-1`GPT OSS 120B`gpt-oss-120b-medium`### Gemini Models

[](#gemini-models)

ModelAliasGemini 3 Pro (preview)`gemini-3-pro-preview`Gemini 3 Flash (preview)`gemini-3-flash-preview`Gemini 2.5 Pro`gemini-2.5-pro`Gemini 2.5 Flash`gemini-2.5-flash`Gemini 2.5 Flash Lite`gemini-2.5-flash-lite`Gemini 2.0 Flash`gemini-2.0-flash`You can add custom model aliases in `config/cloudcode-pa.php` under the `models` key.

Usage
-----

[](#usage)

The provider name is `cloudcode-pa`. Use it with [Laravel AI](https://github.com/laravel/ai)'s standard API:

```
use Laravel\Ai\Ai;

// Text generation
$provider = Ai::textProvider('cloudcode-pa');

// Reranking
$provider = Ai::rerankingProvider('cloudcode-pa');
```

For the full API (text generation, streaming, multi-turn conversations, reranking), refer to the [Laravel AI documentation](https://github.com/laravel/ai).

Key Features
------------

[](#key-features)

### Model Cascade (Rate-Limit Fallback)

[](#model-cascade-rate-limit-fallback)

When a model returns `429 (Rate Limited)`, the gateway automatically cascades through a configurable fallback chain. Each step tries all configured endpoints before advancing to the next model.

Default cascade: `claude-opus-4` → `gemini-3-pro-preview` → `gemini-3-flash-preview` → `gemini-2.5-pro` → `gemini-2.5-flash`

Cascade only activates when using the default model — explicit model requests use endpoint fallback only.

```
CLOUDCODE_PA_CASCADE_ENABLED=true
```

Customize cascade steps in `config/cloudcode-pa.php`:

```
'cascade' => [
    'enabled' => true,
    'steps' => [
        'claude-opus-4',
        'gemini-2.5-pro',
        'gemini-2.5-flash',
    ],
],
```

### Multi-Endpoint Fallback

[](#multi-endpoint-fallback)

Multiple endpoints with independent quota pools are configured by default. On endpoint failure or rate limiting, the next endpoint is tried automatically. Endpoints are customizable in `config/cloudcode-pa.php`.

### Automatic Model Routing

[](#automatic-model-routing)

Partner models (Claude, GPT) and Gemini models use different API protocols. The package detects the model type and routes automatically — no configuration needed.

### Timeouts

[](#timeouts)

```
CLOUDCODE_PA_TIMEOUT=30            # Non-streaming requests (seconds)
CLOUDCODE_PA_STREAM_TIMEOUT=120    # SSE streaming requests (seconds)
CLOUDCODE_PA_CONNECT_TIMEOUT=10    # Connection timeout (seconds)
```

### Debug Logging

[](#debug-logging)

Enable request/response logging (credentials are always redacted):

```
CLOUDCODE_PA_DEBUG=true
```

Testing
-------

[](#testing)

```
composer test
```

License
-------

[](#license)

MIT

###  Health Score

33

—

LowBetter than 72% of packages

Maintenance80

Actively maintained with recent releases

Popularity1

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity40

Maturing project, gaining track record

 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

Every ~0 days

Total

2

Last Release

106d ago

PHP version history (2 changes)v0.1.0PHP ^8.2

v0.2.0PHP ^8.3

### Community

Maintainers

![](https://www.gravatar.com/avatar/5f96b569096c4e83801bb5111bb580266f73ccfc7a37dee6a1d8abaa4ad9296e?d=identicon)[iqbalhprahara](/maintainers/iqbalhprahara)

---

Top Contributors

[![iqbalhprahara](https://avatars.githubusercontent.com/u/144869794?v=4)](https://github.com/iqbalhprahara "iqbalhprahara (26 commits)")

---

Tags

laravelaiGeminicloudcode

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/ursamajeur-laravel-ai-gemini-driver/health.svg)

```
[![Health](https://phpackages.com/badges/ursamajeur-laravel-ai-gemini-driver/health.svg)](https://phpackages.com/packages/ursamajeur-laravel-ai-gemini-driver)
```

###  Alternatives

[laravel/ai

The official AI SDK for Laravel.

9782.1M162](/packages/laravel-ai)[psalm/plugin-laravel

Psalm plugin for Laravel

3345.1M337](/packages/psalm-plugin-laravel)[defstudio/telegraph

A laravel facade to interact with Telegram Bots

815320.5k3](/packages/defstudio-telegraph)[moonshine/moonshine

Laravel administration panel

1.3k239.9k76](/packages/moonshine-moonshine)[neuron-core/neuron-laravel

Official Neuron AI Laravel SDK.

11125.7k](/packages/neuron-core-neuron-laravel)[codebar-ag/laravel-docuware

DocuWare integration with Laravel

1122.7k](/packages/codebar-ag-laravel-docuware)

PHPackages © 2026

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