Titan base64 image fields vs Sume input_references URLs in Python

Titan sends images as base64 strings inside the request. Sume wants public HTTPS URLs. A Python adapter from a local file to a URL for edits.

4 min readSume
All posts

A Bedrock Titan edit puts the image in the request body. Per Amazon's docs (read 2026-10-06), the maskImage field must be a base64-encoded string, and the input image is PNG or JPG. Sume's edit call works differently: the source is a URL, so a local file has to be hosted somewhere first.

How the image travels (Amazon Bedrock docs, read 2026-10-06; Sume docs)
StepTitan on BedrockSume /v1/images
Source imageBase64 in the JSON bodyPublic HTTPS URL in input_references[].image_url.url
MaskBase64 maskImagemask_url, ChatGPT Image 2.5 only
ResultImage in the responsedata[].url, a Sume-hosted signed URL
Next editRe-encode the bytesPass the previous data[].url back in as the new reference

Hosting the source

Any public HTTPS host works: object storage with a presigned GET URL, your CDN, or a signed link. Give the link enough lifetime for a 202 job to fetch it later; the post on presigned URL expiry covers the timing. The result goes the other way, as a Sume-hosted URL, so there is no base64 to decode.

The adapter

This adapter takes a public URL (your upload step produces it) and returns the URL of the edited image, which you can feed back in for the next turn.

import os, requests

def edit(source_url: str, prompt: str, model: str = "ideogram/ideogram-v4.5") -> str:
    r = requests.post(
        "https://api.sume.com/v1/images",
        headers={"Authorization": f"Bearer {os.environ['SUME_API_KEY']}"},
        json={"model": model, "prompt": prompt,
              "input_references": [{"type": "image_url", "image_url": {"url": source_url}}]},
        timeout=90,
    )
    r.raise_for_status()
    return r.json()["data"][0]["url"]

turn1 = edit("https://example.com/room.jpg", "Paint the wall sage green.")
turn2 = edit(turn1, "Add a floor lamp in the corner. Keep everything else.")
print(turn2)

Sources

Related posts

More in Developers

All Developers posts

Written by Sume