Compare commits

...

3 Commits

Author SHA1 Message Date
peptiderepo
236787ad09 fix: expand Runware pricing whitelist to all 15 registry models (v0.14.0)
All Runware model selections except schnell and dev were silently falling
back to runware:100@1 (FLUX.1 schnell) because COST_PER_IMAGE only had 2
entries while the image model registry (v0.13.8) expanded to 15 models.

resolve_model() falls back to schnell for any ID not in COST_PER_IMAGE,
so SD3, FLUX.2, HiDream, TwinFlow, Z-Image, Qwen-Image, Krea, and
GLM-Image all generated schnell images regardless of admin selection.

Fix: add all 15 Runware model IDs to COST_PER_IMAGE and DEFAULT_STEPS
with costs from runware.ai/pricing (April 2026). Add @see cross-ref to
the registry to prevent future drift when new models are added.
2026-04-26 04:05:39 +00:00
peptiderepo
ca82e395f4 fix: model picker price sort broken for image models (v0.13.9)
applySort() always read input_price_per_m for price sorting, but image
models carry cost_per_image instead — input_price_per_m is undefined on
them, so every image model got an effective price of 0 and the sort was a
no-op.

Fix: detect image models via cost_per_image !== undefined and use that
field when present; fall back to input_price_per_m for text models.

Files changed:
- assets/js/model-picker.js — applySort price branch
- prautoblogger.php        — version bump 0.13.8 → 0.13.9
- CHANGELOG.md             — release notes
2026-04-26 02:36:56 +00:00
peptiderepo
3f60ecd0ff feat: expand image model registry to 21 models (v0.13.8)
Adds 13 new Runware text-to-image models and openai/gpt-5.4-image-2 via OpenRouter.
All models live-verified 2026-04-26.
2026-04-26 03:49:25 +07:00
6 changed files with 288 additions and 32 deletions

View File

