vercel/ai · error · Error
Google Vertex Interactions models do not support Express Mod
Error message
Google Vertex Interactions models do not support Express Mode API keys. Use standard Google Cloud credentials instead.
What it means
createInteractionsModel in the Vertex provider base throws this Error whenever an Interactions model or agent is requested while Express Mode API-key auth is configured. The Interactions API on Vertex is only reachable with standard Google Cloud credentials, so the provider blocks model creation immediately.
Source
Thrown at packages/google-vertex/src/google-vertex-provider-base.ts:307
supportedUrls: () => ({
'*': [
// HTTP URLs:
/^https?:\/\/.*$/,
// Google Cloud Storage URLs:
/^gs:\/\/.*$/,
],
}),
});
};
const createInteractionsModel = (
modelIdOrAgent:
| GoogleInteractionsModelId
| { agent: GoogleInteractionsAgentName }
| { managedAgent: string },
) => {
if (apiKey) {
throw new Error(
'Google Vertex Interactions models do not support Express Mode API keys. Use standard Google Cloud credentials instead.',
);
}
return new GoogleInteractionsLanguageModel(
modelIdOrAgent as GoogleInteractionsModelInput,
{
// The Interactions API is a location-scoped resource
// (`.../locations/{region}/interactions`), so it uses the
// endpoint-style base URL without the `/publishers/google` suffix that
// the base-model paths carry.
...createConfig('interactions', { endpoint: true }),
generateId: options.generateId ?? generateId,
},
);
};
const createEmbeddingModel = (modelId: GoogleVertexEmbeddingModelId) =>View on GitHub (pinned to 69428b1f8b)
Solutions
- Configure the provider with service-account credentials (GOOGLE_APPLICATION_CREDENTIALS or GOOGLE_SERVICE_ACCOUNT_KEY) and drop the apiKey.
- Unset GOOGLE_VERTEX_API_KEY in the environment so ADC is used.
- If API-key auth is a hard requirement, use the @ai-sdk/google (Gemini API) provider instead of Vertex for interactions-style usage where supported.
Example fix
// before
const vertex = createGoogleVertex({ apiKey: key });
vertex.interactions({ agent: 'deep-research-pro' });
// after
const vertex = createGoogleVertex({ project: 'my-project', location: 'us-central1' });
vertex.interactions({ agent: 'deep-research-pro' }); Defensive patterns
Strategy: validation
Validate before calling
if (apiKey && wantsInteractions) {
throw new Error('Interactions models on Vertex require standard Google Cloud credentials, not an API key.');
} Try / catch
try {
const m = vertex.interactions(agent);
} catch (e) {
if (e instanceof Error && e.message.includes('Interactions models do not support Express Mode')) {
// rebuild provider with service-account credentials
} else throw e;
} Prevention
- Check process.env.GOOGLE_VERTEX_API_KEY at startup and fail fast if your app needs Interactions/speech/transcription features.
- Prefer ADC (GOOGLE_APPLICATION_CREDENTIALS) for all Vertex usage; reserve API keys for the Gemini API provider.
When it happens
Trigger: Calling vertex.interactions('gemini-...') or vertex.interactions({ agent: ... }) / { managedAgent: ... } when the provider has an `apiKey` set (createGoogleVertex({ apiKey }) or GOOGLE_VERTEX_API_KEY env var) — the unconditional `if (apiKey)` check throws.
Common situations: Trying Interactions API with an API key obtained from Express Mode; env var GOOGLE_VERTEX_API_KEY leaking into a deployment that also uses interactions agents; examples copied from Gemini API (AI Studio) docs where API keys are normal.
Related errors
- Google Vertex tuned models do not support Express Mode API k
- Google Vertex Chirp speech models do not support Express Mod
- Google Vertex transcription models do not support Express Mo
- Invalid argument for parameter requests: request IDs must be
- AWS SigV4 authentication requires AWS credentials. Please pr
AI-assisted analysis of vercel/ai@69428b1f8b (2026-08-30).
Data as JSON: /api/errors/77897dd43456caf9.
Report an issue: GitHub.