feat: add OpenRouter image provider for higher-quality image generation
Replaces Cloudflare Workers AI (FLUX.1 schnell) as the default image provider with OpenRouter, which offers FLUX.2 Pro, Seedream 3.0, Gemini Flash Image, and GPT Image 1 at comparable or better pricing. - New provider class (3-file split: provider, pricing, support) reuses the existing OpenRouter API key and Cloudflare AI Gateway - Admin settings: new Image Provider dropdown (openrouter/cloudflare), model picker shows all available image models from both providers - Image pipeline auto-selects the configured provider at construction - Cost logging now uses actual model name instead of hardcoded flux-1-schnell - Default model changed to black-forest-labs/flux-2-pro ($0.03/image) - Unit tests for pricing resolution and provider response parsing Cost impact: FLUX.2 Pro at $0.03/image vs schnell at $0.0007/image — ~43x more expensive per image, but dramatically better quality. At 2 images/article × 1 article/day = ~$1.80/month. Seedream 3.0 ($0.003) available as a budget alternative. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -22,10 +22,10 @@
|
||||
* @return {jQuery.Deferred} Resolves with model array.
|
||||
*/
|
||||
function fetchModels(capability) {
|
||||
// Cloudflare image models are embedded in the page config — no AJAX needed.
|
||||
if (capability === 'cloudflare_image') {
|
||||
var cfModels = config.cloudflareModels || [];
|
||||
return $.Deferred().resolve(cfModels);
|
||||
// Image models are embedded in the page config — no AJAX needed.
|
||||
if (capability === 'image_generation') {
|
||||
var imgModels = config.imageModels || [];
|
||||
return $.Deferred().resolve(imgModels);
|
||||
}
|
||||
|
||||
if (cachedModels) {
|
||||
@@ -160,8 +160,8 @@
|
||||
var capability = $trigger.data('capability') || '';
|
||||
|
||||
// Build overlay + popup structure.
|
||||
var isCloudflare = capability === 'cloudflare_image';
|
||||
var priceLabel = isCloudflare ? 'Cost per generated image' : 'Prices per 1M tokens (in / out)';
|
||||
var isImageCap = capability === 'image_generation';
|
||||
var priceLabel = isImageCap ? 'Cost per generated image' : 'Prices per 1M tokens (in / out)';
|
||||
|
||||
var $overlay = $('<div class="ab-mp-overlay"></div>');
|
||||
var $popup = $(
|
||||
|
||||
Reference in New Issue
Block a user