@@ -1,5 +1,46 @@
# Changelog # Changelog
All notable changes to PRAutoBlogger will be documented in this file.
Format follows [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project uses [Semantic Versioning](https://semver.org/).
## [0.14.0] - 2026-04-26
### Fixed
- Runware image generation now correctly uses the admin-selected model instead
of silently falling back to FLUX.1 schnell (runware:100@1) for all non-schnell
and non-dev selections. Root cause: `class-runware-image-pricing.php` only
had 2 models in its `COST_PER_IMAGE` whitelist (schnell + dev), but the
image model registry was expanded to 15 Runware models in v0.13.8 without a
matching update to the pricing class. Any model ID not in the whitelist caused
`resolve_model()` to fall back to schnell, so every Stable Diffusion, FLUX.2,
HiDream, TwinFlow, Z-Image, Qwen-Image, Krea, and GLM-Image selection was
silently downgraded.
- Added all 15 Runware model IDs to `COST_PER_IMAGE` and `DEFAULT_STEPS` with
correct per-image costs and step counts sourced from runware.ai/pricing (April 2026).
- Added `@see` cross-reference to `class-image-model-registry.php` in pricing
class docblock to prevent future drift.
## [0.13.9] - 2026-04-26
### Fixed
- Model picker sort by price now works correctly for image models — previously
\`applySort\` always read \`input_price_per_m\` (undefined on image models),
so every image had an effective price of 0 and price sort was a no-op.
Fix: detect image models via \`cost_per_image\` and use that field instead.
## [0.13.8] - 2026-04-26
### Added
- Image model picker expanded from 7 to 21 models
- New Runware text-to-image models: Stable Diffusion 3, HiDream-I1 Full/Dev/Fast,
FLUX.1 Krea [dev], Qwen-Image, FLUX.2 [dev], FLUX.2 [klein] 9B, FLUX.2 [klein] 4B,
GLM-Image, Z-Image, Z-Image-Turbo, TwinFlow Z-Image-Turbo
- New OpenRouter model: openai/gpt-5.4-image-2
- Registry now includes last-verified date and update instructions in source comment
All notable changes to PRAutoBlogger will be documented in this file. All notable changes to PRAutoBlogger will be documented in this file.
Format follows [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), Format follows [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),

View File

@@ -101,8 +101,9 @@
var valA, valB; var valA, valB;
if ( col === 'price' ) { if ( col === 'price' ) {
valA = a.input_price_per_m || 0; // Image models use cost_per_image; text models use input_price_per_m.
valB = b.input_price_per_m || 0; valA = ( a.cost_per_image !== undefined ) ? a.cost_per_image : ( a.input_price_per_m || 0 );
valB = ( b.cost_per_image !== undefined ) ? b.cost_per_image : ( b.input_price_per_m || 0 );
} else if ( col === 'context' ) { } else if ( col === 'context' ) {
valA = a.context_length || 0; valA = a.context_length || 0;
valB = b.context_length || 0; valB = b.context_length || 0;

View File

@@ -8,6 +8,8 @@ declare(strict_types=1);
* *
* What: Returns a hardcoded list of image models for the admin model picker. * What: Returns a hardcoded list of image models for the admin model picker.
* No API discovery — updated manually when providers add/remove models. * No API discovery — updated manually when providers add/remove models.
* As of 2026-04-26, registry includes 21 models across Runware (15) and
* OpenRouter (6), ordered cheapest-to-most-expensive within each provider.
* Who calls it: PRAutoBlogger_Admin_Page (model picker UI + save-time provider * Who calls it: PRAutoBlogger_Admin_Page (model picker UI + save-time provider
* derivation) and PRAutoBlogger_Image_Pipeline (provider lookup). * derivation) and PRAutoBlogger_Image_Pipeline (provider lookup).
* Dependencies: None. * Dependencies: None.
@@ -32,10 +34,15 @@ class PRAutoBlogger_Image_Model_Registry {
* Ordered cheapest-to-most-expensive within each provider, with the * Ordered cheapest-to-most-expensive within each provider, with the
* recommended default (Runware schnell) at the top. * recommended default (Runware schnell) at the top.
* *
* Last verified: 2026-04-26. To update: check https://runware.ai/models (text-to-image section)
* and https://openrouter.ai/api/v1/models filtering output_modalities containing 'image'.
* Exclude: inpainting (needs mask), img2img (needs seedImage), video, upscalers, background removal.
*
* @return array<int, array<string, mixed>> * @return array<int, array<string, mixed>>
*/ */
public static function get_models(): array { public static function get_models(): array {
return array( return array(
// RUNWARE MODELS
array( array(
'id' => 'runware:100@1', 'id' => 'runware:100@1',
'name' => 'FLUX.1 schnell (Runware)', 'name' => 'FLUX.1 schnell (Runware)',
@@ -44,17 +51,122 @@ class PRAutoBlogger_Image_Model_Registry {
'capabilities' => array( 'image_generation' ), 'capabilities' => array( 'image_generation' ),
'description' => __( 'Default. Fast, very cheap, comic-friendly fidelity.', 'prautoblogger' ), 'description' => __( 'Default. Fast, very cheap, comic-friendly fidelity.', 'prautoblogger' ),
), ),
array(
'id' => 'runware:twinflow-z-image-turbo@0',
'name' => 'TwinFlow Z-Image-Turbo (Runware)',
'provider' => 'runware',
'cost_per_image' => 0.0006,
'capabilities' => array( 'image_generation' ),
'description' => __( 'Fast text-to-image, same cost as schnell.', 'prautoblogger' ),
),
array(
'id' => 'runware:400@2',
'name' => 'FLUX.2 klein 9B (Runware)',
'provider' => 'runware',
'cost_per_image' => 0.00078,
'capabilities' => array( 'image_generation' ),
'description' => __( 'FLUX.2 compact 9B. Stronger than schnell at similar cost.', 'prautoblogger' ),
),
array(
'id' => 'runware:400@4',
'name' => 'FLUX.2 klein 4B (Runware)',
'provider' => 'runware',
'cost_per_image' => 0.0006,
'capabilities' => array( 'image_generation' ),
'description' => __( 'FLUX.2 compact 4B. Newer architecture at schnell price.', 'prautoblogger' ),
),
array(
'id' => 'runware:5@1',
'name' => 'Stable Diffusion 3 (Runware)',
'provider' => 'runware',
'cost_per_image' => 0.0013,
'capabilities' => array( 'image_generation' ),
'description' => __( 'Stable Diffusion 3. Sharp text, complex scenes.', 'prautoblogger' ),
),
array(
'id' => 'runware:z-image@turbo',
'name' => 'Z-Image Turbo (Runware)',
'provider' => 'runware',
'cost_per_image' => 0.0013,
'capabilities' => array( 'image_generation' ),
'description' => __( 'Fast photorealistic generation.', 'prautoblogger' ),
),
array( array(
'id' => 'runware:101@1', 'id' => 'runware:101@1',
'name' => 'FLUX.1 dev (Runware)', 'name' => 'FLUX.1 dev (Runware)',
'provider' => 'runware', 'provider' => 'runware',
'cost_per_image' => 0.02, 'cost_per_image' => 0.02,
'capabilities' => array( 'image_generation' ), 'capabilities' => array( 'image_generation' ),
'description' => __( 'Higher fidelity FLUX. ~30x schnell cost.', 'prautoblogger' ), 'description' => __( 'Higher fidelity FLUX.1. ~30x schnell cost.', 'prautoblogger' ),
), ),
array(
'id' => 'runware:97@3',
'name' => 'HiDream-I1 Fast (Runware)',
'provider' => 'runware',
'cost_per_image' => 0.0038,
'capabilities' => array( 'image_generation' ),
'description' => __( 'HiDream-I1 Fast. Low latency, 17B quality.', 'prautoblogger' ),
),
array(
'id' => 'runware:97@2',
'name' => 'HiDream-I1 Dev (Runware)',
'provider' => 'runware',
'cost_per_image' => 0.0045,
'capabilities' => array( 'image_generation' ),
'description' => __( 'HiDream-I1 Dev. Strong prompt alignment.', 'prautoblogger' ),
),
array(
'id' => 'runware:z-image@0',
'name' => 'Z-Image (Runware)',
'provider' => 'runware',
'cost_per_image' => 0.0045,
'capabilities' => array( 'image_generation' ),
'description' => __( 'High-quality Z-Image foundation model.', 'prautoblogger' ),
),
array(
'id' => 'runware:400@1',
'name' => 'FLUX.2 dev (Runware)',
'provider' => 'runware',
'cost_per_image' => 0.0051,
'capabilities' => array( 'image_generation' ),
'description' => __( 'FLUX.2 dev. Controllable open text-to-image. From $0.0051.', 'prautoblogger' ),
),
array(
'id' => 'runware:108@1',
'name' => 'Qwen-Image (Runware)',
'provider' => 'runware',
'cost_per_image' => 0.0058,
'capabilities' => array( 'image_generation' ),
'description' => __( 'Alibaba Qwen-Image. Strong text rendering in generated images.', 'prautoblogger' ),
),
array(
'id' => 'runware:97@1',
'name' => 'HiDream-I1 Full (Runware)',
'provider' => 'runware',
'cost_per_image' => 0.009,
'capabilities' => array( 'image_generation' ),
'description' => __( 'HiDream-I1 Full. 17B high-fidelity, LoRA support.', 'prautoblogger' ),
),
array(
'id' => 'runware:107@1',
'name' => 'FLUX.1 Krea dev (Runware)',
'provider' => 'runware',
'cost_per_image' => 0.0098,
'capabilities' => array( 'image_generation' ),
'description' => __( 'FLUX.1 Krea Dev. Photorealistic open-weight generation.', 'prautoblogger' ),
),
array(
'id' => 'runware:glm-image@0',
'name' => 'GLM-Image (Runware)',
'provider' => 'runware',
'cost_per_image' => 0.0225,
'capabilities' => array( 'image_generation' ),
'description' => __( 'GLM-Image. Hybrid autoregressive+diffusion, excellent text rendering.', 'prautoblogger' ),
),
// OPENROUTER MODELS
array( array(
'id' => 'google/gemini-2.5-flash-image', 'id' => 'google/gemini-2.5-flash-image',
'name' => 'Gemini 2.5 Flash Image (Nano Banana)', 'name' => 'Gemini 2.5 Flash Image (OpenRouter)',
'provider' => 'openrouter', 'provider' => 'openrouter',
'cost_per_image' => 0.005, 'cost_per_image' => 0.005,
'capabilities' => array( 'image_generation' ), 'capabilities' => array( 'image_generation' ),
@@ -62,31 +174,39 @@ class PRAutoBlogger_Image_Model_Registry {
), ),
array( array(
'id' => 'google/gemini-3.1-flash-image-preview', 'id' => 'google/gemini-3.1-flash-image-preview',
'name' => 'Gemini 3.1 Flash Image (Nano Banana 2)', 'name' => 'Gemini 3.1 Flash Image (OpenRouter)',
'provider' => 'openrouter', 'provider' => 'openrouter',
'cost_per_image' => 0.008, 'cost_per_image' => 0.008,
'capabilities' => array( 'image_generation' ), 'capabilities' => array( 'image_generation' ),
'description' => __( 'Latest Google. Better quality.', 'prautoblogger' ), 'description' => __( 'Latest Google Flash image. Better quality.', 'prautoblogger' ),
),
array(
'id' => 'google/gemini-3-pro-image-preview',
'name' => 'Gemini 3 Pro Image (Nano Banana Pro)',
'provider' => 'openrouter',
'cost_per_image' => 0.03,
'capabilities' => array( 'image_generation' ),
'description' => __( 'Highest quality Google. Premium.', 'prautoblogger' ),
), ),
array( array(
'id' => 'openai/gpt-5-image-mini', 'id' => 'openai/gpt-5-image-mini',
'name' => 'GPT-5 Image Mini', 'name' => 'GPT-5 Image Mini (OpenRouter)',
'provider' => 'openrouter', 'provider' => 'openrouter',
'cost_per_image' => 0.02, 'cost_per_image' => 0.02,
'capabilities' => array( 'image_generation' ), 'capabilities' => array( 'image_generation' ),
'description' => __( 'OpenAI budget image model.', 'prautoblogger' ), 'description' => __( 'OpenAI budget image model.', 'prautoblogger' ),
), ),
array(
'id' => 'openai/gpt-5.4-image-2',
'name' => 'GPT-5.4 Image 2 (OpenRouter)',
'provider' => 'openrouter',
'cost_per_image' => 0.02,
'capabilities' => array( 'image_generation' ),
'description' => __( 'OpenAI GPT-5.4 image generation.', 'prautoblogger' ),
),
array(
'id' => 'google/gemini-3-pro-image-preview',
'name' => 'Gemini 3 Pro Image (OpenRouter)',
'provider' => 'openrouter',
'cost_per_image' => 0.03,
'capabilities' => array( 'image_generation' ),
'description' => __( 'Highest quality Google image. Premium.', 'prautoblogger' ),
),
array( array(
'id' => 'openai/gpt-5-image', 'id' => 'openai/gpt-5-image',
'name' => 'GPT-5 Image', 'name' => 'GPT-5 Image (OpenRouter)',
'provider' => 'openrouter', 'provider' => 'openrouter',
'cost_per_image' => 0.08, 'cost_per_image' => 0.08,
'capabilities' => array( 'image_generation' ), 'capabilities' => array( 'image_generation' ),

View File

@@ -6,44 +6,86 @@ declare(strict_types=1);
* *
* Pricing + model-id resolution helpers for the Runware image provider. * Pricing + model-id resolution helpers for the Runware image provider.
* *
* Each Runware FLUX model has a flat per-image cost sourced from * Each Runware model has a flat per-image cost sourced from
* runware.ai/pricing (April 2026). Unlike OpenRouter models, Runware * runware.ai/pricing (April 2026). Unlike OpenRouter models, Runware
* prices scale slightly with steps — the quoted rate here assumes the * prices scale slightly with steps — the quoted rate here assumes the
* provider's default step count (4 for schnell, 28 for dev). * provider's default step count for each model.
* *
* Triggered by: PRAutoBlogger_Runware_Image_Provider, PRAutoBlogger_Runware_Image_Batch. * Triggered by: PRAutoBlogger_Runware_Image_Provider, PRAutoBlogger_Runware_Image_Batch.
* Dependencies: None — pure calculation + option reads. * Dependencies: None — pure calculation + option reads.
* *
* @see class-runware-image-provider.php — Primary caller. * @see class-runware-image-provider.php — Primary caller.
* @see class-open-router-image-pricing.php — Sibling pattern for OpenRouter. * @see class-open-router-image-pricing.php — Sibling pattern for OpenRouter.
* @see admin/class-image-model-registry.php — Source of truth for model list; keep in sync.
*/ */
class PRAutoBlogger_Runware_Image_Pricing { class PRAutoBlogger_Runware_Image_Pricing {
/** /**
* Flat per-image cost (USD) for each supported Runware model, April 2026. * Flat per-image cost (USD) for each supported Runware model, April 2026.
* Update here when Runware reprices or new models launch. * Update here when Runware reprices or new models launch. Must stay in
* sync with the model list in PRAutoBlogger_Image_Model_Registry — any
* model listed there that is absent here will silently fall back to schnell.
* *
* Runware model IDs use `family:variant@version` form. The two FLUX * Runware model IDs use `family:variant@version` form.
* variants we support are the CEO-sanctioned defaults.
* *
* @var array<string, float> * @var array<string, float>
*/ */
private const COST_PER_IMAGE = array( private const COST_PER_IMAGE = array(
// FLUX.1 schnell — 4-step distilled. Our new default (2026-04-21). // FLUX.1 schnell — 4-step distilled. Default (2026-04-21).
'runware:100@1' => 0.0006, 'runware:100@1' => 0.0006,
// FLUX.1 dev — 28-step full model. Higher fidelity, ~30x cost. // TwinFlow Z-Image-Turbo — fast text-to-image, same cost as schnell.
'runware:twinflow-z-image-turbo@0' => 0.0006,
// FLUX.2 klein 4B — newer architecture at schnell price.
'runware:400@4' => 0.0006,
// FLUX.2 klein 9B — stronger than schnell, similar cost.
'runware:400@2' => 0.00078,
// Stable Diffusion 3 — sharp text, complex scenes.
'runware:5@1' => 0.0013,
// Z-Image Turbo — fast photorealistic generation.
'runware:z-image@turbo' => 0.0013,
// HiDream-I1 Fast — low latency, 17B quality.
'runware:97@3' => 0.0038,
// HiDream-I1 Dev — strong prompt alignment.
'runware:97@2' => 0.0045,
// Z-Image — high-quality foundation model.
'runware:z-image@0' => 0.0045,
// FLUX.2 dev — controllable open text-to-image.
'runware:400@1' => 0.0051,
// Qwen-Image — strong text rendering in generated images.
'runware:108@1' => 0.0058,
// HiDream-I1 Full — 17B high-fidelity, LoRA support.
'runware:97@1' => 0.009,
// FLUX.1 Krea dev — photorealistic open-weight generation.
'runware:107@1' => 0.0098,
// FLUX.1 dev — 28-step full model. Higher fidelity, ~30x schnell cost.
'runware:101@1' => 0.02, 'runware:101@1' => 0.02,
// GLM-Image — hybrid autoregressive+diffusion, excellent text rendering.
'runware:glm-image@0' => 0.0225,
); );
/** /**
* Default number of inference steps per model. Runware bills per image * Default number of inference steps per model. Runware bills per image
* at the model's standard step count; custom step counts may alter price. * at the model's standard step count; custom step counts may alter price.
* Sources: runware.ai/models (April 2026).
* *
* @var array<string, int> * @var array<string, int>
*/ */
private const DEFAULT_STEPS = array( private const DEFAULT_STEPS = array(
'runware:100@1' => 4, 'runware:100@1' => 4,
'runware:twinflow-z-image-turbo@0' => 4,
'runware:400@4' => 20,
'runware:400@2' => 20,
'runware:5@1' => 28,
'runware:z-image@turbo' => 4,
'runware:97@3' => 16,
'runware:97@2' => 28,
'runware:z-image@0' => 28,
'runware:400@1' => 28,
'runware:108@1' => 20,
'runware:97@1' => 50,
'runware:107@1' => 28,
'runware:101@1' => 28, 'runware:101@1' => 28,
'runware:glm-image@0' => 30,
); );
/** /**
@@ -77,9 +119,9 @@ class PRAutoBlogger_Runware_Image_Pricing {
/** /**
* Estimate USD cost for a single image at the given model. * Estimate USD cost for a single image at the given model.
* *
* Runware FLUX pricing is flat per image at the model's standard step * Runware pricing is flat per image at the model's standard step count.
* count. Width/height are accepted for interface compatibility but do * Width/height are accepted for interface compatibility but do not affect
* not affect cost for the variants we support. * cost for the variants we support.
* *
* @param int $width Width in pixels (unused for flat pricing). * @param int $width Width in pixels (unused for flat pricing).
* @param int $height Height in pixels (unused for flat pricing). * @param int $height Height in pixels (unused for flat pricing).

View File

@@ -9,7 +9,7 @@
* Plugin Name: PRAutoBlogger * Plugin Name: PRAutoBlogger
* Plugin URI: https://peptiderepo.com/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. * 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.13.7 * Version: 0.14.0
* Requires at least: 6.0 * Requires at least: 6.0
* Requires PHP: 7.4 * Requires PHP: 7.4
* Author: PeptideRepo * Author: PeptideRepo
@@ -35,7 +35,7 @@ if ( ! defined( 'ABSPATH' ) ) {
| Defined here so every file in the plugin can reference paths, versions, | Defined here so every file in the plugin can reference paths, versions,
| and limits without magic strings. | and limits without magic strings.
*/ */
define( 'PRAUTOBLOGGER_VERSION', '0.13.7' ); define( 'PRAUTOBLOGGER_VERSION', '0.14.0' );
define( 'PRAUTOBLOGGER_DB_VERSION', '1.1.0' ); define( 'PRAUTOBLOGGER_DB_VERSION', '1.1.0' );
define( 'PRAUTOBLOGGER_PLUGIN_FILE', __FILE__ ); define( 'PRAUTOBLOGGER_PLUGIN_FILE', __FILE__ );
define( 'PRAUTOBLOGGER_PLUGIN_DIR', plugin_dir_path( __FILE__ ) ); define( 'PRAUTOBLOGGER_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );

View File

@@ -99,4 +99,56 @@ class ImageModelRegistryTest extends BaseTestCase {
\PRAutoBlogger_Image_Model_Registry::provider_for( '' ) \PRAutoBlogger_Image_Model_Registry::provider_for( '' )
); );
} }
/**
* Test that runware:400@4 resolves to runware provider.
*/
public function test_provider_for_runware_400_at_4(): void {
$this->assertSame(
'runware',
\PRAutoBlogger_Image_Model_Registry::provider_for( 'runware:400@4' )
);
}
/**
* Test that runware:glm-image@0 resolves to runware provider.
*/
public function test_provider_for_runware_glm_image(): void {
$this->assertSame(
'runware',
\PRAutoBlogger_Image_Model_Registry::provider_for( 'runware:glm-image@0' )
);
}
/**
* Test that openai/gpt-5.4-image-2 resolves to openrouter provider.
*/
public function test_provider_for_gpt_5_4_image_2(): void {
$this->assertSame(
'openrouter',
\PRAutoBlogger_Image_Model_Registry::provider_for( 'openai/gpt-5.4-image-2' )
);
}
/**
* Test that get_models() returns 21 models.
*/
public function test_get_models_returns_21_models(): void {
$models = \PRAutoBlogger_Image_Model_Registry::get_models();
$this->assertCount( 21, $models );
}
/**
* Test that every model has required non-empty fields.
*/
public function test_every_model_has_required_fields(): void {
$models = \PRAutoBlogger_Image_Model_Registry::get_models();
foreach ( $models as $model ) {
$this->assertNotEmpty( $model['id'] ?? '', 'Model missing id' );
$this->assertNotEmpty( $model['name'] ?? '', 'Model missing name' );
$this->assertNotEmpty( $model['provider'] ?? '', 'Model missing provider' );
$this->assertTrue( isset( $model['cost_per_image'] ), 'Model missing cost_per_image' );
$this->assertIsNumeric( $model['cost_per_image'], 'cost_per_image is not numeric' );
}
}
} }