PHPackages                             mmorand/laravel-apertus - 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. mmorand/laravel-apertus

ActiveLibrary[API Development](/categories/api)

mmorand/laravel-apertus
=======================

Laravel package for the Swiss made Apertus LLM

0.1.1(7mo ago)2222MITPHPPHP ^8.3

Since Sep 22Pushed 7mo ago1 watchersCompare

[ Source](https://github.com/mmorand/laravel-apertus)[ Packagist](https://packagist.org/packages/mmorand/laravel-apertus)[ Docs](https://github.com/mmorand/laravel-apertus)[ RSS](/packages/mmorand-laravel-apertus/feed)WikiDiscussions main Synced 1mo ago

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

[![Apertus Logo](./assets/images/header.png)](./assets/images/header.png)

Laravel Client for Apertus LLM
==============================

[](#laravel-client-for-apertus-llm)

[![Latest Version on Packagist](https://camo.githubusercontent.com/d8d96244ebdc0e28a142da5c6f352afe1e1486c2f0636d155d7402ad9ba1927d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d6d6f72616e642f6c61726176656c2d617065727475732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/mmorand/laravel-apertus)[![Total Downloads](https://camo.githubusercontent.com/ea27fb3178fa896a8496a606684b6a79deb7116ea3a50dcfbcc742750a494255/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d6d6f72616e642f6c61726176656c2d617065727475732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/mmorand/laravel-apertus)

The Apertus AI PHP Client enables seamless integration with the Apertus AI API, providing straightforward access to Swiss AI models for chat completions and model management.

More informations about Apertus AI can be found on their [website](https://www.swiss-ai.org/apertus) and [API Reference](https://platform.publicai.co/api).

Features
--------

[](#features)

- ✅ **Chat Completions** - Full conversation support with streaming
- ✅ **Model Management** - List available models
- ✅ **Laravel Integration** - Native Laravel support with Facades
- ✅ **Type Safety** - Fully typed DTOs using Spatie Laravel Data
- ✅ **Modern PHP** - Built with PHP 8.3+ and Saloon HTTP client

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

[](#installation)

You can install the package via Composer:

```
composer require mmorand/laravel-apertus
```

You can publish the config file with:

```
php artisan vendor:publish --tag="apertus-config"
```

This is the contents of the published config file:

```
return [
    'api_key' => env('APERTUS_API_KEY'),
    'base_url' => env('APERTUS_BASE_URL', 'https://api.publicai.co'),
    'user_agent' => env('APERTUS_USER_AGENT', 'Apertus-Laravel-Client/1.0.0'),
    'timeout' => env('APERTUS_TIMEOUT', 60),
];
```

Add your Apertus API key to your `.env` file:

```
APERTUS_API_KEY=your_api_key_here
APERTUS_BASE_URL=https://api.publicai.co
APERTUS_USER_AGENT=MyApp/1.0
APERTUS_TIMEOUT=30
```

Get your API key from the [Apertus AI Console](https://platform.publicai.co/settings/api-keys).

Usage
-----

[](#usage)

### Basic Setup

[](#basic-setup)

Create an instance of the Apertus client to start interacting with the API:

```
use Mmorand\Apertus\Apertus;
use Mmorand\Apertus\Enums\Model;

// Instantiate the client
$apertus = new Apertus(
    apiKey: config('apertus.api_key'),
    baseUrl: 'https://api.publicai.co',
    userAgent: 'MyApp/1.0'
);

// Or use the Facade (Laravel)
use Mmorand\Apertus\Facades\Apertus;

Apertus::chat();
Apertus::models();
```

### Chat Completions

[](#chat-completions)

Create a chat completion:

```
use Mmorand\Apertus\Facades\Apertus;
use Mmorand\Apertus\Enums\Model;

$response = Apertus::chat()->create(
    model: Model::apertus8b,
    messages: [
        [
            'role' => 'user',
            'content' => 'Hello! Can you help me understand Swiss AI?',
        ]
    ],
    temperature: 0.7,
    maxTokens: 1000
);

/** @var \Mmorand\Apertus\Dto\Chat\ChatCompletionResponse $dto */
$dto = $response->dto();
```

### Model Management

[](#model-management)

List available models:

```
$response = Apertus::models()->list();

/** @var \Mmorand\Apertus\Dto\Models\ModelsResponse $dto */
$dto = $response->dto();
```

### Artisan Commands

[](#artisan-commands)

List available models using Artisan:

```
php artisan apertus:models
```

### Available Models

[](#available-models)

The following models are available in the Apertus API. You can use the `Model` enum in this package to refer to them.

Enum CaseModel NameDocumentation Link`Model::apertus8b``'swiss-ai/apertus-8b-instruct'`[Apertus 8b Docs](https://huggingface.co/swiss-ai/Apertus-8B-Instruct-2509)`Model::apertus70b``'swiss-ai/apertus-70b-instruct'`[Apertus 70b Docs](https://huggingface.co/swiss-ai/Apertus-70B-Instruct-2509)```
use Mmorand\Apertus\Enums\Model;

Model::apertus8b  // swiss-ai/apertus-8b-instruct - Small Apertus model
Model::apertus70b // swiss-ai/apertus-70b-instruct - Complete Apertus model
```

Testing
-------

[](#testing)

Run the tests with:

```
composer test
```

Static Analysis
---------------

[](#static-analysis)

Analyze code with PHPStan:

```
composer analyse
```

Code Style
----------

[](#code-style)

Fix code style with Laravel Pint:

```
composer format
```

Inspired by the excellent work of [HelgeSverre](https://github.com/HelgeSverre) with his [Mistral package](https://github.com/HelgeSverre/mistral).

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

Disclaimer
----------

[](#disclaimer)

Apertus AI and the Apertus logo are trademarks of their respective owners. This package is not affiliated with, endorsed by, or sponsored by Apertus AI. All trademarks and registered trademarks are the property of their respective owners.

See the [Terms and Conditions](https://publicai.co/tc) for more information.

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance62

Regular maintenance activity

Popularity17

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity42

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

239d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/fcb79bd1488375dff09981253546cb3883aaf5ca8e1cf9fde0d6e369ed1f2e46?d=identicon)[mmorand](/maintainers/mmorand)

---

Top Contributors

[![mmorand](https://avatars.githubusercontent.com/u/8851737?v=4)](https://github.com/mmorand "mmorand (11 commits)")

---

Tags

phpapilaravelaichatllmapertus

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/mmorand-laravel-apertus/health.svg)

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

###  Alternatives

[deepseek-php/deepseek-php-client

deepseek PHP client is a robust and community-driven PHP client library for seamless integration with the Deepseek API, offering efficient access to advanced AI and data processing capabilities.

47073.9k5](/packages/deepseek-php-deepseek-php-client)[gemini-api-php/laravel

Gemini API client for Laravel

8915.7k](/packages/gemini-api-php-laravel)[claude-php/claude-php-sdk-laravel

Laravel integration for the Claude PHP SDK - Anthropic Claude API

5010.8k](/packages/claude-php-claude-php-sdk-laravel)

PHPackages © 2026

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