Skip to content

Move two templates off retired Workers AI models - #1207

Open
kale-stew wants to merge 1 commit into
mainfrom
kylie/fix/retired-workers-ai-models
Open

kale-stew wants to merge 1 commit into
mainfrom
kylie/fix/retired-workers-ai-models

Conversation

@kale-stew

Copy link
Copy Markdown
Member

Workers AI retired 24 models on 2026-11-20. Two published templates call one of them:

  • text-to-image-template used @cf/stabilityai/stable-diffusion-xl-base-1.0, so every request now fails. Its live demo returns 500, which also fails supplemental-check on every open PR.
  • llm-chat-app-template used @cf/meta/llama-3.1-8b-instruct-fp8, so /api/chat returns 500.

Changes

  • text-to-image-template now uses @cf/black-forest-labs/flux-2-klein-9b, the replacement the changelog recommends. It takes multipart form data and returns a base64 image.
    • Klein can reject a generated image with error 3030 ("Your output has been flagged"). I saw it once in 6 calls with the template's prompt. Each call makes a new image, so the Worker retries once and returns a 503 if the retry is flagged too.
    • Klein returns JPEG, so the Worker sets Content-Type from the image bytes instead of hard-coding image/png, and returns 502 if the bytes aren't a JPEG or PNG.
  • llm-chat-app-template now uses @cf/google/gemma-4-26b-a4b-it with chat_template_kwargs.enable_thinking: false, as in the Workers AI get-started guide. With reasoning on, a five-word reply took about 440 hidden reasoning chunks and 8 seconds. With it off, replies start in about a second.

How I verified it

  • wrangler dev against the real models:
    • text-to-image-template: 3 of 3 requests returned a JPEG with Content-Type: image/jpeg.
    • llm-chat-app-template: 2 prompts streamed answers with no reasoning content.
  • The text-to-image e2e mock now flags every other image. The spec passes, and fails with the retry removed.
  • playwright test for both templates, tsc --noEmit in both, templates lint ., lint-npm-lockfiles, and prettier --check pass.

Not verified

  • The chat UI in a browser against the real model. I checked the stream with curl; chat.js already reads choices[0].delta.content.
  • The deployed live demos. They redeploy when this merges.

Workers AI retired @cf/stabilityai/stable-diffusion-xl-base-1.0 and
@cf/meta/llama-3.1-8b-instruct-fp8 on 2026-11-20, which broke
text-to-image-template and the chat in llm-chat-app-template.

text-to-image-template now uses @cf/black-forest-labs/flux-2-klein-9b,
the recommended replacement. It takes multipart input, returns a base64
image, and can reject a generated image with error 3030, so the Worker
retries once on 3030 and sets Content-Type from the image bytes.

llm-chat-app-template now uses @cf/google/gemma-4-26b-a4b-it with
reasoning turned off, since the chat UI only shows the answer.
@github-actions

Copy link
Copy Markdown
Contributor

Dashboard preview link

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