Log these six fields for every Sume image call

Job id, request id, idempotency key, model, quality, and metadata. A short logging helper that lets you recover, dedupe, and report an image failure later.

3 min readSume
All posts

For every image call, log six things: the job id, Sume's request id, your idempotency key, the model id, the quality, and a metadata tag. With those you can recover a result after a crash, retry safely, and give support what it needs.

Models change often, as Higgsfield's changelog shows with FLUX 3 Image on 2026-10-01 (Higgsfield changelog, read 2026-10-02). Logging the model id and quality per call lets you compare outputs when you switch.

Why these six?

Each answers a question you will ask later. Sume puts the request id in the error body and in response headers, and its docs say to include it when reporting an issue, never an API key or signed URL.

Fields to log, from Sume's docs, read 2026-10-02
FieldWhy
Job idRecover with status, events, or result instead of resubmitting
Request id (req_...)Safe to share with support
Idempotency-KeyExact retries; same key on another payload gives 409
Model idjob.model stays sume/auto for Auto
qualityCost and result driver
metadataCaller tag stored on the job; not sent to the provider

What does the helper look like?

One function wraps the call and prints a JSON line. The metadata object is stored on the job, so use it for your campaign or SKU tag.

import json
import os
import requests

URL = "https://api.sume.com/v1/images"
HEADERS = {"Authorization": f"Bearer {os.environ['SUME_API_KEY']}"}


def generate(prompt: str, key: str, tag: str) -> dict:
    body = {"model": "sume/auto", "prompt": prompt, "mode": "async",
            "quality": "medium", "metadata": {"campaign": tag}}
    r = requests.post(URL, json=body, timeout=60,
                      headers={**HEADERS, "Idempotency-Key": key})
    payload = r.json()
    print(json.dumps({
        "status": r.status_code,
        "request_id": r.headers.get("x-sume-request-id"),
        "idempotency_key": key,
        "model": body["model"],
        "quality": body["quality"],
        "campaign": tag,
        "job_id": (payload.get("data") or {}).get("job", {}).get("id"),
    }))
    return payload


generate("Studio shot of a ceramic mug", "mug-001", "autumn-launch")

What should I never log?

Never log API keys, signed URLs, or raw media URLs where others can read them. Store the Sume-hosted URL from the result, not provider URLs. The Errors docs describe the request id, and the Image API docs describe metadata.

Sources

Related posts

More in Developers

All Developers posts

Written by Sume