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

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

189 lines 9.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Anthropic (Claude) Provider Settings
4 *
5 * @package BotWriter
6 */
7
8 if (!defined('ABSPATH')) {
9 exit;
10 }
11
12 /**
13 * Get Anthropic provider info
14 */
15 function botwriter_get_anthropic_info() {
16 return [
17 'name' => 'Anthropic (Claude)',
18 'description' => __('Creator of Claude, known for being helpful, harmless, and honest. Excellent for long-form content and nuanced writing.', 'botwriter'),
19 'website' => 'https://anthropic.com',
20 'api_url' => 'https://console.anthropic.com/settings/keys',
21 'docs_url' => 'https://docs.anthropic.com/',
22 'pricing_url' => 'https://anthropic.com/pricing#api',
23 'free_credits' => __('$5 free credits for new API accounts', 'botwriter'),
24 'pricing_summary' => [
25 'claude-opus-4.5' => '$5/1M input, $25/1M output',
26 'claude-sonnet-4.5' => '$3/1M input, $15/1M output',
27 'claude-haiku-4.5' => '$1/1M input, $5/1M output',
28 ],
29 'features' => [
30 __('200K context window (can read entire books)', 'botwriter'),
31 __('Excellent at following complex instructions', 'botwriter'),
32 __('Superior for long-form, nuanced content', 'botwriter'),
33 __('Strong safety and ethical guidelines', 'botwriter'),
34 __('Great at coding and technical writing', 'botwriter'),
35 ],
36 'pros' => [
37 __('Best for long-form content', 'botwriter'),
38 __('Very nuanced responses', 'botwriter'),
39 __('Excellent instruction following', 'botwriter'),
40 __('Prompt caching (save up to 90%)', 'botwriter'),
41 ],
42 'cons' => [
43 __('Can be overly cautious sometimes', 'botwriter'),
44 __('No image generation (text only)', 'botwriter'),
45 ],
46 ];
47 }
48
49 /**
50 * Render Anthropic settings tab content
51 */
52 function botwriter_render_anthropic_settings($settings, $is_active) {
53 $info = botwriter_get_anthropic_info();
54 ?>
55 <div class="provider-config-section">
56 <div class="provider-config-card">
57 <h4><?php esc_html_e('API Configuration', 'botwriter'); ?></h4>
58 <div class="form-row">
59 <label><?php esc_html_e('API Key:', 'botwriter'); ?></label>
60 <div class="api-key-wrapper">
61 <input type="password" name="botwriter_anthropic_api_key" class="form-control api-key-input"
62 value="<?php echo esc_attr(botwriter_decrypt_api_key(get_option('botwriter_anthropic_api_key'))); ?>"
63 placeholder="sk-ant-...">
64 <button type="button" class="button toggle-api-key"><?php esc_html_e('Show', 'botwriter'); ?></button>
65 <button type="button" class="button button-secondary test-api-key" data-provider="anthropic">
66 <span class="dashicons dashicons-yes-alt"></span> <?php esc_html_e('Test API Key & Update Models', 'botwriter'); ?>
67 </button>
68 <span class="test-api-result"></span>
69 </div>
70 <p class="description"><?php esc_html_e('Your Anthropic API key starts with "sk-ant-"', 'botwriter'); ?></p>
71 </div>
72 <div class="form-row">
73 <label><?php esc_html_e('Model:', 'botwriter'); ?></label>
74 <div class="model-select-wrapper">
75 <?php botwriter_render_model_select('anthropic', 'botwriter_anthropic_model', $settings['botwriter_anthropic_model']); ?>
76 <button type="button" class="button button-secondary test-model" data-provider="anthropic">
77 <span class="dashicons dashicons-controls-play"></span> <?php esc_html_e('Test Model', 'botwriter'); ?>
78 </button>
79 <span class="test-model-result"></span>
80 </div>
81 </div>
82 </div>
83
84 <div class="provider-info-card">
85 <h4><span class="dashicons dashicons-info-outline"></span> <?php esc_html_e('How to Get Your API Key', 'botwriter'); ?></h4>
86 <ol class="setup-steps">
87 <li><?php esc_html_e('Go to', 'botwriter'); ?> <a href="https://console.anthropic.com/login" target="_blank">console.anthropic.com</a> <?php esc_html_e('and create an account', 'botwriter'); ?></li>
88 <li><?php esc_html_e('Navigate to', 'botwriter'); ?> <a href="https://console.anthropic.com/settings/keys" target="_blank"><?php esc_html_e('API Keys', 'botwriter'); ?></a></li>
89 <li><?php esc_html_e('Click "Create Key"', 'botwriter'); ?></li>
90 <li><?php esc_html_e('Copy the key (it starts with "sk-ant-") and paste it above', 'botwriter'); ?></li>
91 <li><?php esc_html_e('Add billing information in', 'botwriter'); ?> <a href="https://console.anthropic.com/settings/billing" target="_blank"><?php esc_html_e('Billing settings', 'botwriter'); ?></a></li>
92 </ol>
93 <div class="info-tip">
94 <span class="dashicons dashicons-lightbulb"></span>
95 <p><?php esc_html_e('Tip: New accounts receive $5 in free API credits to get started!', 'botwriter'); ?></p>
96 </div>
97 </div>
98
99 <div class="provider-pricing-card">
100 <h4><span class="dashicons dashicons-money-alt"></span> <?php esc_html_e('Pricing Overview', 'botwriter'); ?></h4>
101
102 <div class="pricing-highlight">
103 <span class="free-credits-badge"><?php esc_html_e('Free Credits', 'botwriter'); ?></span>
104 <p><?php echo esc_html($info['free_credits']); ?></p>
105 </div>
106
107 <table class="pricing-table">
108 <thead>
109 <tr>
110 <th><?php esc_html_e('Model', 'botwriter'); ?></th>
111 <th><?php esc_html_e('Cost (per 1M tokens)', 'botwriter'); ?></th>
112 </tr>
113 </thead>
114 <tbody>
115 <?php foreach ($info['pricing_summary'] as $model => $price): ?>
116 <tr>
117 <td><code><?php echo esc_html($model); ?></code></td>
118 <td><?php echo esc_html($price); ?></td>
119 </tr>
120 <?php endforeach; ?>
121 </tbody>
122 </table>
123
124 <div class="cost-saving-tip">
125 <span class="dashicons dashicons-saved"></span>
126 <strong><?php esc_html_e('Save 50%:', 'botwriter'); ?></strong>
127 <?php esc_html_e('Use Batch Processing for non-urgent tasks with 24-hour turnaround.', 'botwriter'); ?>
128 </div>
129
130 <p class="pricing-note">
131 <a href="<?php echo esc_url($info['pricing_url']); ?>" target="_blank" class="button button-secondary">
132 <span class="dashicons dashicons-external"></span> <?php esc_html_e('View Full Pricing', 'botwriter'); ?>
133 </a>
134 </p>
135 </div>
136
137 <div class="provider-features-card">
138 <h4><span class="dashicons dashicons-star-filled"></span> <?php esc_html_e('Features & Benefits', 'botwriter'); ?></h4>
139 <ul class="features-list">
140 <?php foreach ($info['features'] as $feature): ?>
141 <li><span class="dashicons dashicons-yes-alt"></span> <?php echo esc_html($feature); ?></li>
142 <?php endforeach; ?>
143 </ul>
144
145 <div class="pros-cons">
146 <div class="pros">
147 <h5><?php esc_html_e('Pros', 'botwriter'); ?></h5>
148 <ul>
149 <?php foreach ($info['pros'] as $pro): ?>
150 <li><span class="dashicons dashicons-plus-alt2"></span> <?php echo esc_html($pro); ?></li>
151 <?php endforeach; ?>
152 </ul>
153 </div>
154 <div class="cons">
155 <h5><?php esc_html_e('Cons', 'botwriter'); ?></h5>
156 <ul>
157 <?php foreach ($info['cons'] as $con): ?>
158 <li><span class="dashicons dashicons-minus"></span> <?php echo esc_html($con); ?></li>
159 <?php endforeach; ?>
160 </ul>
161 </div>
162 </div>
163 </div>
164
165 <div class="provider-links-card">
166 <h4><span class="dashicons dashicons-admin-links"></span> <?php esc_html_e('Useful Links', 'botwriter'); ?></h4>
167 <div class="links-grid">
168 <a href="<?php echo esc_url($info['api_url']); ?>" target="_blank" class="link-item">
169 <span class="dashicons dashicons-admin-network"></span>
170 <?php esc_html_e('Get API Key', 'botwriter'); ?>
171 </a>
172 <a href="<?php echo esc_url($info['docs_url']); ?>" target="_blank" class="link-item">
173 <span class="dashicons dashicons-book"></span>
174 <?php esc_html_e('Documentation', 'botwriter'); ?>
175 </a>
176 <a href="<?php echo esc_url($info['pricing_url']); ?>" target="_blank" class="link-item">
177 <span class="dashicons dashicons-money-alt"></span>
178 <?php esc_html_e('Pricing', 'botwriter'); ?>
179 </a>
180 <a href="https://status.anthropic.com/" target="_blank" class="link-item">
181 <span class="dashicons dashicons-heart"></span>
182 <?php esc_html_e('API Status', 'botwriter'); ?>
183 </a>
184 </div>
185 </div>
186 </div>
187 <?php
188 }
189