{"record":{"id":"ac1a2bdf2885e3ac","repo":"vercel/ai","slug":"google-vertex-chirp-speech-models-do-not-support-e","errorCode":null,"errorMessage":"Google Vertex Chirp speech models do not support Express Mode API keys. Use standard Google Cloud credentials instead.","messagePattern":"Google Vertex Chirp speech models do not support Express Mode API keys\\. Use standard Google Cloud credentials instead\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/google-vertex/src/google-vertex-provider-base.ts","lineNumber":343,"sourceCode":"  const createEmbeddingModel = (modelId: GoogleVertexEmbeddingModelId) =>\n    new GoogleVertexEmbeddingModel(modelId, createConfig('embedding'));\n\n  const createImageModel = (modelId: GoogleVertexImageModelId) =>\n    new GoogleVertexImageModel(modelId, {\n      ...createConfig('image'),\n      generateId: options.generateId ?? generateId,\n    });\n\n  const createVideoModel = (modelId: GoogleVertexVideoModelId) =>\n    new GoogleVertexVideoModel(modelId, {\n      ...createConfig('video'),\n      generateId: options.generateId ?? generateId,\n    });\n\n  const createSpeechModel = (modelId: GoogleVertexSpeechModelId) => {\n    if (modelId.startsWith('chirp')) {\n      if (apiKey) {\n        throw new Error(\n          'Google Vertex Chirp speech models do not support Express Mode API keys. Use standard Google Cloud credentials instead.',\n        );\n      }\n\n      const config = createConfig('speech');\n      return new GoogleVertexCloudTTSSpeechModel(modelId, {\n        provider: config.provider,\n        headers: config.headers,\n        fetch: config.fetch,\n      });\n    }\n\n    return new GoogleSpeechModel(modelId, createConfig('speech'));\n  };\n\n  // Cloud Speech-to-Text reuses the Vertex auth headers from createConfig, but\n  // targets the Speech-to-Text API.\n  const createTranscriptionModel = (","sourceCodeStart":325,"sourceCodeEnd":361,"githubUrl":"https://github.com/vercel/ai/blob/69428b1f8b037e4d118fb4853428d5c4e620493c/packages/google-vertex/src/google-vertex-provider-base.ts#L325-L361","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\nconst vertex = createGoogleVertex({ apiKey: process.env.GOOGLE_VERTEX_API_KEY });\nconst speech = vertex.speech('chirp-3-hd');\n// after\nconst vertex = createGoogleVertex({ project: 'my-project', location: 'us-central1' });\nconst speech = vertex.speech('chirp-3-hd');","handlingStrategy":"validation","validationCode":"if (apiKey && modelId.startsWith('chirp')) {\n  throw new Error('Chirp speech models require service-account auth, not an Express Mode API key.');\n}","typeGuard":null,"tryCatchPattern":"try {\n  const model = vertex.speech(modelId);\n} catch (e) {\n  if (e instanceof Error && e.message.includes('Chirp speech models do not support Express Mode')) {\n    // switch provider instance to ADC credentials\n  } else throw e;\n}","preventionTips":["Guard any chirp-* speech model usage behind credential checks (service account configured).","Keep API-key and ADC provider instances separate and route capabilities accordingly."],"tags":["authentication","google-vertex","express-mode","speech"],"backgroundTag":"incompatible-auth-method","analyzedSha":"69428b1f8b037e4d118fb4853428d5c4e620493c","analyzedAt":"2026-08-30T12:32:21.016Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}