vercel/ai · error · Error

Google image models other than Gemini are no longer supporte

Error message

Google image models other than Gemini are no longer supported. Use a model ID that starts with `gemini-`.

What it means

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.

Source

Thrown at packages/google/src/google-image-model.ts:73

    }
    return 10;
  }

  get provider(): string {
    return this.config.provider;
  }

  constructor(
    readonly modelId: GoogleImageModelId,
    private readonly settings: GoogleImageSettings,
    private readonly config: GoogleImageModelConfig,
  ) {}

  async doGenerate(
    options: Parameters<ImageModelV4['doGenerate']>[0],
  ): Promise<Awaited<ReturnType<ImageModelV4['doGenerate']>>> {
    if (!this.modelId.startsWith('gemini-')) {
      throw new Error(
        'Google image models other than Gemini are no longer supported. Use a model ID that starts with `gemini-`.',
      );
    }

    const {
      prompt,
      n,
      size,
      aspectRatio,
      seed,
      providerOptions,
      headers,
      abortSignal,
      files,
      mask,
    } = options;
    const warnings: Array<SharedV4Warning> = [];

View on GitHub (pinned to 69428b1f8b)

Solutions

  1. Change the model ID to a Gemini image model, e.g. `google.imageModel('gemini-2.5-flash-image')`
  2. Verify the model ID string for typos; it must literally start with `gemini-`
  3. Check the @ai-sdk/google changelog for the removal of non-Gemini image model support and migration notes
  4. If Imagen is required, use the Google REST API directly or a different provider package that still supports it

Example fix

// before
const image = await generateImage({ model: google.imageModel('imagen-3.0-generate-002'), prompt });
// after
const image = await generateImage({ model: google.imageModel('gemini-2.5-flash-image'), prompt });
Defensive patterns

Strategy: validation

Validate before calling

const modelId = 'gemini-2.5-flash-image';
if (!modelId.startsWith('gemini-')) {
  throw new Error(`Google image model IDs must start with 'gemini-'; got: ${modelId}`);
}

Type guard

function isGeminiImageModelId(modelId: string): boolean {
  return modelId.startsWith('gemini-');
}

Try / catch

try {
  await generateImage({ model: google.imageModel(modelId), prompt });
} catch (error) {
  if (error instanceof Error && error.message.includes('no longer supported')) {
    // fall back to a gemini- model or surface migration guidance
  }
  throw error;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of vercel/ai@69428b1f8b (2026-08-30). Data as JSON: /api/errors/d181a907c16685d8. Report an issue: GitHub.