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 / mistral.php

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

192 lines 9.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Mistral AI Provider Settings
4 *
5 * @package BotWriter
6 */
7
8 if (!defined('ABSPATH')) {
9 exit;
10 }
11
12 /**
13 * Get Mistral provider info
14 */
15 function botwriter_get_mistral_info() {
16 return [
17 'name' => 'Mistral AI',
18 'description' => __('European AI company with excellent open-weight models. Great balance of performance and cost.', 'botwriter'),
19 'website' => 'https://mistral.ai',
20 'api_url' => 'https://console.mistral.ai/api-keys',
21 'docs_url' => 'https://docs.mistral.ai/',
22 'pricing_url' => 'https://mistral.ai/technology/',
23 'free_credits' => __('Free "Experiment" tier available with limited usage', 'botwriter'),
24 'pricing_summary' => [
25 'mistral-large' => '$2/1M input, $6/1M output',
26 'mistral-medium' => '$0.40/1M input, $1.50/1M output',
27 'mistral-small' => '$0.20/1M input, $0.60/1M output',
28 'codestral' => '$0.30/1M input, $0.90/1M output',
29 'ministral-8b' => '$0.10/1M input, $0.10/1M output',
30 ],
31 'features' => [
32 __('European company (GDPR-compliant)', 'botwriter'),
33 __('Open-weight models available', 'botwriter'),
34 __('Excellent multilingual support', 'botwriter'),
35 __('Competitive pricing', 'botwriter'),
36 __('Codestral: specialized for code generation', 'botwriter'),
37 __('Ministral: ultra-compact edge models', 'botwriter'),
38 ],
39 'pros' => [
40 __('Great price/performance ratio', 'botwriter'),
41 __('Strong European data protection', 'botwriter'),
42 __('Open-source options', 'botwriter'),
43 __('Fast inference', 'botwriter'),
44 ],
45 'cons' => [
46 __('Smaller ecosystem than OpenAI', 'botwriter'),
47 __('No image generation', 'botwriter'),
48 ],
49 ];
50 }
51
52 /**
53 * Render Mistral settings tab content
54 */
55 function botwriter_render_mistral_settings($settings, $is_active) {
56 $info = botwriter_get_mistral_info();
57 ?>
58 <div class="provider-config-section">
59 <div class="provider-config-card">
60 <h4><?php esc_html_e('API Configuration', 'botwriter'); ?></h4>
61 <div class="form-row">
62 <label><?php esc_html_e('API Key:', 'botwriter'); ?></label>
63 <div class="api-key-wrapper">
64 <input type="password" name="botwriter_mistral_api_key" class="form-control api-key-input"
65 value="<?php echo esc_attr(botwriter_decrypt_api_key(get_option('botwriter_mistral_api_key'))); ?>"
66 placeholder="...">
67 <button type="button" class="button toggle-api-key"><?php esc_html_e('Show', 'botwriter'); ?></button>
68 <button type="button" class="button button-secondary test-api-key" data-provider="mistral">
69 <span class="dashicons dashicons-yes-alt"></span> <?php esc_html_e('Test API Key & Update Models', 'botwriter'); ?>
70 </button>
71 <span class="test-api-result"></span>
72 </div>
73 <p class="description"><?php esc_html_e('Get your API key from the Mistral AI Console', 'botwriter'); ?></p>
74 </div>
75 <div class="form-row">
76 <label><?php esc_html_e('Model:', 'botwriter'); ?></label>
77 <div class="model-select-wrapper">
78 <?php botwriter_render_model_select('mistral', 'botwriter_mistral_model', $settings['botwriter_mistral_model']); ?>
79 <button type="button" class="button button-secondary test-model" data-provider="mistral">
80 <span class="dashicons dashicons-controls-play"></span> <?php esc_html_e('Test Model', 'botwriter'); ?>
81 </button>
82 <span class="test-model-result"></span>
83 </div>
84 </div>
85 </div>
86
87 <div class="provider-info-card">
88 <h4><span class="dashicons dashicons-info-outline"></span> <?php esc_html_e('How to Get Your API Key', 'botwriter'); ?></h4>
89 <ol class="setup-steps">
90 <li><?php esc_html_e('Go to', 'botwriter'); ?> <a href="https://console.mistral.ai/" target="_blank">console.mistral.ai</a> <?php esc_html_e('and create an account', 'botwriter'); ?></li>
91 <li><?php esc_html_e('Go to', 'botwriter'); ?> <a href="https://admin.mistral.ai/organization/billing" target="_blank"><?php esc_html_e('Billing', 'botwriter'); ?></a> <?php esc_html_e('to select your plan (Experiment or Scale)', 'botwriter'); ?></li>
92 <li><?php esc_html_e('Navigate to', 'botwriter'); ?> <a href="https://console.mistral.ai/api-keys" target="_blank"><?php esc_html_e('API Keys', 'botwriter'); ?></a></li>
93 <li><?php esc_html_e('Click "Create new key"', 'botwriter'); ?></li>
94 <li><?php esc_html_e('Copy and paste the key above', 'botwriter'); ?></li>
95 </ol>
96 <div class="info-tip">
97 <span class="dashicons dashicons-flag"></span>
98 <p><?php esc_html_e('Mistral AI is based in Paris, France. Great choice for EU data compliance!', 'botwriter'); ?></p>
99 </div>
100 </div>
101
102 <div class="provider-pricing-card">
103 <h4><span class="dashicons dashicons-money-alt"></span> <?php esc_html_e('Pricing Overview', 'botwriter'); ?></h4>
104
105 <div class="pricing-highlight">
106 <span class="free-credits-badge"><?php esc_html_e('Experiment Plan', 'botwriter'); ?></span>
107 <p><?php echo esc_html($info['free_credits']); ?></p>
108 </div>
109
110 <table class="pricing-table">
111 <thead>
112 <tr>
113 <th><?php esc_html_e('Model', 'botwriter'); ?></th>
114 <th><?php esc_html_e('Cost (per 1M tokens)', 'botwriter'); ?></th>
115 </tr>
116 </thead>
117 <tbody>
118 <?php foreach ($info['pricing_summary'] as $model => $price): ?>
119 <tr>
120 <td><code><?php echo esc_html($model); ?></code></td>
121 <td><?php echo esc_html($price); ?></td>
122 </tr>
123 <?php endforeach; ?>
124 </tbody>
125 </table>
126
127 <div class="cost-saving-tip">
128 <span class="dashicons dashicons-lightbulb"></span>
129 <strong><?php esc_html_e('Best Value:', 'botwriter'); ?></strong>
130 <?php esc_html_e('Mistral Medium offers 8x lower cost than Large with great quality!', 'botwriter'); ?>
131 </div>
132
133 <p class="pricing-note">
134 <a href="<?php echo esc_url($info['pricing_url']); ?>" target="_blank" class="button button-secondary">
135 <span class="dashicons dashicons-external"></span> <?php esc_html_e('View Full Pricing', 'botwriter'); ?>
136 </a>
137 </p>
138 </div>
139
140 <div class="provider-features-card">
141 <h4><span class="dashicons dashicons-star-filled"></span> <?php esc_html_e('Features & Benefits', 'botwriter'); ?></h4>
142 <ul class="features-list">
143 <?php foreach ($info['features'] as $feature): ?>
144 <li><span class="dashicons dashicons-yes-alt"></span> <?php echo esc_html($feature); ?></li>
145 <?php endforeach; ?>
146 </ul>
147
148 <div class="pros-cons">
149 <div class="pros">
150 <h5><?php esc_html_e('Pros', 'botwriter'); ?></h5>
151 <ul>
152 <?php foreach ($info['pros'] as $pro): ?>
153 <li><span class="dashicons dashicons-plus-alt2"></span> <?php echo esc_html($pro); ?></li>
154 <?php endforeach; ?>
155 </ul>
156 </div>
157 <div class="cons">
158 <h5><?php esc_html_e('Cons', 'botwriter'); ?></h5>
159 <ul>
160 <?php foreach ($info['cons'] as $con): ?>
161 <li><span class="dashicons dashicons-minus"></span> <?php echo esc_html($con); ?></li>
162 <?php endforeach; ?>
163 </ul>
164 </div>
165 </div>
166 </div>
167
168 <div class="provider-links-card">
169 <h4><span class="dashicons dashicons-admin-links"></span> <?php esc_html_e('Useful Links', 'botwriter'); ?></h4>
170 <div class="links-grid">
171 <a href="<?php echo esc_url($info['api_url']); ?>" target="_blank" class="link-item">
172 <span class="dashicons dashicons-admin-network"></span>
173 <?php esc_html_e('Get API Key', 'botwriter'); ?>
174 </a>
175 <a href="<?php echo esc_url($info['docs_url']); ?>" target="_blank" class="link-item">
176 <span class="dashicons dashicons-book"></span>
177 <?php esc_html_e('Documentation', 'botwriter'); ?>
178 </a>
179 <a href="<?php echo esc_url($info['pricing_url']); ?>" target="_blank" class="link-item">
180 <span class="dashicons dashicons-money-alt"></span>
181 <?php esc_html_e('Pricing', 'botwriter'); ?>
182 </a>
183 <a href="https://discord.gg/mistralai" target="_blank" class="link-item">
184 <span class="dashicons dashicons-format-chat"></span>
185 <?php esc_html_e('Discord Community', 'botwriter'); ?>
186 </a>
187 </div>
188 </div>
189 </div>
190 <?php
191 }
192