# `ALLM.ImageResponse`
[🔗](https://github.com/cykod/ALLM/blob/v0.3.0/lib/allm/image_response.ex#L1)

An image generation/edit/variation response. See spec §35.2.3.

Layer A — pure serializable data. Carries the resolved `:images` list, an
`:usage` summary (`%ALLM.ImageUsage{}` — never `nil`), optional `:id` /
`:request_id` / `:model` provider correlation fields, and an opaque
`:raw` adapter-specific payload analogous to `ALLM.Response.raw`.

ETF round-trip via `:erlang.term_to_binary/1` is total. JSON round-trip
works whenever `:raw` is JSON-encodable; a non-encodable `:raw` raises
`Jason.EncodeError` at encode time — the same caller-responsibility
contract as `ALLM.Response.raw`.

# `t`

```elixir
@type t() :: %ALLM.ImageResponse{
  id: String.t() | nil,
  images: [ALLM.Image.t()],
  metadata: map(),
  model: String.t() | nil,
  raw: term(),
  request_id: String.t() | nil,
  usage: ALLM.ImageUsage.t()
}
```

# `new`

```elixir
@spec new(keyword()) :: t()
```

Build an `%ImageResponse{}` from keyword opts.

Unknown keys raise `KeyError` via `struct!/2`.

## Examples

    iex> resp = ALLM.ImageResponse.new(model: "gpt-image-1")
    iex> resp.images
    []
    iex> resp.usage.images
    0

---

*Consult [api-reference.md](api-reference.md) for complete listing*
