Image

Generate images from text

Usually pure AI Audio services don't support full agentic abilities like tools and conversation. So, you can use these components as stanalone services in an agentic workflow, or use them inside an Agent since they implement the AIProviderInterface interface. In this case you can benefit from the agentic workflow features like middleware and guardrails.

These component can be helpful for automating image generation based on textual prompts.

Nano Banana

Google Gemini API provides a full multimodality experience, so you can just change the default model in your Gemini provider to generate images from prompts. Neuron also supports iteration on generated images with multi-turn conversations thanks to its multimodal message layer and chat history management.

Just configure one of the image generation model in Google Gemini provider:

namespace App\Neuron;

use NeuronAI\Agent\Agent;
use NeuronAI\Chat\Messages\UserMessage;
use NeuronAI\Providers\AIProviderInterface;
use NeuronAI\Providers\Gemini\Gemini;

class MyAgent extends Agent
{
    protected function provider(): AIProviderInterface
    {
        return new Gemini(
            key: 'GEMINI_API_KEY',
            model: 'gemini-2.5-flash-image',
        );
    }
}

// Run the agent
$message = MyAgent::make()
    ->chat(new UserMessage("Generate an image of a venue hosting the best PHP conference!"))
    ->getMessage();

// Retrieve the image part of the message (it's in base64 format)
$imageBase64 = $message->getImage()->getContent();

// Save the audio file
file_put_contents(__DIR__.'/assets/cover.png', base64_decode($imageBase64));

OpenAIImage

As an Agent provider

Direct use

Last updated