PHPackages                             rodiumai/laravel-sdk - 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. rodiumai/laravel-sdk

ActiveLibrary[API Development](/categories/api)

rodiumai/laravel-sdk
====================

Laravel/PHP SDK for the RodiumAI API — multi-model AI with Mobile Money payments

v0.1.2(1mo ago)63MITPHPPHP ^8.1CI failing

Since Jun 1Pushed 1mo agoCompare

[ Source](https://github.com/lecodeur228/rodiumai-laravel-sdk)[ Packagist](https://packagist.org/packages/rodiumai/laravel-sdk)[ Docs](https://www.rodiumai.io/docs)[ RSS](/packages/rodiumai-laravel-sdk/feed)WikiDiscussions main Synced 1w ago

READMEChangelogDependencies (11)Versions (4)Used By (0)

rodiumai/laravel-sdk
====================

[](#rodiumailaravel-sdk)

Official PHP / Laravel SDK for the [Rodium AI](https://www.rodiumai.io) API — unified access to AI models (OpenAI, Anthropic, Google, DeepSeek, MiniMax…) with **RODI** credit billing and **Mobile Money** top-ups.

> **OpenAI-compatible** REST API: same endpoints and payloads as documented at [rodiumai.io/docs](https://www.rodiumai.io/docs).

[![Latest Version on Packagist](https://camo.githubusercontent.com/2fd068ed32be3c4e63b9534d483640dd143755789b4b8cd811950d1fa2ba2de4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f726f6469756d61692f6c61726176656c2d73646b2e737667)](https://packagist.org/packages/rodiumai/laravel-sdk)[![Total Downloads](https://camo.githubusercontent.com/8ad390e901df133c235b909fe378edbfa570b761bce67546bff23a4be1b1c21a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f726f6469756d61692f6c61726176656c2d73646b2e737667)](https://packagist.org/packages/rodiumai/laravel-sdk)[![PHP Version](https://camo.githubusercontent.com/a60c485b7fccda9d1dd762916694d35bada8974c454340ca351691d8957e6d05/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f726f6469756d61692f6c61726176656c2d73646b2e737667)](https://packagist.org/packages/rodiumai/laravel-sdk)[![License: MIT](https://camo.githubusercontent.com/784362b26e4b3546254f1893e778ba64616e362bd6ac791991d2c9e880a3a64e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d677265656e2e737667)](LICENSE)[![Tests](https://github.com/lecodeur228/rodiumai-laravel-sdk/actions/workflows/tests.yml/badge.svg)](https://github.com/lecodeur228/rodiumai-laravel-sdk/actions)

Links
-----

[](#links)

ResourceURL**Packagist** (Composer install)[packagist.org/packages/rodiumai/laravel-sdk](https://packagist.org/packages/rodiumai/laravel-sdk)**Source code**[github.com/lecodeur228/rodiumai-laravel-sdk](https://github.com/lecodeur228/rodiumai-laravel-sdk)**API documentation**[rodiumai.io/docs](https://www.rodiumai.io/docs)**Dashboard &amp; API keys**[rodiumai.io/dashboard](https://www.rodiumai.io/dashboard)**Model catalogue**[rodiumai.io/models](https://www.rodiumai.io/models)Table of contents
-----------------

[](#table-of-contents)

- [Official documentation](#official-documentation)
- [Requirements](#requirements)
- [Installation](#installation)
- [Configuration](#configuration)
- [Quick start](#quick-start)
- [Dynamic models (API)](#dynamic-models-api)
- [Multilingual](#multilingual)
- [Chat parameters](#chat-parameters)
- [Streaming (SSE)](#streaming-sse)
- [Listing models](#listing-models)
- [Error handling](#error-handling)
- [SDK reference](#sdk-reference)
- [Testing &amp; development](#testing--development)
- [Contributing](#contributing)
- [License](#license)

Official documentation
----------------------

[](#official-documentation)

TopicRodium AI linkQuickstart[rodiumai.io/docs](https://www.rodiumai.io/docs)API overview[docs/api/overview](https://www.rodiumai.io/docs/api/overview)Chat completions[docs/api/chat-completions](https://www.rodiumai.io/docs/api/chat-completions)Streaming SSE[docs/api/streaming](https://www.rodiumai.io/docs/api/streaming)Models[docs/api/models](https://www.rodiumai.io/docs/api/models) · [Catalogue](https://www.rodiumai.io/models)HTTP errors[docs/api/errors](https://www.rodiumai.io/docs/api/errors)Detailed SDK ↔ API mapping: [docs/api-alignment.md](docs/api-alignment.md).

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

[](#requirements)

- PHP **8.1+** with the `json` extension
- Laravel **10**, **11**, **12**, or **13** (optional — the client works in plain PHP)
- Laravel **12+**: PHP **8.2+** → use **`^0.1.1`** minimum
- Rodium AI account + API key: [dashboard](https://www.rodiumai.io/dashboard)

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

[](#installation)

Install from **[Packagist](https://packagist.org/packages/rodiumai/laravel-sdk)**:

```
composer require rodiumai/laravel-sdk
```

For **Laravel 12 and 13** (PHP 8.2+):

```
composer require rodiumai/laravel-sdk:^0.1.1
```

### After installation

[](#after-installation)

1. Publish config (optional but recommended):

```
php artisan vendor:publish --tag=rodiumai-config
```

2. Add your API key to `.env` (see [Configuration](#configuration)).
3. The `ServiceProvider` and `RodiumAI` Facade are **auto-discovered** — nothing to register in `bootstrap/providers.php`.

### Plain PHP (no Laravel)

[](#plain-php-no-laravel)

Same Composer command. Then instantiate `RodiumAI\RodiumAIClient` directly (see [Quick start](#quick-start)).

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

[](#configuration)

`.env` file:

```
RODIUMAI_API_KEY=rd_sk_your_secret_key
RODIUMAI_DEFAULT_MODEL=openai/gpt-4o
RODIUMAI_TIMEOUT=30
# RODIUMAI_LOCALE=fr   # optional — SDK error hints only
```

The SDK always uses `https://api.rodiumai.io/v1` (not configurable).

Never commit `.env` or API keys to the repository.

Quick start
-----------

[](#quick-start)

### Laravel (Facade)

[](#laravel-facade)

```
use RodiumAI\Facades\RodiumAI;

$catalogue = RodiumAI::models();
$modelId = $catalogue->chatModels()[0]->id;

$response = RodiumAI::model($modelId)
    ->temperature(0.7)
    ->maxTokens(300)
    ->chat('Explain Rodium AI in two sentences.');

echo $response->content;
```

### Plain PHP

[](#plain-php)

```
use RodiumAI\RodiumAIClient;

$client = new RodiumAIClient(apiKey: getenv('RODIUMAI_API_KEY'));

$catalogue = $client->models();
$modelId = $catalogue->chatModels()[0]->id;

$response = $client->model($modelId)->chat('Hello!');

echo $response->content;
```

Equivalent to the [cURL / OpenAI SDK quickstart](https://www.rodiumai.io/docs): `POST https://api.rodiumai.io/v1/chat/completions` with `Authorization: Bearer {RODIUMAI_API_KEY}`.

Dynamic models (API)
--------------------

[](#dynamic-models-api)

Models are fetched live from [GET /v1/models](https://www.rodiumai.io/docs/api/models) — always up to date with the platform catalogue:

```
$catalogue = RodiumAI::models();

$catalogue->ids();                    // all model IDs
$catalogue->chatModels();             // text/chat-capable only
$catalogue->providerPrefixes();       // ['anthropic', 'google', 'openai', …]
$catalogue->byProvider('anthropic');  // filter by provider prefix
$catalogue->findById('openai/gpt-4o'); // ?ModelInfo

foreach ($catalogue->chatModels() as $info) {
    echo $info->id . ' — ' . $info->contextWindow . PHP_EOL;
}
```

Pass any `id` from the API to `->model('openai/gpt-4o')`.

Multilingual (optional)
-----------------------

[](#multilingual-optional)

Language is **never required**. By default, SDK error hints are in English and the AI follows the user's message language.

**Optional** — localized error hints via config:

```
RODIUMAI_LOCALE=fr
```

**Optional** — force AI responses in a specific language:

```
RodiumAI::language('fr')  // only when you need it
    ->model('openai/gpt-4o')
    ->chat('Bonjour !');
```

Supported: `en` (default), `fr`, `es`.

Chat parameters
---------------

[](#chat-parameters)

Aligned with [chat-completions](https://www.rodiumai.io/docs/api/chat-completions):

API parameterSDK`model``->model('openai/gpt-4o')` / `$options['model']` / IDs from `models()``messages`Array of `{role, content}` or `string` (→ `user` message)`max_tokens``->maxTokens()` / `$options['max_tokens']``temperature` (0–2)`->temperature()` / `$options['temperature']``top_p` (0–1)`->topP()` / `$options['top_p']``stop``$options['stop']``stream`Set automatically by `->stream()````
use RodiumAI\Data\ChatMessage;

$messages = [
    ChatMessage::system('You are a Laravel assistant.'),
    ChatMessage::user('What is a Service Provider?'),
];

$response = RodiumAI::model('openai/gpt-4o')
    ->temperature(0.5)
    ->topP(0.9)
    ->maxTokens(500)
    ->chat($messages);
```

Streaming (SSE)
---------------

[](#streaming-sse)

Follows [docs/api/streaming](https://www.rodiumai.io/docs/api/streaming): `data: …` lines, end with `data: [DONE]`.

```
foreach (RodiumAI::model('openai/gpt-4o')->stream('Tell a short story.') as $delta) {
    echo $delta;
}
```

### Laravel — `StreamedResponse`

[](#laravel--streamedresponse)

```
use Illuminate\Http\Request;
use Symfony\Component\HttpFoundation\StreamedResponse;
use RodiumAI\Facades\RodiumAI;

public function streamChat(Request $request): StreamedResponse
{
    return response()->stream(function () use ($request) {
        foreach (RodiumAI::stream($request->string('message')) as $delta) {
            echo 'data: ' . json_encode(['delta' => $delta]) . "\n\n";
            ob_flush();
            flush();
        }
        echo "data: [DONE]\n\n";
    }, 200, [
        'Content-Type' => 'text/event-stream',
        'Cache-Control' => 'no-cache',
        'X-Accel-Buffering' => 'no',
    ]);
}
```

Listing models
--------------

[](#listing-models)

`GET /v1/models` — RODI pricing and metadata:

```
$models = RodiumAI::models();

foreach ($models->ids() as $id) {
    echo $id . PHP_EOL;
}

$anthropic = $models->byProvider('anthropic');
```

Error handling
--------------

[](#error-handling)

See [docs/api/errors](https://www.rodiumai.io/docs/api/errors).

HTTPSDK exceptionSuggested action401`UnauthorizedException`Check `RODIUMAI_API_KEY`402`InsufficientCreditsException`Top up RODI credits (dashboard)429`RateLimitException`Exponential backoff, then retry422`ValidationException`Fix `model` / `messages`500+`RodiumAIException`Retry once, then contact support```
use RodiumAI\Exceptions\InsufficientCreditsException;
use RodiumAI\Exceptions\RodiumAIException;
use RodiumAI\Facades\RodiumAI;

try {
    $response = RodiumAI::chat('Test');
} catch (InsufficientCreditsException $e) {
    logger()->warning('Insufficient RODI', ['body' => $e->responseBody()]);
} catch (RodiumAIException $e) {
    logger()->error('Rodium AI', ['code' => $e->getCode(), 'body' => $e->responseBody()]);
}
```

SDK reference
-------------

[](#sdk-reference)

MethodReturnsDescription`chat($messages, $options = [])``ChatResponse`Non-streaming completion`stream($messages, $options = [])``Generator`SSE text deltas`models()``ModelCollection`Catalogue + pricing`model($id)``static`Fluent: model`temperature($f)``static`Fluent: 0–2`topP($f)``static`Fluent: 0–1`maxTokens($n)``static`Fluent: token limit`systemPrompt($s)``static`Fluent: system messageDTOs: `ChatResponse`, `ChatMessage`, `ModelCollection`.

Versions
--------

[](#versions)

VersionNotes**v0.1.1**Laravel 12 support (`illuminate/support` ^12)**v0.1.0**Initial release: chat, stream, models, enums, FacadeFull history: [CHANGELOG.md](CHANGELOG.md).

Testing &amp; development
-------------------------

[](#testing--development)

```
composer install
composer test                 # PHPUnit (mocked HTTP)
export RODIUMAI_API_KEY="…"
php bin/smoke-test.php        # Live API walkthrough in the terminal
```

Contributing
------------

[](#contributing)

See [CONTRIBUTING.md](CONTRIBUTING.md) and [docs/architecture.md](docs/architecture.md).

Maintainers: [docs/PUBLISHING.md](docs/PUBLISHING.md) (tags, Packagist).

License
-------

[](#license)

MIT — see [LICENSE](LICENSE).

###  Health Score

37

—

LowBetter than 81% of packages

Maintenance93

Actively maintained with recent releases

Popularity9

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity34

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

Every ~6 days

Total

3

Last Release

42d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/92242447?v=4)[irin](/maintainers/lecodeur228)[@lecodeur228](https://github.com/lecodeur228)

---

Top Contributors

[![lecodeur228](https://avatars.githubusercontent.com/u/92242447?v=4)](https://github.com/lecodeur228 "lecodeur228 (8 commits)")

---

Tags

laravelsdkaiopenaiclaudellmChatGptafricarodiumai

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/rodiumai-laravel-sdk/health.svg)

```
[![Health](https://phpackages.com/badges/rodiumai-laravel-sdk/health.svg)](https://phpackages.com/packages/rodiumai-laravel-sdk)
```

###  Alternatives

[openai-php/laravel

OpenAI PHP for Laravel is a supercharged PHP API client that allows you to interact with the Open AI API

3.7k9.5M90](/packages/openai-php-laravel)[statamic/cms

The Statamic CMS Core Package

4.8k3.6M1.0k](/packages/statamic-cms)[mozex/anthropic-laravel

Laravel integration for the Anthropic API: facade, config publishing, install command, testing fakes, messages, streaming, tool use, thinking, and batches.

74331.3k1](/packages/mozex-anthropic-laravel)[eslazarev/wildberries-sdk

Wildberries OpenAPI clients (generated).

293.1k](/packages/eslazarev-wildberries-sdk)[claude-php/claude-php-sdk-laravel

Laravel integration for the Claude PHP SDK - Anthropic Claude API

5223.2k](/packages/claude-php-claude-php-sdk-laravel)[sbsaga/toon

🧠 TOON for Laravel — a compact, human-readable, and token-efficient data format for AI prompts &amp; LLM contexts. Perfect for ChatGPT, Gemini, Claude, Mistral, and OpenAI integrations (JSON ⇄ TOON).

6753.8k](/packages/sbsaga-toon)

PHPackages © 2026

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