Skip to content

feat(byteplus): map output_format and background on Seedream images - #590

Merged
Kamilbenkirane merged 1 commit into
mainfrom
feat/byteplus-output-format-background
Nov 9, 2026
Merged

Kamilbenkirane merged 1 commit into
mainfrom
feat/byteplus-output-format-background

Conversation

@Kamilbenkirane

Copy link
Copy Markdown
Member

BytePlus image models warn about output_format and background (UnsupportedParameterWarning) and drop them. Celeste has the unified ImageParameter.OUTPUT_FORMAT and ImageParameter.BACKGROUND, and OpenAI maps both, but BytePlus has no mapper for either. #520 left this as follow-up work ("That needs a BytePlus OutputFormatMapper").

The ModelArk Image generation API documents both request fields:

  • output_format: "string Default jpeg | Image format". "Specifies the file format of the generated image. Valid values: png, jpeg". Supported models: "Seedream 5.0 pro, Seedream 5.0 flash, Seedream 5.0 lite".
  • background: "string Default opaque | Image alpha channel". "Controls whether to generate an image with an alpha channel. Valid values: transparent [...] opaque". Supported models: "Seedream 5.0 pro, Seedream 5.0 flash". Transparent mode "is supported only for image-to-image generation with exactly one input image that has an alpha channel", and "If output_format is set to jpeg, the request returns an error."

Fix:

  • src/celeste/providers/byteplus/images/parameters.py: wire OutputFormatMapper (output_format) and BackgroundMapper (background).
  • src/celeste/modalities/images/providers/byteplus/parameters.py: the two mappers are bound to ImageParameter.OUTPUT_FORMAT / ImageParameter.BACKGROUND and added to BYTEPLUS_PARAMETER_MAPPERS.
  • src/celeste/modalities/images/providers/byteplus/models.py, with literals verbatim from the reference:
    • OUTPUT_FORMAT: Choice(["png", "jpeg"]) on seedream-5-0-260128 (lite), dola-seedream-5-0-pro-260628 and dola-seedream-5-0-flash-260915;
    • BACKGROUND: Choice(["transparent", "opaque"]) on pro and flash.
    • Seedream 4.0 / 4.5 get no constraint, so a value passes through unvalidated, by design.
    • The transparent-mode limits (image-to-image only, one alpha input, no jpeg) are mode-conditional, so they stay with the provider.
  • Output MIME is unchanged: the artifact is still labeled from the response's declared output_format (fix(byteplus): label image outputs with their declared format instead of PNG #520).
  • tests/unit_tests/test_parameter_wire_contracts.py: output_format and background rows for the BytePlus images list, which also joins the none-omits list.
  • CHANGELOG.md: one Features line under [Unreleased].

Validation:

  • make ci passes (766 tests).
  • Request body for dola-seedream-5-0-flash-260915 with output_format="jpeg", background="transparent":
    • origin/main: neither field is sent, and two UnsupportedParameterWarnings are raised;
    • this branch: output_format: "jpeg" and background: "transparent" are sent, with no warnings.
  • Live, through celeste's own client:
Call artifact.mime_type Downloaded bytes
flash generate(output_format="jpeg", quality="1K") image/jpeg ff d8 ff e0 (JPEG), 1248×832, 182,610 B
flash edit(image=<512×512 RGBA PNG, red disc on transparent>, background="transparent", quality="1K") image/png PNG, 1024×1024, rgba (IHDR color type 6). Alpha: 89.7% of pixels below 32 (background), 9.8% at 224 or above (the blue star)
lite generate(output_format="png", quality="2K") None PNG, 2048×2048, rgb24 (BytePlus defaults to jpeg, so the field was applied)

@Kamilbenkirane
Kamilbenkirane merged commit 56163a3 into main Nov 9, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant