Llama 4 support from the Google vertex provider
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
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
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
https://github.com/vercel/ai/pull/11880 explores this
See #13931 for maas models support
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
createOpenAICompatibleand reference PR/issues exploring MAAS model support.
Added in https://github.com/vercel/ai/pull/13931