diff --git a/includes/admin/fields/class-open-router-model-field.php b/includes/admin/fields/class-open-router-model-field.php index 3efcba5..e939779 100644 --- a/includes/admin/fields/class-open-router-model-field.php +++ b/includes/admin/fields/class-open-router-model-field.php @@ -23,40 +23,20 @@ class PRAutoBlogger_OpenRouter_Model_Field { * @param string $value Current model id (e.g. 'google/gemini-2.5-flash-lite'). * @param array $args Field definition from settings fields. */ - /** - * Static Cloudflare Workers AI model definitions. - * - * These don't come from an API registry — Cloudflare has only two FLUX - * models and pricing is stable. Costs are per-image at 1024×632 (default). - * - * @var array - */ - private const CLOUDFLARE_MODELS = [ - 'flux-1-schnell' => [ - 'name' => 'FLUX.1 [schnell]', - 'provider' => 'Cloudflare', - 'cost_per_image' => '$0.0007', - 'description' => 'Fast + cheap, 4 inference steps', - ], - 'flux-1-dev' => [ - 'name' => 'FLUX.1 [dev]', - 'provider' => 'Cloudflare', - 'cost_per_image' => '$0.0028', - 'description' => 'Higher quality, ~4× cost, 20 steps', - ], - ]; - public static function render( string $id, string $value, array $args ): void { $capability = $args['capability'] ?? 'text→text'; $display_name = $value ?: __( '— Select a model —', 'prautoblogger' ); $display_price = ''; - if ( 'cloudflare_image' === $capability ) { - // Resolve from static Cloudflare model list. - $cf_model = self::CLOUDFLARE_MODELS[ $value ] ?? null; - if ( null !== $cf_model ) { - $display_name = $cf_model['name']; - $display_price = $cf_model['cost_per_image'] . '/image'; + if ( 'image_generation' === $capability ) { + // Resolve from the static image model list defined in settings. + $image_models = PRAutoBlogger_Settings_Fields_Extended::get_image_models(); + foreach ( $image_models as $im ) { + if ( ( $im['id'] ?? '' ) === $value ) { + $display_name = $im['name'] ?? $value; + $display_price = '$' . number_format( (float) ( $im['cost_per_image'] ?? 0 ), 4 ) . '/image'; + break; + } } } else { // Resolve from the OpenRouter model registry cache. diff --git a/prautoblogger.php b/prautoblogger.php index e2628d3..5aca883 100644 --- a/prautoblogger.php +++ b/prautoblogger.php @@ -8,7 +8,7 @@ declare(strict_types=1); * Plugin Name: PRAutoBlogger * Plugin URI: https://peptiderepo.com/prautoblogger * Description: Monitors social media for trending topics, generates SEO-friendly blog posts using AI, and publishes them on a daily schedule with full cost tracking and self-improvement metrics. - * Version: 0.2.4 + * Version: 0.2.5 * Requires at least: 6.0 * Requires PHP: 7.4 * Author: PeptideRepo @@ -35,7 +35,7 @@ if ( ! defined( 'ABSPATH' ) ) { | and limits without magic strings. */ -define( 'PRAUTOBLOGGER_VERSION', '0.2.4' ); +define( 'PRAUTOBLOGGER_VERSION', '0.2.5' ); define( 'PRAUTOBLOGGER_DB_VERSION', '1.1.0' ); define( 'PRAUTOBLOGGER_PLUGIN_FILE', __FILE__ ); define( 'PRAUTOBLOGGER_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );