Skip to content

feat (provider/bytedance): add Seedream image model support - #17121

Merged
shaper merged 10 commits into
mainfrom
feat/bytedance-seedream-image-model
Jul 14, 2026
Merged

feat (provider/bytedance): add Seedream image model support#17121
shaper merged 10 commits into
mainfrom
feat/bytedance-seedream-image-model

Conversation

@shaper

@shaper shaper commented Jul 12, 2026

Copy link
Copy Markdown
Collaborator

Summary

Adds a ByteDance Seedream image model to @ai-sdk/bytedance, exposed via .image() / .imageModel(). Previously the provider only supported video and threw NoSuchModelError for image models.

The gateway serves ByteDance images through @ai-sdk/openai-compatible, whose image model routes edits to a multipart /images/edits endpoint. ByteDance ARK has no such endpoint — text-to-image and image-to-image both use a single JSON POST /images/generations, with input images passed in the image field (string or array). Routing edits to /images/edits produced non-JSON responses ("Invalid JSON response"). This model implements the correct ARK shape.

Changes

  • bytedance-image-model.tsImageModelV4 using ARK's single JSON /images/generations; input images (single or multi) go in the image field via convertImageModelFileToDataUri (URLs pass through, binary/base64 → data URI). response_format pinned to b64_json.
  • bytedance-image-model-options.ts — typed ByteDanceImageModelOptions (looseObject schema, mirroring the video model): watermark, outputFormat, size (resolution level), sequentialImageGeneration, maxImages, optimizePromptMode; camelCase → ARK snake_case with passthrough for unknown fields.
  • bytedance-image-settings.tsByteDanceImageModelId (known Seedream ids + open string for ep-… endpoints).
  • Wired image / imageModel into the provider; exported new types from index.ts.
  • Tests — generate, edit (single / multi / URL), typed-option mapping, resolution-level size override, unknown-option passthrough, unsupported-setting warnings (aspectRatio, seed, n, mask).
  • Docs — new Image Models section in 85-bytedance.mdx (text-to-image, edit, multi-image blending, options table, capabilities table) + link to the ModelArk image generation API.
  • Examplesgenerate-image/bytedance/{basic,edit,edit-multi-reference}.ts.
  • Changeset: @ai-sdk/bytedance minor.

Verification

  • tsc --noEmit: clean (package + examples)
  • vitest run (package): all tests pass
  • pnpm build: success

Unsupported inputs warn rather than break: aspectRatio (→ use size), seed, n>1 (→ sequentialImageGeneration), and mask (Seedream has no mask-based inpainting).

