vercel/ai · error · Error
Google Vertex Chirp speech models do not support Express Mod
Error message
Google Vertex Chirp speech models do not support Express Mode API keys. Use standard Google Cloud credentials instead.
What it means
createSpeechModel throws this Error when a model id starting with 'chirp' (Vertex Chirp TTS) is requested under Express Mode API-key authentication. Chirp speech models require standard Google Cloud credential headers, so the provider refuses to build the model with an apiKey present.
Source
Thrown at packages/google-vertex/src/google-vertex-provider-base.ts:343
const createEmbeddingModel = (modelId: GoogleVertexEmbeddingModelId) =>
new GoogleVertexEmbeddingModel(modelId, createConfig('embedding'));
const createImageModel = (modelId: GoogleVertexImageModelId) =>
new GoogleVertexImageModel(modelId, {
...createConfig('image'),
generateId: options.generateId ?? generateId,
});
const createVideoModel = (modelId: GoogleVertexVideoModelId) =>
new GoogleVertexVideoModel(modelId, {
...createConfig('video'),
generateId: options.generateId ?? generateId,
});
const createSpeechModel = (modelId: GoogleVertexSpeechModelId) => {
if (modelId.startsWith('chirp')) {
if (apiKey) {
throw new Error(
'Google Vertex Chirp speech models do not support Express Mode API keys. Use standard Google Cloud credentials instead.',
);
}
const config = createConfig('speech');
return new GoogleVertexCloudTTSSpeechModel(modelId, {
provider: config.provider,
headers: config.headers,
fetch: config.fetch,
});
}
return new GoogleSpeechModel(modelId, createConfig('speech'));
};
// Cloud Speech-to-Text reuses the Vertex auth headers from createConfig, but
// targets the Speech-to-Text API.
const createTranscriptionModel = (View on GitHub (pinned to 69428b1f8b)
Solutions
- Switch the provider to service-account/ADC authentication and remove the apiKey.
- Use a non-chirp Vertex speech model that supports API-key auth if key-based auth must stay.
- Instantiate a separate provider without apiKey for speech models.
Example fix
// before
const vertex = createGoogleVertex({ apiKey: process.env.GOOGLE_VERTEX_API_KEY });
const speech = vertex.speech('chirp-3-hd');
// after
const vertex = createGoogleVertex({ project: 'my-project', location: 'us-central1' });
const speech = vertex.speech('chirp-3-hd'); Defensive patterns
Strategy: validation
Validate before calling
if (apiKey && modelId.startsWith('chirp')) {
throw new Error('Chirp speech models require service-account auth, not an Express Mode API key.');
} Try / catch
try {
const model = vertex.speech(modelId);
} catch (e) {
if (e instanceof Error && e.message.includes('Chirp speech models do not support Express Mode')) {
// switch provider instance to ADC credentials
} else throw e;
} Prevention
- Guard any chirp-* speech model usage behind credential checks (service account configured).
- Keep API-key and ADC provider instances separate and route capabilities accordingly.
When it happens
Trigger: vertex.speech('chirp-3-hd') (any id with the 'chirp' prefix) while createGoogleVertex received `apiKey` / GOOGLE_VERTEX_API_KEY is set — the nested `if (apiKey)` inside the chirp branch throws.
Common situations: Adding text-to-speech to an app already configured with an Express Mode API key for chat; assuming one auth method works for every Vertex capability; CI with GOOGLE_VERTEX_API_KEY exported globally.
Related errors
- Google Vertex tuned models do not support Express Mode API k
- Google Vertex Interactions models do not support Express Mod
- Google Vertex transcription models do not support Express Mo
- Invalid argument for parameter requests: request IDs must be
- Model could not be resolved
AI-assisted analysis of vercel/ai@69428b1f8b (2026-08-30).
Data as JSON: /api/errors/ac1a2bdf2885e3ac.
Report an issue: GitHub.