From 5b5286ca5b4d5896726136a46a377330bee2cf16 Mon Sep 17 00:00:00 2001 From: peptiderepo Date: Sat, 18 Apr 2026 07:48:18 +0700 Subject: [PATCH] fix: remove deprecated flux-1-dev model from Cloudflare image config FLUX.1 [dev] was removed from Cloudflare Workers AI in April 2026, returning HTTP 400 "No route for that URI". This removes it from the static model picker list and pricing calculations. Any saved setting referencing flux-1-dev gracefully falls through to flux-1-schnell via the null-coalesce in resolve_model(). Co-Authored-By: Claude Opus 4.6 --- includes/admin/class-admin-page.php | 13 +------------ .../class-cloudflare-image-pricing.php | 18 +++++++++--------- 2 files changed, 10 insertions(+), 21 deletions(-) diff --git a/includes/admin/class-admin-page.php b/includes/admin/class-admin-page.php index fa6381c..a32b0e5 100755 --- a/includes/admin/class-admin-page.php +++ b/includes/admin/class-admin-page.php @@ -81,6 +81,7 @@ class PRAutoBlogger_Admin_Page { 'testingText' => __( 'Testing...', 'prautoblogger' ), 'testText' => __( 'Test Connections', 'prautoblogger' ), // Static Cloudflare image models for the picker (no registry API for these). + // FLUX.1 [dev] removed from Cloudflare Workers AI in April 2026. 'cloudflareModels' => [ [ 'id' => 'flux-1-schnell', @@ -94,18 +95,6 @@ class PRAutoBlogger_Admin_Page { 'deprecated' => false, 'description' => __( 'Fast + cheap (4 steps). Default choice.', 'prautoblogger' ), ], - [ - 'id' => 'flux-1-dev', - 'name' => 'FLUX.1 [dev]', - 'provider' => 'cloudflare', - 'context_length' => 0, - 'input_price_per_m' => 0, - 'output_price_per_m' => 0, - 'cost_per_image' => 0.0028, - 'capabilities' => [ 'cloudflare_image' ], - 'deprecated' => false, - 'description' => __( 'Higher quality (20 steps), ~4× cost.', 'prautoblogger' ), - ], ], ] ); } diff --git a/includes/providers/class-cloudflare-image-pricing.php b/includes/providers/class-cloudflare-image-pricing.php index c7e65dd..b1b2e6f 100644 --- a/includes/providers/class-cloudflare-image-pricing.php +++ b/includes/providers/class-cloudflare-image-pricing.php @@ -19,19 +19,22 @@ class PRAutoBlogger_Cloudflare_Image_Pricing { /** * Cloudflare Workers AI FLUX pricing (USD per megapixel), April 2026. - * Single source of truth — update here if Cloudflare repricies. + * Single source of truth — update here if Cloudflare reprices. */ private const COST_PER_MP_SCHNELL_USD = 0.0011; - private const COST_MULTIPLIER_DEV = 4.0; /** * Short-alias → fully-qualified Workers AI model id. * + * FLUX.1 [dev] was removed from Cloudflare Workers AI in April 2026 + * (returns HTTP 400 "No route for that URI"). Only schnell remains. + * Any saved setting referencing flux-1-dev falls through to schnell + * via the null-coalesce in resolve_model(). + * * @var array */ private const MODEL_ALIAS_MAP = [ 'flux-1-schnell' => '@cf/black-forest-labs/flux-1-schnell', - 'flux-1-dev' => '@cf/black-forest-labs/flux-1-dev', ]; /** @@ -58,9 +61,9 @@ class PRAutoBlogger_Cloudflare_Image_Pricing { /** * Estimate USD cost for a single image at the given dimensions. * - * FLUX is priced per megapixel of output. Schnell is the baseline; - * [dev] is a ~4x multiplier. We clamp the MP floor at 0.01 so a - * tiny thumbnail doesn't round to zero and bypass the budget check. + * FLUX is priced per megapixel of output. We clamp the MP floor at + * 0.01 so a tiny thumbnail doesn't round to zero and bypass the + * budget check. * * @param int $width Width in pixels. * @param int $height Height in pixels. @@ -70,9 +73,6 @@ class PRAutoBlogger_Cloudflare_Image_Pricing { public function estimate_cost( int $width, int $height, string $model ): float { $mp = max( 0.01, ( $width * $height ) / 1_000_000 ); $rate = self::COST_PER_MP_SCHNELL_USD; - if ( false !== strpos( $model, 'flux-1-dev' ) ) { - $rate *= self::COST_MULTIPLIER_DEV; - } return round( $mp * $rate, 6 ); } }