The PHP AI SDK supports multimodal image input for Groq’s Llama 4 family of models. You can mix text and image parts inside a single user message by composingDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/phpaisdk/groq/llms.txt
Use this file to discover all available pages before exploring further.
Content::text() and Content::image() values together, then wrapping them in Message::user(). The rest of the generation API stays identical to a standard text request — the SDK handles the encoding and routing transparently.
Supported Models
Only the two Llama 4 model patterns hosted on Groq support image input. All other Groq models will raise aCapabilityNotSupportedException if you attempt to pass image content.
| Model Pattern | Notes |
|---|---|
meta-llama/llama-4-scout* | Matches all Scout variants, e.g. meta-llama/llama-4-scout-17b-16e-instruct |
meta-llama/llama-4-maverick* | Matches all Maverick variants, e.g. meta-llama/llama-4-maverick-17b-128e-instruct |
Checking Image Input Support
Before sending an image, you can verify that a given model ID supportsCapability::ImageInput:
Check image input support
->supports() is a convenience wrapper around ->capability()->isSupported(). Use ->capability(Capability::ImageInput) if you need the full CapabilitySupport object including the strategy string.Sending an Image
use AiSdk\Content;
use AiSdk\Message;
$message = Message::user([
Content::text('What is shown in this image?'),
Content::image('https://example.com/photo.jpg'),
]);
Use
->messages() (or the equivalent prompt builder) to include your composed message, and select a Llama 4 model.use AiSdk\Content;
use AiSdk\Generate;
use AiSdk\Groq;
use AiSdk\Message;
$result = Generate::text()
->model(Groq::model('meta-llama/llama-4-scout-17b-16e-instruct'))
->messages([
Message::user([
Content::text('Describe what you see in this image.'),
Content::image('https://example.com/photo.jpg'),
]),
])
->run();
Complete Example
Image input — complete example
What Happens with Unsupported Models
If you passContent::image() to a model that does not declare image_input capability, the SDK raises a CapabilityNotSupportedException before the request leaves the process — no API call is made.
Unsupported model raises an exception
Combining Images with Instructions
You can pair image messages with a system instruction using->instructions() to steer how the model interprets or reports on the image.
Image input with system instructions