# Generate Images With Firebase AI

Use when generating or editing images from Flutter/Dart with Firebase AI Logic and a...

- Repository: https://github.com/evanca/flutter-ai-rules (668 stars)
- Category: Testing
- License: MIT
- Last updated: 2026-10-30
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add evanca/flutter-ai-rules --skill generate-images-with-firebase-ai -g -a claude-code -y`
Codex: `npx skills add evanca/flutter-ai-rules --skill generate-images-with-firebase-ai -g -a codex -y`
Cursor: `npx skills add evanca/flutter-ai-rules --skill generate-images-with-firebase-ai -g -a cursor -y`
Gemini CLI: `npx skills add evanca/flutter-ai-rules --skill generate-images-with-firebase-ai -g -a gemini-cli -y`
Claude Code plugin marketplace: `/plugin marketplace add evanca/flutter-ai-rules`

## Description

Use when generating or editing images from Flutter/Dart with Firebase AI Logic and a Gemini image model (Nano Banana), making the first call work, choosing Gemini Developer API vs Vertex AI, hitting quota, billing or App Check failures, getting empty or image-only responses, sending a user photo as input, controlling aspect ratio or size, writing the image prompt, or deciding what to test.

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# Generating images with Firebase AI Logic

Gemini image models return interleaved text and image parts from one call. The
response is a sequence to walk, not a string to read.

A request that comes back empty is usually a configuration problem rather than
a bug in your code, so section 1 covers the three settings that cause it.

## 1. Three things that block the very first call

A first call that returns an error, an empty response, or a 403 is almost
always one of these rather than your Dart. Rule them out before you debug code.

**Billing.** Image generation has no free tier. On a Spark-plan project the
image models return `limit: 0` for `generate_content_free_tier_requests`, so
the first request fails on quota having made zero requests. Text models do work
on Spark, which means "my other Gemini call works" proves nothing. Upgrade to
Blaze, then verify the current limits rather than trusting this note:

```bash
gcloud services quota list --service=generativelanguage.googleapis.com --consumer=projects/YOUR_PROJECT_ID
```

**App Check.** Firebase AI Logic enforces App Check when the project has it
turned on. Otherwise the endpoint is open to anyone who extracts your config
from the shipped client, and that config is public by design. Anything
reachable from a device you do not control needs App Check. Debug builds
attest with a debug provider, release builds with a real one. Web has a
specific trap that costs an afternoon, described in `references/setup.md`.

**`responseModalities`.** Without it the model has no permission to return an
image, so you get text describing the picture it would have drawn. Set both
modalities, as in the call below.

## 2. The minimal call that works

The rest: https://github.com/evanca/flutter-ai-rules/blob/HEAD/skills/generate-images-with-firebase-ai/SKILL.md
