PHPackages                             xmon-org/ai-content-bundle - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. xmon-org/ai-content-bundle

ActiveSymfony-bundle[Utility &amp; Helpers](/categories/utility)

xmon-org/ai-content-bundle
==========================

Symfony bundle for AI content generation (text and images) with provider fallback

1.12.0(4mo ago)01MITPHPPHP &gt;=8.2CI passing

Since Dec 21Pushed 4mo agoCompare

[ Source](https://github.com/xmon-org/ai-content-bundle)[ Packagist](https://packagist.org/packages/xmon-org/ai-content-bundle)[ RSS](/packages/xmon-org-ai-content-bundle/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (9)Versions (20)Used By (0)

xmon-org/ai-content-bundle
==========================

[](#xmon-orgai-content-bundle)

[![Latest Version on Packagist](https://camo.githubusercontent.com/c482204e7bc4296511a2c67a7cbd92ff328470e4a37590f7b286b68a0f97173a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f786d6f6e2d6f72672f61692d636f6e74656e742d62756e646c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/xmon-org/ai-content-bundle)[![PHP Version](https://camo.githubusercontent.com/b1b641cde5f79c9ae721c59287625d310fc6a922abf7466ae2b55c138f74fd78/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f786d6f6e2d6f72672f61692d636f6e74656e742d62756e646c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/xmon-org/ai-content-bundle)[![Symfony](https://camo.githubusercontent.com/db84d533331cb9d6b54e99ff425d6b08cda8c483a61f88c19bfe7f754b46c085/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f53796d666f6e792d372e782d707572706c652e7376673f7374796c653d666c61742d737175617265266c6f676f3d73796d666f6e79)](https://symfony.com)[![Total Downloads](https://camo.githubusercontent.com/15721466b5b744fa8cb010776be397ab7872f00e73315eb73452df431865a9ec/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f786d6f6e2d6f72672f61692d636f6e74656e742d62756e646c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/xmon-org/ai-content-bundle)[![License](https://camo.githubusercontent.com/9e224c3737fcccdde539d715671ddb323ebe4d62eb13013dd1b2408f4d1c4be8/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f786d6f6e2d6f72672f61692d636f6e74656e742d62756e646c652e7376673f7374796c653d666c61742d737175617265)](https://github.com/xmon-org/ai-content-bundle/blob/main/LICENSE)

[![CI](https://github.com/xmon-org/ai-content-bundle/actions/workflows/ci.yml/badge.svg)](https://github.com/xmon-org/ai-content-bundle/actions/workflows/ci.yml)[![semantic-release](https://camo.githubusercontent.com/e54d898d208c4f040bc3c1d54543286bf79d714d85262afd247e8c0ca1cbc798/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f73656d616e7469632d2d72656c656173652d636f6e76656e74696f6e616c636f6d6d6974732d6531303037393f6c6f676f3d73656d616e7469632d72656c65617365)](https://github.com/semantic-release/semantic-release)[![Pollinations.ai](https://camo.githubusercontent.com/90b2ed75515984dfba0c8a19270379359c7eeeef139c08929e67b800674dac74/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4149253230476174657761792d506f6c6c696e6174696f6e732e61692d3030643461613f7374796c653d666c61742d737175617265266c6f676f3d646174613a696d6167652f7376672b786d6c3b6261736536342c50484e325a79423462577875637a30696148523063446f764c336433647935334d793576636d63764d6a41774d43397a646d6369494864705a48526f505349794e434967614756705a326830505349794e434967646d6c6c64304a76654430694d43417749444930494449304969426d6157787350534a3361476c305a53492b50474e70636d4e735a53426a654430694d54496949474e35505349784d694967636a30694d5441694c7a34384c334e325a7a343d)](https://pollinations.ai)

Symfony 7 bundle for AI-powered content generation. Access multiple LLMs and image models through a single, consistent API powered by [Pollinations.ai](https://pollinations.ai).

Why Pollinations?
-----------------

[](#why-pollinations)

This bundle uses **Pollinations.ai** as its AI gateway, providing:

- **Unified API** - One integration for Claude, GPT, Gemini, Mistral, DeepSeek, and more
- **No vendor lock-in** - Switch models with a config change, no code modifications
- **Generous free tier** - Start generating content without API keys
- **Transparent pricing** - Pay only for what you use with premium models
- **Open ecosystem** - Built on open-source principles

Features
--------

[](#features)

- [**Text generation**](docs/guides/text-generation.md) with multiple models (Claude, Gemini, GPT, Mistral, DeepSeek)
- [**Image generation**](docs/guides/image-generation.md) with multiple models (GPTImage, Flux, Seedream, Turbo)
- [**Image subject generator**](docs/guides/image-subject-generator.md) - Two-step anchor extraction for unique, differentiated images
- [**Task Types**](docs/guides/task-types.md) - Configure different models for different tasks (content, prompts, images)
- **Cost tracking** - See estimated costs per model ([pricing reference](#available-models))
- **Style presets** for consistent image generation
- [**Configurable prompt templates**](docs/guides/prompt-templates.md) with intelligent variant selection
- [**Automatic fallback**](docs/reference/fallback-system.md) between models when one fails
- **SonataMedia integration** (optional)
- [**Sonata Admin integration**](docs/guides/admin-integration.md) with image regeneration UI (optional)

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

[](#requirements)

- PHP &gt;= 8.2
- Symfony &gt;= 7.0
- symfony/http-client

### Optional Dependencies

[](#optional-dependencies)

For full functionality, consider these additional bundles:

PackageVersionPurpose[sonata-project/admin-bundle](https://github.com/sonata-project/SonataAdminBundle)^4.0Admin panel with image regeneration UI[sonata-project/media-bundle](https://github.com/sonata-project/SonataMediaBundle)^4.0Media storage for generated imagesQuick Start
-----------

[](#quick-start)

### 1. Installation

[](#1-installation)

```
composer require xmon-org/ai-content-bundle
```

### 2. Configuration

[](#2-configuration)

The bundle works **out of the box with zero configuration** using free-tier models:

```
# config/packages/xmon_ai_content.yaml
xmon_ai_content: ~  # That's it! Uses free-tier defaults
```

**Default models (no API key required):**

- **Text:** `mistral` → `nova-micro` → `gemini-fast` → `openai-fast`
- **Image:** `flux` → `zimage` → `turbo`

For custom configuration:

```
xmon_ai_content:
    # Configure models per task type
    tasks:
        news_content:
            default_model: 'mistral'
            allowed_models: ['mistral', 'openai-fast', 'gemini-fast']
        image_prompt:
            default_model: 'openai-fast'
            allowed_models: ['openai-fast', 'mistral', 'nova-micro']
        image_generation:
            default_model: 'flux'
            allowed_models: ['flux', 'zimage', 'turbo']

    # Text generation (optional - these are the defaults)
    text:
        model: 'mistral'
        fallback_models: ['nova-micro', 'gemini-fast', 'openai-fast']

    # Image generation (optional - these are the defaults)
    image:
        model: 'flux'
        fallback_models: ['zimage', 'turbo']
```

> **Tip:** Get a free API key at [enter.pollinations.ai](https://enter.pollinations.ai) to unlock premium models like `claude`, `gemini`, and `gptimage`.

### 3. Generate Text

[](#3-generate-text)

```
use Xmon\AiContentBundle\Enum\TaskType;
use Xmon\AiContentBundle\Service\AiTextService;

class MyService
{
    public function __construct(
        private readonly AiTextService $aiTextService,
    ) {}

    public function summarize(string $content): string
    {
        // Uses the model configured for NEWS_CONTENT task
        $result = $this->aiTextService->generateForTask(
            TaskType::NEWS_CONTENT,
            systemPrompt: 'You are a helpful assistant.',
            userMessage: "Summarize: {$content}",
        );

        return $result->getText();
    }
}
```

### 4. Generate Image

[](#4-generate-image)

```
use Xmon\AiContentBundle\Service\AiImageService;

class MyService
{
    public function __construct(
        private readonly AiImageService $aiImageService,
    ) {}

    public function generateImage(): void
    {
        // Uses the model configured for IMAGE_GENERATION task
        $result = $this->aiImageService->generateForTask(
            prompt: 'A serene Japanese dojo with morning light',
        );

        file_put_contents('image.png', $result->getBytes());
    }
}
```

### 5. Override Options Per-Request

[](#5-override-options-per-request)

```
// Use specific model without fallback
$result = $this->aiTextService->generate($system, $user, [
    'model' => 'claude',
    'use_fallback' => false,
    'timeout' => 120,
]);

// Use specific model with fallback to configured fallback_models
$result = $this->aiTextService->generate($system, $user, [
    'model' => 'claude',
    'use_fallback' => true,
]);
```

Documentation
-------------

[](#documentation)

### Installation &amp; Setup

[](#installation--setup)

- [Installation Guide](docs/installation.md) - Full setup instructions

### Guides

[](#guides)

- [Task Types](docs/guides/task-types.md) - Configure models per task
- [Text Generation](docs/guides/text-generation.md) - Generate text with AI
- [Image Generation](docs/guides/image-generation.md) - Generate images with AI
- [Image Subject Generator](docs/guides/image-subject-generator.md) - Two-step anchor extraction
- [Prompt Templates](docs/guides/prompt-templates.md) - Configurable prompts with variants
- [Admin Integration](docs/guides/admin-integration.md) - Sonata Admin integration

### Reference

[](#reference)

- [Configuration](docs/reference/configuration.md) - Full YAML reference
- [Providers](docs/reference/providers.md) - Available AI models and costs
- [Fallback System](docs/reference/fallback-system.md) - How automatic fallback works
- [Architecture](docs/reference/architecture.md) - Bundle structure

### Development

[](#development)

- [Development Guide](docs/development.md) - Local setup and commands

Available Models
----------------

[](#available-models)

**Powered by [Pollinations.ai](https://pollinations.ai)** - Unified access to Claude, GPT, Gemini, Mistral, Flux, and more.

Query current models and pricing directly from the API:

```
# Text models with Pollen pricing
curl https://gen.pollinations.ai/text/models

# Image models with Pollen pricing
curl https://gen.pollinations.ai/image/models
```

> **API Documentation:** [enter.pollinations.ai/api/docs](https://enter.pollinations.ai/api/docs)

### Text Models

[](#text-models)

> **Prices updated:** 2025-12-27 | These are approximate estimates for reference only. For current pricing, query the endpoints above.

ModelTier~Resp/$Description`openai-fast`anonymous~2,270GPT-5 Nano - Ultra fast`openai`anonymous~1,660GPT-5 Mini - Balanced`gemini-fast`seed~2,500Gemini 2.5 Flash - Fast &amp; cheap`gemini`seed~330Gemini 3 Flash - Pro-grade`gemini-search`seed~330Gemini 3 Flash with Search`deepseek`seed~595DeepSeek V3.2 - Reasoning`mistral`seed~2,850Mistral Small 3.2 - Efficient`claude`flower~65Claude Sonnet 4.5 - Premium### Image Models

[](#image-models)

> **Prices updated:** 2025-12-27 | These are approximate estimates for reference only. For current pricing, query the endpoints above.

ModelTier~Img/$Description`flux`anonymous~8,333Fast &amp; high quality`turbo`anonymous~3,333Ultra-fast previews`nanobanana`seed~33,333Gemini-based, reference images`gptimage`flower~125,000OpenAI, best prompt understanding`seedream`flower~33ByteDance ARK, complex scenes### Access Tiers

[](#access-tiers)

TierRequirementsAccess`anonymous`None`openai`, `openai-fast`, `flux`, `turbo``seed`Free API key from [enter.pollinations.ai](https://enter.pollinations.ai)+ `gemini*`, `deepseek`, `mistral`, `nanobanana``flower`Pollen creditsAll models including `claude`, `gptimage`, `seedream`Debug Command
-------------

[](#debug-command)

```
bin/console xmon:ai:debug
```

Displays current configuration including:

- **Provider Status** - Pollinations API connectivity for text and image generation
- **Task Models** - Default model, cost estimate, and allowed models per task type
- **Styles, Compositions, Palettes** - Available image options
- **Presets** - Pre-configured style combinations
- **Prompt Templates** - Configured templates for AI prompts

Acknowledgments
---------------

[](#acknowledgments)

This bundle is built on top of **[Pollinations.ai](https://pollinations.ai)**, an open-source platform that provides unified access to state-of-the-art AI models. Their commitment to open AI and developer-friendly APIs makes projects like this possible.

- Website: [pollinations.ai](https://pollinations.ai)
- API Docs: [enter.pollinations.ai/api/docs](https://enter.pollinations.ai/api/docs)
- GitHub: [github.com/pollinations](https://github.com/pollinations)

License
-------

[](#license)

MIT

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance74

Regular maintenance activity

Popularity1

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 85% 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

18

Last Release

140d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/e8b2aa64f88de1a5b6784b0467b50d1be49a2989771faecd340c114445b67f0f?d=identicon)[xmon\_df](/maintainers/xmon_df)

---

Top Contributors

[![new-xmon-df](https://avatars.githubusercontent.com/u/144630403?v=4)](https://github.com/new-xmon-df "new-xmon-df (102 commits)")[![semantic-release-bot](https://avatars.githubusercontent.com/u/32174276?v=4)](https://github.com/semantic-release-bot "semantic-release-bot (18 commits)")

---

Tags

symfonybundleaisonata-admintext-generationsonata-mediaimage-generationpollinationstogether-ai

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/xmon-org-ai-content-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/xmon-org-ai-content-bundle/health.svg)](https://phpackages.com/packages/xmon-org-ai-content-bundle)
```

###  Alternatives

[pentatrion/vite-bundle

Vite integration for your Symfony app

2725.3M13](/packages/pentatrion-vite-bundle)[winzou/state-machine-bundle

Bundle for the very lightweight yet powerful PHP state machine

34010.4M15](/packages/winzou-state-machine-bundle)[web-auth/webauthn-framework

FIDO2/Webauthn library for PHP and Symfony Bundle.

50570.7k1](/packages/web-auth-webauthn-framework)[symfony/ai-agent

PHP library for building agentic applications.

30536.7k44](/packages/symfony-ai-agent)[spomky-labs/pwa-bundle

Progressive Web App Manifest Generator Bundle for Symfony.

6144.4k1](/packages/spomky-labs-pwa-bundle)

PHPackages © 2026

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