ai icon indicating copy to clipboard operation
ai copied to clipboard

Llama 4 support from the Google vertex provider

Open amanat361 opened this issue 1 year ago • 5 comments

Description

Right now https://ai-sdk.dev/providers/ai-sdk-providers/google-vertex seems pretty out of date. Would be great if there was meta support to use Llama 4 models. Specifically, llama 4 scout with the 10M token context window. I can’t find a provider with the same size context window anywhere else.

AI SDK Version

Latest

amanat361 avatar Jul 02 '25 22:07 amanat361

If you're trying to use the Llama 4 API Service from model garden, one way to do that with the AI SDK is by using createOpenAICompatible:

This should work for all "open models" which includes Deepseek

Seen here:

Image
import { createOpenAICompatible } from '@ai-sdk/openai-compatible';
import { GoogleAuth } from 'google-auth-library';
import { generateText } from 'ai';

async function useLlama4Scout() {
  // Initialize Google Auth
  const auth = new GoogleAuth({
    scopes: ['https://www.googleapis.com/auth/cloud-platform'],
  });
  
  // Get access token
  const authClient = await auth.getClient();
  const accessToken = await authClient.getAccessToken();
  
  // Create OpenAI-compatible client for Vertex AI
  const vertexOpenAI = createOpenAICompatible({
    name: 'vertex-openai',
    baseURL: `https://${location}-aiplatform.googleapis.com/v1/projects/${project}/locations/${location}/endpoints/openapi`,
    headers: {
      'Authorization': `Bearer ${accessToken.token}`,
    },
  });

  // Use Llama 4 Scout with 10M token context window
  const { text } = await generateText({
    model: vertexOpenAI('meta/llama-4-scout-17b-16e-instruct-maas'),
    messages: [
      {
        role: 'user',
        content: 'Your long context prompt here...'
      }
    ],
    temperature: 0.7,
  });

  return text;
}

Currently Llama 4 is only supported on us-east5 through this method. See model locations for details.

I hope this was helpful for your use case

psinha40898 avatar Aug 11 '25 20:08 psinha40898

https://github.com/vercel/ai/pull/11880 explores this

shaper avatar Jan 20 '26 02:01 shaper

See #13931 for maas models support

sylviezhang37 avatar Mar 30 '26 22:03 sylviezhang37

Identify issue type

Identified type: Feature
Confidence: High

Rationale: This is a request for new model/provider support and expanded capability, not a concrete failure of existing behavior.

Evidence:

  • The issue asks for Meta/Llama 4 model support in the Google Vertex provider, specifically Llama 4 Scout with a 10M token context window.
  • The description says the current provider page seems out of date but frames the request as “Would be great if there was meta support.”
  • Comments provide a workaround using createOpenAICompatible and reference PR/issues exploring MAAS model support.

lgrammel avatar Jul 02 '26 09:07 lgrammel

Added in https://github.com/vercel/ai/pull/13931

n1ckoates avatar Sep 03 '26 23:09 n1ckoates