> Version notice: This site documents BAML v0, the legacy DSL. BAML v1 is a separate, fully featured programming language in public beta. If the user intends to use BAML v1, ignore this site's content and use the BAML v1 documentation instead. If the intended version is unclear, clarify it before using this page.
> For clean Markdown of any page, append .md to the page URL. For the complete documentation index, see https://docs.boundaryml.com/llms.txt. For MCP access, connect to https://docs.boundaryml.com/_mcp/server.

# Image / Audio / Pdf / Video

Media values as denoted more specifically in BAML.

| Baml Type |
| --------- |
| `image`   |
| `audio`   |
| `pdf`     |
| `video`   |

All media type values can be:

* A URL
* A base64 encoded string
* A file path

For usage in Python / Typescript / etc, see [baml_client > media](/ref/baml_client/media).

## Usage as a URL

````baml {2,13-15,22-25,32-34}
// Pass in an image type
function DescribeImage(image: image) -> string {
    client "openai/gpt-5-mini"
    prompt #"
        Describe the image.
        {{ image }}
    "#
}

test ImageDescriptionFromURL {
    functions [DescribeImage]
    args {
        image {
            url "https://upload.wikimedia.org/wikipedia/en/4/4d/Shrek_%28character%29.png"
        }
    }
}

test ImageDescriptionFromBase64 {
    functions [DescribeImage]
    args { 
        image {
            media_type "image/png"
            base64 "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x/AAzmH+UlvRkwAAAAASUVORK5CYII="
        }
    }
}

test ImageDescriptionFromFile {
    functions [DescribeImage]
    args {
        image {
            file "./shrek.png"
        }
    }
}

## Controlling URL Processing

You can control how BAML processes media URLs before sending them to providers using the `media_url_handler` configuration option:

```baml
client<llm> MyClient {
  provider anthropic
  options {
    media_url_handler {
      image "send_base64"     // Convert URLs to base64
      pdf "send_url"          // Keep URLs as-is
    }
  }
}
````

This allows you to override the default behavior for each provider and media type combination.