Skip to main content
Meta Llama models are available through Vertex AI using the :chatCompletions endpoint with OpenAI-compatible request and response format.

Provider constant

Use the Vertex::Meta constant to access Meta Llama models:
use Prism\Vertex\Enums\Vertex;

Vertex::Meta  // 'vertex-meta'

Configuration

Llama models use the shared vertex configuration block:
'vertex' => [
    'project_id'  => env('VERTEX_PROJECT_ID'),
    'location'    => env('VERTEX_LOCATION', 'us-central1'),
    'credentials' => env('VERTEX_CREDENTIALS'), // path to service-account.json
],
Express mode is not supported for Meta models. You must provide a project ID and location.

API schema

Meta models use the OpenAI schema, which provides:
  • :chatCompletions endpoint with OpenAI-compatible format
  • Publisher: meta
  • Model is prefixed in request body as meta/{model}
  • Supports text generation and structured output
  • No native embeddings support

Example models

  • llama-4-scout-17b-16e-instruct-maas
  • llama-3.3-70b-instruct-maas
  • llama-3.2-90b-vision-instruct-maas
  • llama-3.1-405b-instruct-maas
Meta model names on Vertex AI use the -maas suffix, indicating they’re part of the Model-as-a-Service (MaaS) offering.

Usage examples

Text generation

use Prism\Prism\Prism;
use Prism\Vertex\Enums\Vertex;

$response = Prism::text()
    ->using(Vertex::Meta, 'llama-4-scout-17b-16e-instruct-maas')
    ->withPrompt('Explain quantum computing in simple terms')
    ->asText();

echo $response->text;

Structured output

Llama models support structured output via response_format: { type: "json_object" } combined with a schema instruction:
use Prism\Prism\Prism;
use Prism\Vertex\Enums\Vertex;
use Prism\Prism\Schema\ObjectSchema;
use Prism\Prism\Schema\StringSchema;
use Prism\Prism\Schema\ArraySchema;

$schema = new ObjectSchema(
    name: 'languages',
    description: 'Top programming languages',
    properties: [
        new ArraySchema(
            'languages',
            'List of programming languages',
            items: new ObjectSchema(
                name: 'language',
                description: 'Programming language details',
                properties: [
                    new StringSchema('name', 'The language name'),
                    new StringSchema('popularity', 'Popularity description'),
                ]
            )
        )
    ]
);

$response = Prism::structured()
    ->using(Vertex::Meta, 'llama-3.3-70b-instruct-maas')
    ->withSchema($schema)
    ->withPrompt('List the top 3 programming languages')
    ->asStructured();

$data = $response->structured;

Custom JSON instruction

You can customize the JSON schema instruction message:
$response = Prism::structured()
    ->using(Vertex::Meta, 'llama-4-scout-17b-16e-instruct-maas')
    ->withSchema($schema)
    ->withProviderOptions([
        'jsonModeMessage' => 'Return JSON matching this schema: {schema}',
    ])
    ->withPrompt('List the top 3 programming languages')
    ->asStructured();

Multi-turn conversation

use Prism\Prism\Prism;
use Prism\Vertex\Enums\Vertex;
use Prism\Prism\ValueObjects\Messages\UserMessage;
use Prism\Prism\ValueObjects\Messages\AssistantMessage;

$response = Prism::text()
    ->using(Vertex::Meta, 'llama-3.3-70b-instruct-maas')
    ->withMessages([
        new UserMessage('What is the capital of France?'),
        new AssistantMessage('The capital of France is Paris.'),
        new UserMessage('What is its population?'),
    ])
    ->asText();

echo $response->text;

Capabilities

Text generation

Full support for text generation with multi-turn conversations

Structured output

Structured output via JSON mode with schema instruction

Endpoint details

Meta models use the :chatCompletions endpoint action, where the model field in the request body is prefixed with the publisher:
{
  "model": "meta/llama-4-scout-17b-16e-instruct-maas",
  "messages": [...]
}
Prism Vertex handles this prefixing automatically—you only need to provide the model name.

Next steps

Structured output

Learn more about structured output

Other providers

Explore other MaaS providers

Build docs developers (and LLMs) love