> ## Documentation Index
> Fetch the complete documentation index at: https://runcrate.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Google Imagen 4 API

> Generate photorealistic images with Google Imagen 4 via a single API. Preview, Fast, and Ultra tiers for every use case.

export const RuncrateStyles = () => {
  if (typeof document !== 'undefined' && !document.getElementById('runcrate-overrides')) {
    const s = document.createElement('style');
    s.id = 'runcrate-overrides';
    s.textContent = `
      /* Match Runcrate's rounding scale (--radius: 0.75rem) */
      .rounded-sm { border-radius: 0.5rem !important; }   /* 8px */
      .rounded-md { border-radius: 0.625rem !important; } /* 10px */
      .rounded-lg { border-radius: 0.75rem !important; }  /* 12px */
      .rounded-l-sm { border-top-left-radius: 0.5rem !important; border-bottom-left-radius: 0.5rem !important; }
      .rounded-r-sm { border-top-right-radius: 0.5rem !important; border-bottom-right-radius: 0.5rem !important; }
      .rounded-l-md { border-top-left-radius: 0.625rem !important; border-bottom-left-radius: 0.625rem !important; }
      .rounded-r-md { border-top-right-radius: 0.625rem !important; border-bottom-right-radius: 0.625rem !important; }
      .rounded-l-lg { border-top-left-radius: 0.75rem !important; border-bottom-left-radius: 0.75rem !important; }
      .rounded-r-lg { border-top-right-radius: 0.75rem !important; border-bottom-right-radius: 0.75rem !important; }

      /* Cards: never pure white in light mode */
      .card { background-color: #fcfcfc !important; border-radius: 0.75rem !important; }
      html.dark .card { background-color: #141414 !important; }

      /* Docs hero box */
      .rc-hero { background-color: #fcfcfc; border: 1px solid #e0e0e0; }
      html.dark .rc-hero { background-color: #141414; border-color: #242424; }
      html.dark .rc-hero h1 { color: #f5f5f5; }

      /* Runcrate scrollbar — thin, transparent track, hide-until-hover thumb */
      ::-webkit-scrollbar { width: 6px; height: 6px; background-color: transparent; }
      ::-webkit-scrollbar-track { background-color: transparent; }
      ::-webkit-scrollbar-thumb { background-color: rgba(155, 155, 155, 0.5); border-radius: 10px; transition: opacity 0.3s ease; opacity: 0; }
      ::-webkit-scrollbar-thumb:hover { background-color: rgba(155, 155, 155, 0.7); }
      *:hover::-webkit-scrollbar-thumb,
      *:focus::-webkit-scrollbar-thumb,
      *:active::-webkit-scrollbar-thumb { opacity: 1; }
      * { scrollbar-width: thin; scrollbar-color: rgba(155, 155, 155, 0.5) transparent; }
    `;
    document.head.appendChild(s);
  }
  return null;
};

<RuncrateStyles />

Google Imagen 4 excels at photorealism, accurate text rendering in images, and complex multi-part prompts. No Google Cloud account required.

## Available models

| Model                  | Speed  | Quality | Best for                    |
| ---------------------- | ------ | ------- | --------------------------- |
| **Imagen 4.0 Preview** | Medium | High    | General-purpose, balanced   |
| **Imagen 4.0 Fast**    | Fast   | Good    | Prototyping, real-time apps |
| **Imagen 4.0 Ultra**   | Slow   | Highest | Hero images, print assets   |

***

## Basic generation

<CodeGroup>
  ```python Python theme={"theme":"github-dark"}
  from runcrate import Runcrate

  client = Runcrate(api_key="rc_live_YOUR_API_KEY")
  image = client.models.generate_image(
      model="google/imagen-4.0-preview",
      prompt="A ceramic coffee mug on a wooden table, morning sunlight through a window, shallow depth of field",
  )
  image.data[0].save("coffee-mug.png")
  ```

  ```typescript TypeScript theme={"theme":"github-dark"}
  import Runcrate from '@runcrate/sdk';

  const rc = new Runcrate({ apiKey: 'rc_live_YOUR_API_KEY' });
  const image = await rc.models.generateImage({
    model: 'google/imagen-4.0-preview',
    prompt: 'A ceramic coffee mug on a wooden table, morning sunlight, lifestyle photography',
  });
  await image.save('coffee-mug.png');
  ```

  ```typescript Vercel AI SDK theme={"theme":"github-dark"}
  import { runcrate } from '@runcrate/ai';
  import { generateImage } from 'ai';

  const { image } = await generateImage({
    model: runcrate.imageModel('google/imagen-4.0-preview'),
    prompt: 'Ceramic coffee mug on wooden table, morning sunlight, lifestyle photography',
    size: '1024x1024',
  });
  ```
</CodeGroup>

***

## Text in images

Imagen 4 renders text inside images more accurately than most diffusion models:

```python theme={"theme":"github-dark"}
from runcrate import Runcrate

client = Runcrate(api_key="rc_live_YOUR_API_KEY")
image = client.models.generate_image(
    model="google/imagen-4.0-ultra",
    prompt='Neon sign on a brick wall reading "OPEN 24 HOURS" in blue and pink neon, dark alley, rain-slicked pavement',
)
image.data[0].save("neon-sign.png")
```

***

## Fast tier for real-time apps

```typescript theme={"theme":"github-dark"}
import Runcrate from '@runcrate/sdk';

const rc = new Runcrate({ apiKey: 'rc_live_YOUR_API_KEY' });
const image = await rc.models.generateImage({
  model: 'google/imagen-4.0-fast',
  prompt: 'Flat-lay photo of notebook, pen, and coffee cup on white desk',
  aspectRatio: '1:1',
});
await image.save('flatlay.png');
```

***

## Batch generation

```python theme={"theme":"github-dark"}
from runcrate import Runcrate
from concurrent.futures import ThreadPoolExecutor

client = Runcrate(api_key="rc_live_YOUR_API_KEY")
scenes = [
    {"file": "hero.png", "prompt": "Person wearing earbuds while jogging at sunrise, editorial photography"},
    {"file": "lifestyle.png", "prompt": "Hands holding smartphone in a cafe, warm tones"},
    {"file": "product.png", "prompt": "Earbuds in charging case on marble, product photography"},
]

def generate(s):
    client.models.generate_image(model="google/imagen-4.0-preview", prompt=s["prompt"], aspect_ratio="16:9").data[0].save(s["file"])

with ThreadPoolExecutor(max_workers=3) as pool:
    pool.map(generate, scenes)
```

***

## Tips

* **Preview vs Fast vs Ultra.** Fast for prototyping, Preview for balanced quality, Ultra for final hero assets.
* **Photorealism.** Imagen 4 is photorealistic by default. Adding "photograph" reinforces this.
* **Text rendering.** Wrap exact text in quotes within the prompt. Short phrases work best.
* **No Google Cloud needed.** One Runcrate API key, standard billing.
