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

# Images (AI SDK)

> Generate images with Vercel AI SDK and the AI Stats provider.

Use `generateImage` with `aiStats.imageModel(...)`.

```ts theme={null}
import { aiStats } from "@ai-stats/ai-sdk-provider";
import { generateImage } from "ai";

const result = await generateImage({
  model: aiStats.imageModel("openai/gpt-image-1"),
  prompt: "A minimalist poster of a lighthouse at dawn.",
  size: "1024x1024",
});

console.log(result.images[0].mediaType);
console.log(result.images[0].uint8Array.length);
console.log(result.providerMetadata);
```

## Notes

* Available `size` values depend on the selected model.
* URL-backed gateway image responses are normalized into the AI SDK file output shape, so `uint8Array` and `mediaType` are the stable fields to read first.
* For deterministic workflows, persist prompt + model + params together.
* Prefer storing returned image metadata with asset references.
