fix: update image models, handle upstream errors in HTTP 200

Three issues found in activity logs:

1. Image model IDs stale — FLUX and Seedream removed from OpenRouter.
   Updated to current models: Gemini 2.5/3.1 Flash Image, Gemini 3 Pro
   Image, GPT-5 Image/Mini. Default changed to gemini-2.5-flash-image.

2. openrouter/free router wraps upstream 429 errors in HTTP 200 body
   with error object. Both text and image response parsers now detect
   this pattern and surface a proper RuntimeException.

3. Image request used modalities: ["image"] but Gemini needs
   ["image", "text"]. Updated to include both.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
peptiderepo
2026-04-18 10:47:05 +07:00
parent cf3d97c0c3
commit 862d7e40e6
6 changed files with 63 additions and 45 deletions

View File

@@ -23,16 +23,15 @@ class PRAutoBlogger_OpenRouter_Image_Pricing {
* @var array<string, float>
*/
private const COST_PER_IMAGE = [
'black-forest-labs/flux-2-pro' => 0.03,
'black-forest-labs/flux-1.1-pro' => 0.04,
'black-forest-labs/flux-1.1-pro-ultra' => 0.06,
'bytedance/seedream-3.0' => 0.003,
'google/gemini-2.5-flash-preview:image' => 0.01,
'openai/gpt-image-1' => 0.04,
'google/gemini-2.5-flash-image' => 0.005,
'google/gemini-3.1-flash-image-preview' => 0.008,
'google/gemini-3-pro-image-preview' => 0.03,
'openai/gpt-5-image-mini' => 0.02,
'openai/gpt-5-image' => 0.08,
];
/** @var string Default model when none is configured. */
public const DEFAULT_MODEL = 'black-forest-labs/flux-2-pro';
public const DEFAULT_MODEL = 'google/gemini-2.5-flash-image';
/**
* Resolve the model identifier from a hint, falling back to site option,