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

# Images (vision)

> Send images to vision-capable models — raw bytes or a hosted URL — with Bedrock-style image content blocks.

Bedrock-style `image` content blocks are supported in user messages on
vision-capable models. Hand the SDK **raw bytes** (it base64-encodes them for
you, Bedrock parity) or — an AI Reserve extension Bedrock doesn't offer — a
**hosted URL**, which is passed through verbatim so your payload stays tiny.
Supported formats: `png`, `jpeg`, `gif`, `webp`.

<CodeGroup>
  ```python Python theme={"dark"}
  with open("chart.png", "rb") as f:
      image_bytes = f.read()

  response = client.converse(
      modelId="gpt-5.5",
      messages=[{
          "role": "user",
          "content": [
              {"text": "What does this chart show?"},
              {"image": {"format": "png", "source": {"bytes": image_bytes}}},
          ],
      }],
  )

  # Or reference a hosted image directly (not available in Bedrock):
  # {"image": {"format": "jpeg", "source": {"url": "https://example.com/photo.jpg"}}}
  ```

  ```typescript TypeScript theme={"dark"}
  import { readFile } from "node:fs/promises";

  const imageBytes = new Uint8Array(await readFile("chart.png"));

  const response = await client.send(
    new ConverseCommand({
      modelId: "gpt-5.5",
      messages: [
        {
          role: "user",
          content: [
            { text: "What does this chart show?" },
            { image: { format: "png", source: { bytes: imageBytes } } },
          ],
        },
      ],
    })
  );

  // Or reference a hosted image directly (not available in Bedrock):
  // { image: { format: "jpeg", source: { url: "https://example.com/photo.jpg" } } }
  ```

  ```go Go theme={"dark"}
  imageBytes, err := os.ReadFile("chart.png")
  if err != nil {
      log.Fatal(err)
  }

  resp, err := client.Converse(ctx, &audacityruntime.ConverseInput{
      ModelId: audacity.String("gpt-5.5"),
      Messages: []types.Message{{
          Role: types.ConversationRoleUser,
          Content: []types.ContentBlock{
              &types.ContentBlockMemberText{Value: "What does this chart show?"},
              &types.ContentBlockMemberImage{Value: types.ImageBlock{
                  Format: types.ImageFormatPng,
                  Source: &types.ImageSourceMemberBytes{Value: imageBytes},
              }},
          },
      }},
  })

  // Or reference a hosted image directly (not available in Bedrock):
  // Source: &types.ImageSourceMemberUrl{Value: "https://example.com/photo.jpg"}
  ```

  ```java Java theme={"dark"}
  byte[] imageBytes = java.nio.file.Files.readAllBytes(java.nio.file.Path.of("chart.png"));

  ConverseResponse resp = client.converse(request -> request
      .modelId("gpt-5.5")
      .messages(Message.builder()
          .role(ConversationRole.USER)
          .content(
              ContentBlock.fromText("What does this chart show?"),
              ContentBlock.fromImage(ImageBlock.builder()
                  .format(ImageFormat.PNG)
                  .source(ImageSource.fromBytes(imageBytes))
                  .build()))
          .build()));

  // Or reference a hosted image directly (not available in Bedrock):
  // ImageSource.fromUrl("https://example.com/photo.jpg")
  ```

  ```rust Rust theme={"dark"}
  use audacity_sdk::{ContentBlock, ImageBlock, ImageFormat, ImageSource};

  let image_bytes = std::fs::read("chart.png")?;

  let response = client.converse()
      .model_id("gpt-5.5")
      .messages(
          Message::builder()
              .role(ConversationRole::User)
              .content(ContentBlock::Text("What does this chart show?".into()))
              .content(ContentBlock::Image(ImageBlock {
                  format: ImageFormat::Png,
                  source: ImageSource::Bytes(image_bytes),
              }))
              .build()?
      )
      .send()
      .await?;

  // Or reference a hosted image directly (not available in Bedrock):
  // source: ImageSource::Url("https://example.com/photo.jpg".into())
  ```
</CodeGroup>

## Payload guidance

* Base64 inflates bytes by \~33%; with the gateway's 30 MB request cap, keep inline images at roughly **20 MB raw or less**.
* For large or frequently reused images, prefer `source.url` — the request stays small and the provider fetches the image directly.
* Text-only conversations are wire-identical to before image support existed; nothing changes unless a turn actually contains an image.
* Image blocks are valid in **user** messages only (Bedrock parity); blocks in assistant turns are ignored.
