PluginProbe
BotWriter – AI Writer & SEO Content Generator / 3.2.8
BotWriter – AI Writer & SEO Content Generator v3.2.8
3.4.10 3.4.9 3.4.8 3.4.7 3.4.6 3.4.4 3.4.2 3.4.1 3.4.0 3.3.9 3.3.8 3.3.7 3.3.6 3.3.5 3.3.4 3.3.3 3.3.2 3.3.1 3.3.0 3.2.8 trunk 1.3.0 1.3.1 1.3.2 1.3.3 All 51 releases
botwriter / includes / settings / fal.php

fal.php in BotWriter – AI Writer & SEO Content Generator 3.2.8, at includes/settings/fal.php

252 lines 11.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Fal.ai Image Provider Settings
4 *
5 * @package BotWriter
6 */
7
8 if (!defined('ABSPATH')) {
9 exit;
10 }
11
12 /**
13 * Get Fal.ai models configuration
14 * Updated: December 2025 with latest models
15 */
16 function botwriter_get_fal_models() {
17 return [
18 // Google Nano Banana (newest!)
19 'Google' => [
20 'fal-ai/nano-banana-pro' => '🍌 Nano Banana Pro (newest!)',
21 'fal-ai/gemini-3-pro-image-preview' => 'Gemini 3 Pro Image',
22 ],
23 // ByteDance Seedream
24 'ByteDance' => [
25 'fal-ai/bytedance/seedream/v4.5/text-to-image' => 'Seedream 4.5 (newest!)',
26 'fal-ai/bytedance/seedream/v4/text-to-image' => 'Seedream 4.0',
27 ],
28 // Flux 2.x (Latest)
29 'Flux 2.x' => [
30 'fal-ai/flux-2-pro' => 'Flux 2 Pro (best)',
31 'fal-ai/flux-2-flex' => 'Flux 2 Flex',
32 'fal-ai/flux-2' => 'Flux 2 Dev',
33 'fal-ai/flux-2/lora' => 'Flux 2 LoRA',
34 ],
35 // Flux Pro / Kontext
36 'Flux Kontext' => [
37 'fal-ai/flux-pro/kontext/max' => 'Flux Kontext Max',
38 'fal-ai/flux-pro/kontext' => 'Flux Kontext Pro',
39 'fal-ai/flux-kontext-lora' => 'Flux Kontext LoRA',
40 ],
41 // Flux 1.x
42 'Flux 1.x' => [
43 'fal-ai/flux-pro/v1.1' => 'Flux Pro v1.1',
44 'fal-ai/flux/dev' => 'Flux Dev',
45 'fal-ai/flux/schnell' => 'Flux Schnell (ultra fast)',
46 ],
47 // Recraft
48 'Recraft' => [
49 'fal-ai/recraft/v3/text-to-image' => 'Recraft V3 (SOTA)',
50 ],
51 // Qwen Image
52 'Qwen' => [
53 'fal-ai/qwen-image' => 'Qwen Image (best text)',
54 ],
55 // Other Notable
56 'Other' => [
57 'fal-ai/z-image/turbo' => 'Z-Image Turbo (super fast)',
58 'fal-ai/piflow' => 'PiFlow (fast, quality)',
59 'fal-ai/flux-realism' => 'Flux Realism',
60 'fal-ai/flux-lora' => 'Flux LoRA',
61 'imagineart/imagineart-1.5-preview/text-to-image' => 'ImagineArt 1.5',
62 'bria/fibo/generate' => 'Bria Fibo (enterprise)',
63 ],
64 ];
65 }
66
67 /**
68 * Get Fal.ai provider info
69 */
70 function botwriter_get_fal_info() {
71 return [
72 'name' => 'Fal.ai',
73 'description' => __('Fast, reliable inference for Flux and other cutting-edge image models. Known for excellent quality and speed.', 'botwriter'),
74 'website' => 'https://fal.ai',
75 'api_url' => 'https://fal.ai/dashboard/keys',
76 'docs_url' => 'https://docs.fal.ai/',
77 'pricing_url' => 'https://fal.ai/pricing',
78 'free_credits' => __('Free credits on signup for testing', 'botwriter'),
79 'pricing_summary' => [
80 '🍌 Nano Banana Pro' => '~$0.02/image',
81 'Seedream 4.5' => '~$0.03/image',
82 'Flux 2 Pro' => '~$0.05/image',
83 'Flux Pro v1.1' => '~$0.04/image',
84 'Flux Schnell' => '~$0.003/image (ultra cheap!)',
85 'Recraft V3' => '~$0.04/image',
86 'Z-Image Turbo' => '~$0.002/image',
87 ],
88 'features' => [
89 __('Hosts the best Flux models', 'botwriter'),
90 __('Very fast generation (seconds)', 'botwriter'),
91 __('Excellent image quality', 'botwriter'),
92 __('LoRA support for custom styles', 'botwriter'),
93 __('Competitive pricing', 'botwriter'),
94 __('Video generation also available', 'botwriter'),
95 ],
96 'pros' => [
97 __('Best Flux hosting', 'botwriter'),
98 __('Fast inference', 'botwriter'),
99 __('Great documentation', 'botwriter'),
100 __('Flexible pricing', 'botwriter'),
101 ],
102 'cons' => [
103 __('Smaller model selection', 'botwriter'),
104 __('Newer platform', 'botwriter'),
105 ],
106 ];
107 }
108
109 /**
110 * Render Fal.ai settings tab content
111 */
112 function botwriter_render_fal_settings($settings, $is_active) {
113 $info = botwriter_get_fal_info();
114 $models = botwriter_get_fal_models();
115 ?>
116 <div class="provider-config-section">
117 <div class="provider-config-card">
118 <h4><?php esc_html_e('API Configuration', 'botwriter'); ?></h4>
119 <div class="form-row">
120 <label><?php esc_html_e('API Key:', 'botwriter'); ?></label>
121 <div class="api-key-wrapper">
122 <input type="password" name="botwriter_fal_api_key" class="form-control api-key-input"
123 value="<?php echo esc_attr(botwriter_decrypt_api_key(get_option('botwriter_fal_api_key'))); ?>"
124 placeholder="...">
125 <button type="button" class="button toggle-api-key"><?php esc_html_e('Show', 'botwriter'); ?></button>
126 <button type="button" class="button button-secondary test-api-key" data-provider="fal">
127 <span class="dashicons dashicons-yes-alt"></span> <?php esc_html_e('Test API Key', 'botwriter'); ?>
128 </button>
129 <span class="test-api-result"></span>
130 </div>
131 <p class="description"><?php esc_html_e('Get your API key from the Fal.ai dashboard', 'botwriter'); ?></p>
132 </div>
133 <div class="form-row">
134 <label><?php esc_html_e('Model:', 'botwriter'); ?></label>
135 <select name="botwriter_fal_model" class="form-select" style="width: 100%; max-width: 400px;">
136 <?php foreach ($models as $group => $group_models): ?>
137 <optgroup label="<?php echo esc_attr($group); ?>">
138 <?php foreach ($group_models as $id => $name): ?>
139 <option value="<?php echo esc_attr($id); ?>" <?php selected($settings['botwriter_fal_model'], $id); ?>><?php echo esc_html($name); ?></option>
140 <?php endforeach; ?>
141 </optgroup>
142 <?php endforeach; ?>
143 </select>
144 </div>
145 </div>
146
147 <div class="provider-info-card">
148 <h4><span class="dashicons dashicons-info-outline"></span> <?php esc_html_e('How to Get Your API Key', 'botwriter'); ?></h4>
149 <ol class="setup-steps">
150 <li><?php esc_html_e('Go to', 'botwriter'); ?> <a href="https://fal.ai/login" target="_blank">fal.ai</a> <?php esc_html_e('and sign up', 'botwriter'); ?></li>
151 <li><?php esc_html_e('Navigate to', 'botwriter'); ?> <a href="https://fal.ai/dashboard/keys" target="_blank"><?php esc_html_e('Dashboard → API Keys', 'botwriter'); ?></a></li>
152 <li><?php esc_html_e('Click "Create Key"', 'botwriter'); ?></li>
153 <li><?php esc_html_e('Copy and paste the key above', 'botwriter'); ?></li>
154 <li><?php esc_html_e('Add credits at', 'botwriter'); ?> <a href="https://fal.ai/dashboard/billing" target="_blank"><?php esc_html_e('Billing', 'botwriter'); ?></a></li>
155 </ol>
156 <div class="info-tip">
157 <span class="dashicons dashicons-awards"></span>
158 <p><?php esc_html_e('Flux Schnell is incredibly cheap - great for testing and high-volume use!', 'botwriter'); ?></p>
159 </div>
160 </div>
161
162 <div class="provider-pricing-card">
163 <h4><span class="dashicons dashicons-money-alt"></span> <?php esc_html_e('Pricing Overview', 'botwriter'); ?></h4>
164
165 <div class="pricing-highlight">
166 <span class="free-credits-badge"><?php esc_html_e('Free Credits', 'botwriter'); ?></span>
167 <p><?php echo esc_html($info['free_credits']); ?></p>
168 </div>
169
170 <table class="pricing-table">
171 <thead>
172 <tr>
173 <th><?php esc_html_e('Model', 'botwriter'); ?></th>
174 <th><?php esc_html_e('Price', 'botwriter'); ?></th>
175 </tr>
176 </thead>
177 <tbody>
178 <?php foreach ($info['pricing_summary'] as $model => $price): ?>
179 <tr>
180 <td><code><?php echo esc_html($model); ?></code></td>
181 <td><?php echo esc_html($price); ?></td>
182 </tr>
183 <?php endforeach; ?>
184 </tbody>
185 </table>
186
187 <div class="cost-saving-tip">
188 <span class="dashicons dashicons-lightbulb"></span>
189 <strong><?php esc_html_e('Budget Tip:', 'botwriter'); ?></strong>
190 <?php esc_html_e('Flux Schnell at $0.003/image means 333 images per $1!', 'botwriter'); ?>
191 </div>
192
193 <p class="pricing-note">
194 <a href="<?php echo esc_url($info['pricing_url']); ?>" target="_blank" class="button button-secondary">
195 <span class="dashicons dashicons-external"></span> <?php esc_html_e('View Full Pricing', 'botwriter'); ?>
196 </a>
197 </p>
198 </div>
199
200 <div class="provider-features-card">
201 <h4><span class="dashicons dashicons-star-filled"></span> <?php esc_html_e('Features & Benefits', 'botwriter'); ?></h4>
202 <ul class="features-list">
203 <?php foreach ($info['features'] as $feature): ?>
204 <li><span class="dashicons dashicons-yes-alt"></span> <?php echo esc_html($feature); ?></li>
205 <?php endforeach; ?>
206 </ul>
207
208 <div class="pros-cons">
209 <div class="pros">
210 <h5><?php esc_html_e('Pros', 'botwriter'); ?></h5>
211 <ul>
212 <?php foreach ($info['pros'] as $pro): ?>
213 <li><span class="dashicons dashicons-plus-alt2"></span> <?php echo esc_html($pro); ?></li>
214 <?php endforeach; ?>
215 </ul>
216 </div>
217 <div class="cons">
218 <h5><?php esc_html_e('Cons', 'botwriter'); ?></h5>
219 <ul>
220 <?php foreach ($info['cons'] as $con): ?>
221 <li><span class="dashicons dashicons-minus"></span> <?php echo esc_html($con); ?></li>
222 <?php endforeach; ?>
223 </ul>
224 </div>
225 </div>
226 </div>
227
228 <div class="provider-links-card">
229 <h4><span class="dashicons dashicons-admin-links"></span> <?php esc_html_e('Useful Links', 'botwriter'); ?></h4>
230 <div class="links-grid">
231 <a href="<?php echo esc_url($info['api_url']); ?>" target="_blank" class="link-item">
232 <span class="dashicons dashicons-admin-network"></span>
233 <?php esc_html_e('Get API Key', 'botwriter'); ?>
234 </a>
235 <a href="<?php echo esc_url($info['docs_url']); ?>" target="_blank" class="link-item">
236 <span class="dashicons dashicons-book"></span>
237 <?php esc_html_e('Documentation', 'botwriter'); ?>
238 </a>
239 <a href="https://fal.ai/models" target="_blank" class="link-item">
240 <span class="dashicons dashicons-images-alt2"></span>
241 <?php esc_html_e('All Models', 'botwriter'); ?>
242 </a>
243 <a href="https://status.fal.ai/" target="_blank" class="link-item">
244 <span class="dashicons dashicons-heart"></span>
245 <?php esc_html_e('Status', 'botwriter'); ?>
246 </a>
247 </div>
248 </div>
249 </div>
250 <?php
251 }
252