PHPackages                             moritz-sauer-13/silverstripe-ai-alt-text - 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. [Image &amp; Media](/categories/media)
4. /
5. moritz-sauer-13/silverstripe-ai-alt-text

ActiveSilverstripe-vendormodule[Image &amp; Media](/categories/media)

moritz-sauer-13/silverstripe-ai-alt-text
========================================

Generate alt text for images via OpenAI Api

1.0(3mo ago)04BSD-3-ClausePHP

Since Feb 9Pushed 3mo agoCompare

[ Source](https://github.com/moritz-sauer-13/silverstripe-ai-alt-text)[ Packagist](https://packagist.org/packages/moritz-sauer-13/silverstripe-ai-alt-text)[ RSS](/packages/moritz-sauer-13-silverstripe-ai-alt-text/feed)WikiDiscussions main Synced 1mo ago

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

SilverStripe AI Alt Text
========================

[](#silverstripe-ai-alt-text)

Generates alt texts for images via OpenAI Vision API. Integrates seamlessly into the SilverStripe 6 CMS AssetAdmin — a native FormAction button triggers AI-based generation and saves the result directly.

Requires [purplespider/asset-alt-text](https://github.com/purplespider/silverstripe-asset-alt-text) for the `AltText` field on Image assets.

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

[](#requirements)

- SilverStripe Framework ^6
- purplespider/asset-alt-text ^3
- openai-php/client ^0.18.0
- PHP 8.1+

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

[](#installation)

```
composer require moritz-sauer-13/silverstripe-ai-alt-text
```

Then run:

```
vendor/bin/sake dev/build flush=1
```

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

[](#configuration)

### API Key (required)

[](#api-key-required)

Set the OpenAI API key via environment variable (recommended) or YAML config.

**Option 1: Environment variable** (`.env` file or server config)

```
OPENAI_API_KEY="sk-your-api-key-here"

```

**Option 2: YAML config** (`app/_config/ai-alt-text.yml`)

```
AiAltText\Service\OpenAiVisionClient:
  api_key: 'sk-your-api-key-here'
```

> **Note:** Environment variables take precedence over YAML config.

### Optional Configuration

[](#optional-configuration)

```
# Model selection (default: gpt-4o-mini)
AiAltText\Service\OpenAiVisionClient:
  model: 'gpt-4o'
  max_tokens: 300

# Image resize limits before sending to OpenAI (default: 1024x1024)
AiAltText\Service\AltTextGenerator:
  max_image_width: 1024
  max_image_height: 1024
```

### Custom Prompt (SiteConfig)

[](#custom-prompt-siteconfig)

The AI prompt can be customized directly in the CMS:

1. Go to **Settings** in the CMS
2. Click on the **AI Alt Text** tab
3. Enter your custom prompt in the text field
4. Save

The custom prompt allows you to:

- Set the output language directly (e.g., "Write in German" or "Schreibe auf Deutsch")
- Customize the style and length of generated alt texts
- Add specific instructions for your content type

**Example custom prompt (German):**

```
Schreibe einen prägnanten, beschreibenden Alt-Text für dieses Bild auf Deutsch.

Regeln:
- Länge: 80-160 Zeichen, kürzer bei einfachen Bildern.
- Sei spezifisch und beschreibend.
- Beginne nicht mit "Bild von", "Foto von" oder ähnlichen Phrasen.
- Keine Marketing-Sprache.
- Gib NUR den Alt-Text zurück, nichts anderes.

```

Leave the field empty to use the default English prompt.

License
-------

[](#license)

BSD-3-Clause

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance82

Actively maintained with recent releases

Popularity3

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity35

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 ~0 days

Total

2

Last Release

93d ago

Major Versions

0.1 → 1.02026-02-09

### Community

Maintainers

![](https://www.gravatar.com/avatar/237ff98c98e71b509c4dac62b31efaf7823cca011952ded67579a6cf763b7a47?d=identicon)[moritz-sauer-13](/maintainers/moritz-sauer-13)

---

Top Contributors

[![moritz-sauer-13](https://avatars.githubusercontent.com/u/43135946?v=4)](https://github.com/moritz-sauer-13 "moritz-sauer-13 (3 commits)")

---

Tags

silverstripeiconalt textimage analysis

### Embed Badge

![Health badge](/badges/moritz-sauer-13-silverstripe-ai-alt-text/health.svg)

```
[![Health](https://phpackages.com/badges/moritz-sauer-13-silverstripe-ai-alt-text/health.svg)](https://phpackages.com/packages/moritz-sauer-13-silverstripe-ai-alt-text)
```

###  Alternatives

[heyday/silverstripe-responsive-images

Configure and send a series of image size options to the client without loading any resources until a media query can be executed.

5387.7k6](/packages/heyday-silverstripe-responsive-images)[chrometoaster/silverstripe-image-quality

Adds Quality function to images

1013.0k1](/packages/chrometoaster-silverstripe-image-quality)[dnadesign/silverstripe-lazyloaded-image

Implements the LQIP (Low Quality Image Placeholder) pattern powered by lazysizes

1011.4k4](/packages/dnadesign-silverstripe-lazyloaded-image)

PHPackages © 2026

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