{"record":{"id":"d181a907c16685d8","repo":"vercel/ai","slug":"google-image-models-other-than-gemini-are-no-longe-d181a9","errorCode":null,"errorMessage":"Google image models other than Gemini are no longer supported. Use a model ID that starts with `gemini-`.","messagePattern":"Google image models other than Gemini are no longer supported\\. Use a model ID that starts with `gemini-`\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/google/src/google-image-model.ts","lineNumber":73,"sourceCode":"    }\n    return 10;\n  }\n\n  get provider(): string {\n    return this.config.provider;\n  }\n\n  constructor(\n    readonly modelId: GoogleImageModelId,\n    private readonly settings: GoogleImageSettings,\n    private readonly config: GoogleImageModelConfig,\n  ) {}\n\n  async doGenerate(\n    options: Parameters<ImageModelV4['doGenerate']>[0],\n  ): Promise<Awaited<ReturnType<ImageModelV4['doGenerate']>>> {\n    if (!this.modelId.startsWith('gemini-')) {\n      throw new Error(\n        'Google image models other than Gemini are no longer supported. Use a model ID that starts with `gemini-`.',\n      );\n    }\n\n    const {\n      prompt,\n      n,\n      size,\n      aspectRatio,\n      seed,\n      providerOptions,\n      headers,\n      abortSignal,\n      files,\n      mask,\n    } = options;\n    const warnings: Array<SharedV4Warning> = [];\n","sourceCodeStart":55,"sourceCodeEnd":91,"githubUrl":"https://github.com/vercel/ai/blob/69428b1f8b037e4d118fb4853428d5c4e620493c/packages/google/src/google-image-model.ts#L55-L91","documentation":"This error is thrown by the Google image model's doGenerate when the model ID does not start with `gemini-`. The Google provider previously supported non-Gemini image models (e.g. Imagen via `imagen-...` IDs), but that support has been removed; only Gemini image models are supported now.","triggerScenarios":"Calling generateImage (or any code path invoking doGenerate) with a GoogleImageModel whose modelId does not start with `gemini-`, e.g. `google.imageModel('imagen-3.0-generate-002')` or a legacy image model ID.","commonSituations":"Migrating from an older version of @ai-sdk/google that supported Imagen models; copying old example code with `imagen-` model IDs; typo'ing a Gemini model ID.","solutions":["Change the model ID to a Gemini image model, e.g. `google.imageModel('gemini-2.5-flash-image')`","Verify the model ID string for typos; it must literally start with `gemini-`","Check the @ai-sdk/google changelog for the removal of non-Gemini image model support and migration notes","If Imagen is required, use the Google REST API directly or a different provider package that still supports it"],"exampleFix":"// before\nconst image = await generateImage({ model: google.imageModel('imagen-3.0-generate-002'), prompt });\n// after\nconst image = await generateImage({ model: google.imageModel('gemini-2.5-flash-image'), prompt });","handlingStrategy":"validation","validationCode":"const modelId = 'gemini-2.5-flash-image';\nif (!modelId.startsWith('gemini-')) {\n  throw new Error(`Google image model IDs must start with 'gemini-'; got: ${modelId}`);\n}","typeGuard":"function isGeminiImageModelId(modelId: string): boolean {\n  return modelId.startsWith('gemini-');\n}","tryCatchPattern":"try {\n  await generateImage({ model: google.imageModel(modelId), prompt });\n} catch (error) {\n  if (error instanceof Error && error.message.includes('no longer supported')) {\n    // fall back to a gemini- model or surface migration guidance\n  }\n  throw error;\n}","preventionTips":["Always define Google image model IDs as constants starting with 'gemini-'","Pin @ai-sdk/google versions and read changelogs when upgrading (Imagen support removed)","Add a unit test asserting the configured image model ID starts with 'gemini-'"],"tags":["google","image-generation","deprecated-model","migration"],"backgroundTag":"unsupported-model-id","analyzedSha":"69428b1f8b037e4d118fb4853428d5c4e620493c","analyzedAt":"2026-08-30T12:32:21.016Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}