v0.9.0: Runware FLUX.1 schnell as default image provider

New Runware image backend at ~$0.0006/image (FLUX.1 schnell) — 65× cheaper
than Gemini 2.5 Flash Image. Provider mirrors OpenRouter's split: interface
+ provider + support + pricing + batch, all under the 300-line cap. Batch
class uses curl_multi for true parallel A/B dispatch — wall-clock drops to
the slowest single image instead of the sum.

Changes:
- Add PRAutoBlogger_Runware_Image_Provider + Pricing + Support + Batch
- Flip PRAUTOBLOGGER_DEFAULT_IMAGE_PROVIDER/MODEL to runware:100@1
- Add prautoblogger_runware_api_key settings field (encrypted at rest)
- v0.9.0 one-time migration flips legacy default model + re-derives provider
- Wire runware branch into Image_Pipeline::create_default_provider()
- Add runware:100@1 and runware:101@1 to Image_Model_Registry (defaults top)
- Update image prompt builder: no more anthropomorphized molecules;
  prefer concrete human-scale scenes (gym bros, doctors, scientists)
- ARCHITECTURE.md + CHANGELOG.md updated with new integration + decision
- Unit tests for pricing, support, provider; update model registry test

Cost impact at 100 images/day (50 articles × A/B):
- Before (Gemini via OpenRouter): $3.90/day ≈ $117/mo
- After  (FLUX schnell via Runware): $0.06/day ≈ $1.80/mo
Net saving: ~$115/mo
This commit is contained in:
peptiderepo
2026-04-21 15:56:35 +00:00
parent 80a7e11a2b
commit 2cacaa3512
18 changed files with 1613 additions and 28 deletions

View File

@@ -18,7 +18,7 @@ class ImageModelRegistryTest extends BaseTestCase {
/**
* Every entry returned by get_models() must carry a non-empty id and
* a provider of 'openrouter' or 'cloudflare'. If this breaks, the
* a provider of 'runware', 'openrouter', or 'cloudflare'. If this breaks, the
* admin save flow will silently drop the provider derivation.
*/
public function test_every_registry_entry_has_id_and_known_provider(): void {
@@ -31,7 +31,7 @@ class ImageModelRegistryTest extends BaseTestCase {
$this->assertArrayHasKey( 'provider', $model );
$this->assertContains(
$model['provider'],
[ 'openrouter', 'cloudflare' ],
[ 'runware', 'openrouter', 'cloudflare' ],
sprintf( 'Unexpected provider %s for model %s', (string) $model['provider'], (string) $model['id'] )
);
}
@@ -52,6 +52,22 @@ class ImageModelRegistryTest extends BaseTestCase {
);
}
/**
* Runware model ids (added v0.9.0) resolve to the 'runware' provider.
* This test pins the v0.9.0 default flip so a registry regression
* that loses the Runware entries fails CI loudly.
*/
public function test_provider_for_runware_models(): void {
$this->assertSame(
'runware',
\PRAutoBlogger_Image_Model_Registry::provider_for( 'runware:100@1' )
);
$this->assertSame(
'runware',
\PRAutoBlogger_Image_Model_Registry::provider_for( 'runware:101@1' )
);
}
/**
* Unknown model ids return an empty string so callers can distinguish
* "not in registry" from a valid provider and show a settings error.