bytedance/seedream 404 when passing reference images via generateImage

Current behavior

When calling generateImage with a reference image (via prompt.images) for any ByteDance Seedream model through the AI Gateway native /v3/ai protocol, the request reaches ByteDance but ByteDance returns HTTP 404. The same models work correctly for text-to-image (no files in the request body).

Expected behavior

Per the AI Gateway documentation and the Seedream model FAQ (“Does Seedream 4.5 support multi-image inputs? Yes.”), reference-image generation should succeed with the same generateImage call pattern that works for other supported models (e.g. openai/gpt-image-1, bfl/flux-kontext-pro).

Reproduction

import { experimental_generateImage as generateImage, createGateway } from 'ai';

const gateway = createGateway({ apiKey: process.env.VERCEL_AI_GATEWAY_KEY });

const { images } = await generateImage({
  model: gateway.imageModel('bytedance/seedream-4.5'),
  prompt: {
    text: 'A marketing flyer using the provided logo',
    images: ['data:image/png;base64,<base64>'],
  },
});

Error response

{
  "error": { "message": "Not Found", "statusCode": 404 },
  "providerMetadata": {
    "gateway": {
      "routing": {
        "originalModelId": "bytedance/seedream-4.5",
        "resolvedProvider": "bytedance",
        "providerAttempts": [{
          "provider": "bytedance",
          "credentialType": "system",
          "success": false,
          "error": "Not Found",
          "statusCode": 404
        }]
      },
      "generationId": "gen_01KS2DCZ3P24PRYVHW2KAYM36F"
    }
  }
}

The error originates from ByteDance (not the gateway itself), suggesting the gateway may be hitting the wrong ByteDance endpoint or sending an unexpected format when files are present in the request body.

Also tested: bytedance/seedream-5.0-lite — same result. Generation ID: gen_01KS2DHZ68XZ3PVY57X2W8EHTY.

What works

Environment

  • SDK: ai@6.0.185, @ai-sdk/gateway@3.0.116

  • Runtime: Deno (Supabase Edge Functions)

  • Gateway endpoint: https://ai-gateway.vercel.sh/v3/ai/image-model

The same occurs for all ByteDance image models, even though almost all of them confirm in the Vercel AI Model docs that there is support for reference images.

Your assistance with this is greatly appreciated

There’s another community post with 404 debugging tips that might be helpful. Please give these solutions a try and let us know how it goes.

A human should be around soon to offer more advice. But you can also get helpful information quickly by asking v0.

Hi Quintonide8,

Given the providerAttempts block, this does look different from a normal app-side 404. The Gateway appears to resolve the model to ByteDance and then ByteDance returns 404 only when prompt.images is present.

I’d still rule out one input-format edge case before treating it as a Gateway/provider adapter issue. In the AI SDK docs, prompt.images is typed as Array<DataContent>, so try passing the image as raw base64 or bytes instead of a full data:image/png;base64,... URL:

const base64 = "<base64-without-data-url-prefix>"

await generateImage({
  model: gateway.imageModel("bytedance/seedream-5.0-lite"),
  prompt: {
    text: "A marketing flyer using the provided logo",
    images: [base64],
  },
})

or:

const imageBytes = Uint8Array.from(atob(base64), c => c.charCodeAt(0))

await generateImage({
  model: gateway.imageModel("bytedance/seedream-5.0-lite"),
  prompt: {
    text: "A marketing flyer using the provided logo",
    images: [imageBytes],
  },
})

If raw base64/bytes still produce the same ByteDance-side 404, then I don’t think this is your Deno/Supabase runtime or auth setup. The useful evidence is:

Text-only Seedream call succeeds
Seedream with prompt.images fails
Other image providers with prompt.images succeed
providerAttempts shows resolvedProvider: bytedance
statusCode: 404 from provider attempt
generationId: gen_...
SDK versions: ai@6.0.185, @ai-sdk/gateway@3.0.116

That would point to either the Gateway’s ByteDance image-edit/reference-image mapping or a ByteDance endpoint/format mismatch for those models. I’d keep the generation IDs in the thread, but do not post the Gateway key or the actual image if it is private.