{"record":{"id":"77897dd43456caf9","repo":"vercel/ai","slug":"google-vertex-interactions-models-do-not-support-e","errorCode":null,"errorMessage":"Google Vertex Interactions models do not support Express Mode API keys. Use standard Google Cloud credentials instead.","messagePattern":"Google Vertex Interactions 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":307,"sourceCode":"      supportedUrls: () => ({\n        '*': [\n          // HTTP URLs:\n          /^https?:\\/\\/.*$/,\n          // Google Cloud Storage URLs:\n          /^gs:\\/\\/.*$/,\n        ],\n      }),\n    });\n  };\n\n  const createInteractionsModel = (\n    modelIdOrAgent:\n      | GoogleInteractionsModelId\n      | { agent: GoogleInteractionsAgentName }\n      | { managedAgent: string },\n  ) => {\n    if (apiKey) {\n      throw new Error(\n        'Google Vertex Interactions models do not support Express Mode API keys. Use standard Google Cloud credentials instead.',\n      );\n    }\n\n    return new GoogleInteractionsLanguageModel(\n      modelIdOrAgent as GoogleInteractionsModelInput,\n      {\n        // The Interactions API is a location-scoped resource\n        // (`.../locations/{region}/interactions`), so it uses the\n        // endpoint-style base URL without the `/publishers/google` suffix that\n        // the base-model paths carry.\n        ...createConfig('interactions', { endpoint: true }),\n        generateId: options.generateId ?? generateId,\n      },\n    );\n  };\n\n  const createEmbeddingModel = (modelId: GoogleVertexEmbeddingModelId) =>","sourceCodeStart":289,"sourceCodeEnd":325,"githubUrl":"https://github.com/vercel/ai/blob/69428b1f8b037e4d118fb4853428d5c4e620493c/packages/google-vertex/src/google-vertex-provider-base.ts#L289-L325","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\nconst vertex = createGoogleVertex({ apiKey: key });\nvertex.interactions({ agent: 'deep-research-pro' });\n// after\nconst vertex = createGoogleVertex({ project: 'my-project', location: 'us-central1' });\nvertex.interactions({ agent: 'deep-research-pro' });","handlingStrategy":"validation","validationCode":"if (apiKey && wantsInteractions) {\n  throw new Error('Interactions models on Vertex require standard Google Cloud credentials, not an API key.');\n}","typeGuard":null,"tryCatchPattern":"try {\n  const m = vertex.interactions(agent);\n} catch (e) {\n  if (e instanceof Error && e.message.includes('Interactions models do not support Express Mode')) {\n    // rebuild provider with service-account credentials\n  } else throw e;\n}","preventionTips":["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."],"tags":["authentication","google-vertex","express-mode","interactions"],"backgroundTag":"incompatible-auth-method","analyzedSha":"69428b1f8b037e4d118fb4853428d5c4e620493c","analyzedAt":"2026-08-30T12:32:21.016Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}