Download the PHP package rodiumai/laravel-sdk without Composer
On this page you can find all versions of the php package rodiumai/laravel-sdk. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package laravel-sdk
rodiumai/laravel-sdk
Official PHP / Laravel SDK for the Rodium AI API — unified access to AI models (OpenAI, Anthropic, Google, DeepSeek…) with RODI credit billing and Mobile Money top-ups.
OpenAI-compatible REST API: same endpoints and payloads as documented at rodiumai.io/docs.
Links
| Resource | URL |
|---|---|
| Packagist | packagist.org/packages/rodiumai/laravel-sdk |
| Source code | github.com/Docteur-Parfait/rodiumai-laravel-sdk |
| Laravel SDK guide | rodiumai.io/docs/guides/laravel-sdk |
| API documentation | rodiumai.io/docs |
| Dashboard & API keys | rodiumai.io/dashboard |
Table of contents
- Requirements
- Installation
- Configuration
- Quick start
- Chat completions
- Streaming & real-time chat (SSE)
- Models catalogue
- Embeddings
- Images (
POST /v1/images/generations) - Videos (
POST /v1/videos/generations) - Audio
- Anthropic Messages
- Wallet & pricing
- Error handling
- SDK reference
- Local development
- Migration 0.1.x → 0.2.0
- Testing
- License
Requirements
- PHP 8.1+ with the
jsonextension - Laravel 10–13 (optional —
RodiumAIClientworks in plain PHP) - Rodium AI account + API key (
rd_sk_…): dashboard
Installation
Publish config (optional):
The ServiceProvider and RodiumAI Facade are auto-discovered.
Configuration
.env:
| Variable | Default | Description |
|---|---|---|
RODIUMAI_API_KEY |
— | Secret key from the dashboard |
RODIUMAI_BASE_URL |
https://api.rodiumai.io/v1 |
Gateway base URL (use http://localhost:8001/v1 locally) |
RODIUMAI_DEFAULT_MODEL |
openai/gpt-4o |
Default model slug |
RODIUMAI_TIMEOUT |
30 |
HTTP timeout in seconds |
RODIUMAI_LOCALE |
en |
Localized exception hints |
Never commit .env or API keys.
Quick start
Laravel (Facade)
Plain PHP
Chat completions
POST /v1/chat/completions — OpenAI-compatible. All OpenAI fields pass-through (tools, response_format, …).
Parameters
| Parameter | Required | Description |
|---|---|---|
model |
yes | Catalogue slug or smart alias (rodiumai/smart, rodium/fast, …) |
messages |
yes | String, ChatMessage objects, or arrays |
max_tokens, temperature, top_p |
no | Decoding |
stream |
no | SSE streaming |
tools, tool_choice |
no | Function calling |
response_format |
no | JSON mode / schema |
session_id |
no | Custom models memory |
Multi-turn conversation
Multimodal vision
HTTP(S) image URLs work in chat (not in image/video generation).
Function calling
Smart routing
| Alias | Behavior |
|---|---|
rodiumai/smart |
LLM router — metadata in $response->routing() |
rodium/fast, rodium/pro, … |
Rule-based profiles |
See Smart routing guide.
Streaming & real-time chat (SSE)
No WebSocket — real-time discussion uses SSE only.
Real-time chat loop
Laravel StreamedResponse
Models catalogue
Each model includes rodiumai_pricing, rodiumai_capabilities (modalities, streaming, tools, vision).
Embeddings
POST /v1/embeddings
Images (POST /v1/images/generations)
| Parameter | Required | Notes |
|---|---|---|
model, prompt |
yes | |
n |
no | 1–10 (Imagen max 4) |
size |
no | 1024x1024, 1536x1024, … |
quality |
no | Affects RODI quote |
aspect_ratio |
no | Gemini |
image, images |
no | i2i — up to 14 refs |
mask |
no | OpenAI inpainting |
Reference images: base64, data URL, or gs:// — no remote HTTP fetch.
Text-to-image
Image-to-image
Inpainting
Videos (POST /v1/videos/generations)
Always pass 'timeout' => 600 — jobs can take minutes.
| Parameter | Required | Notes |
|---|---|---|
model, prompt |
yes | |
duration_seconds |
no | Default 8; Sora → 4/8/12 s |
aspect_ratio, size |
no | Sora layout |
image |
no | Start frame (image→video) |
last_frame |
no | End frame (Veo interpolation) |
Text-to-video
Image-to-video
Interpolation (Veo)
Audio
Transcriptions — multipart
| Parameter | Required | Notes |
|---|---|---|
file |
yes | File path |
model |
yes | |
language |
no | ISO-639-1 (fr, en) |
prompt |
no | Style hint |
response_format |
no | json, text, verbose_json |
Speech — binary response
| Parameter | Required | Notes |
|---|---|---|
model, input |
yes | |
voice |
no | alloy, echo, fable, onyx, nova, shimmer |
response_format |
no | mp3, opus, wav, pcm |
speed |
no | 0.25–4.0 |
Anthropic Messages
POST /v1/messages
Streaming: 'stream' => true — Anthropic SSE events.
Wallet & pricing
Error handling
See docs/api/errors.
| HTTP | Exception | Notes |
|---|---|---|
| 401 | UnauthorizedException |
Invalid or missing API key |
| 402 | InsufficientCreditsException |
Top up RODI in dashboard |
| 403 | ForbiddenException |
Scope or model whitelist |
| 404 | NotFoundException |
Unknown model or resource |
| 422 | ValidationException |
Invalid request body |
| 429 | RateLimitException |
Use $e->retryAfter() for backoff |
| Other | RodiumAIException |
$e->errorCode(), $e->responseBody() |
SDK reference
| Method | Returns | Gateway route |
|---|---|---|
chat($messages, $options) |
ChatResponse |
POST /v1/chat/completions |
stream($messages, $options) |
Generator<string> |
POST /v1/chat/completions (SSE) |
models() |
ModelCollection |
GET /v1/models |
modelInfo($id) |
ModelInfo |
GET /v1/models/{id} |
codingModels() |
ModelCollection |
GET /v1/models/coding |
embeddings($input, $options) |
EmbeddingResponse |
POST /v1/embeddings |
images($options) |
ImageResponse |
POST /v1/images/generations |
videos($options) |
VideoResponse |
POST /v1/videos/generations |
transcribe($filePath, $options) |
TranscriptionResponse |
POST /v1/audio/transcriptions |
speech($options) |
string (bytes) |
POST /v1/audio/speech |
messages($options) |
MessageResponse |
POST /v1/messages |
wallet() |
WalletResponse |
GET /v1/wallet |
pricing($model?) |
PricingCollection |
GET /v1/pricing |
Fluent builder: model(), temperature(), topP(), maxTokens(), systemPrompt(), language().
DTOs: ChatResponse, ChatMessage, ModelInfo, ModelCollection, EmbeddingResponse, ImageResponse, VideoResponse, TranscriptionResponse, MessageResponse, WalletResponse, PricingCollection.
Technical mapping: docs/api-alignment.md.
Local development
Point the SDK at a local gateway (e.g. Docker Compose on port 8001):
Migration 0.1.x → 0.2.0
| Change | Action |
|---|---|
base_url restored |
Set RODIUMAI_BASE_URL if not using production |
| Static enums removed | Use models() / ModelCollection for catalogue |
ModelInfo::contextWindow |
Now reads rodiumai_capabilities.context_window (gateway shape) |
| New methods | embeddings, images, videos, transcribe, speech, messages, wallet, pricing |
Require ^0.2 in composer.json.
Testing
License
MIT — see LICENSE.
All versions of laravel-sdk with dependencies
guzzlehttp/guzzle Version ^7.0
illuminate/support Version ^8.0|^9.0|^10.0|^11.0|^12.0|^13.0