Linear: AIG-145 (https://linear.app/vercel/issue/AIG-145)

shaper and others added 2 commits July 11, 2026 18:23
Add a ByteDance Seedream image model to @ai-sdk/bytedance, exposed via
`.image()` / `.imageModel()`. Uses ByteDance ARK's single JSON
`/images/generations` endpoint for both text-to-image and image-to-image
(input images passed in the `image` field), rather than an OpenAI-style
multipart `/images/edits` endpoint.

- Typed provider options (`ByteDanceImageModelOptions`) mapping camelCase
  keys to ARK request fields, with passthrough for unknown fields.
- Unit tests covering generate, edit (single/multi/URL), option mapping,
  and unsupported-setting warnings.
- Provider docs: add Image Models section with basic + edit examples and
  link the ModelArk image generation API.
- Example scripts under examples/ai-functions/generate-image/bytedance.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Add a Seedream multi-reference image edit example following the
black-forest-labs edit-multi-reference example for inputs/prompt.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…xample

Pass comic-cat.png + comic-dog.png as file bytes instead of remote URLs.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…mage docs

The AI SDK abstracts the transport; remove references to the request
endpoint and the b64_json response format from the image model docs.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Comment on lines +36 to +42
maxImages?: number | null;

/**
* Prompt optimization mode. `seedream-4-0` supports both `'standard'` and
* `'fast'`; other models support `'standard'` only.
*/
optimizePromptMode?: 'standard' | 'fast' | null;

@shaper shaper Jul 12, 2026

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Design decision — flat vs. nested provider options (feedback wanted)

I flattened ByteDance's two nested request objects into single camelCase options:

  • maxImagessequential_image_generation_options.max_images
  • optimizePromptModeoptimize_prompt_options.mode

The model reassembles the nested ModelArk shape before sending.

Why flat: cleaner typed surface, and today each nested object has exactly one documented field, so a nested option would just be a one-key wrapper.

Trade-off: if ByteDance adds more fields under either object later, a flat API needs a new top-level option each time, whereas mirroring ARK 1:1 (sequentialImageGenerationOptions: { maxImages }, optimizePromptOptions: { mode }) would extend naturally and read closer to the API docs.

Preference on flat vs. nested here? Happy to switch before merge.

@felixarntz for any steering, I figure we can do flattened for now and switch to sub-objects if warranted later (and be backwards compatible).

Comment thread content/providers/01-ai-sdk-providers/85-bytedance.mdx Outdated
…abilities table

Seedream 5.0 Lite's primary id is `seedream-5-0-260128`; ByteDance's docs
list `seedream-5-0-lite-260128` as an additional id for the same model.
Addresses PR review bot flag.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@shaper shaper added the backport Admins only: add this label to a pull request in order to backport it to the prior version label Jul 12, 2026

@kkdawkins kkdawkins left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ship it!

Comment thread packages/bytedance/src/bytedance-image-model.ts
shaper and others added 2 commits July 13, 2026 21:51
The API has no output-count parameter, so maxImagesPerCall = 10 made
generateImage({ n: 2 }) issue a single call that returned one image.
Set it to 1 so generateImage fans n out into n single-image calls, and
drop the now-misleading `n` unsupported warning. Batches of related
images remain available via the sequentialImageGeneration option.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@shaper
shaper enabled auto-merge (squash) July 14, 2026 04:54
@shaper
shaper merged commit 7fd7dab into main Jul 14, 2026
49 checks passed
@shaper
shaper deleted the feat/bytedance-seedream-image-model branch July 14, 2026 05:02
github-actions Bot added a commit that referenced this pull request Jul 14, 2026
@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Backport to release-v6.0 created but has conflicts: #17189

@github-actions github-actions Bot removed the backport Admins only: add this label to a pull request in order to backport it to the prior version label Jul 14, 2026
shaper added a commit that referenced this pull request Jul 14, 2026
The cherry-picked PR targeted V4 provider specs, which don't exist on
release-v6.0. Adapt the Seedream image model to V3:
- bytedance-provider.ts / index.ts: keep ProviderV3 / Experimental_VideoModelV3
  and the existing ByteDanceVideoProviderOptions export; add image support via
  ImageModelV3.
- bytedance-image-model.ts + test: ImageModelV4 -> ImageModelV3,
  SharedV4Warning -> SharedV3Warning, specificationVersion 'v4' -> 'v3'.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
shaper added a commit that referenced this pull request Jul 14, 2026
…#17189)

This is an automated backport of #17121 to the release-v6.0 branch. FYI
@shaper
This backport has conflicts that need to be resolved manually.

### `git cherry-pick` output

```
Auto-merging content/providers/01-ai-sdk-providers/85-bytedance.mdx
Auto-merging packages/bytedance/src/bytedance-provider.ts
CONFLICT (content): Merge conflict in packages/bytedance/src/bytedance-provider.ts
Auto-merging packages/bytedance/src/index.ts
CONFLICT (content): Merge conflict in packages/bytedance/src/index.ts
error: could not apply 7fd7dab... feat (provider/bytedance): add Seedream image model support (#17121)
hint: After resolving the conflicts, mark them with
hint: "git add/rm <pathspec>", then run
hint: "git cherry-pick --continue".
hint: You can instead skip this commit with "git cherry-pick --skip".
hint: To abort and get back to the state before "git cherry-pick",
hint: run "git cherry-pick --abort".
hint: Disable this message with "git config set advice.mergeConflict false"
```

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Walter Korman <shaper@vercel.com>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

🚀 Published in:

Package Version
@ai-sdk/bytedance 2.0.11 github npm
@ai-sdk/harness-claude-code 1.0.32 github npm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants