# WP Agentic Writer — Settings Page Features & Fields > **Plugin option key:** `wp_agentic_writer_settings` (single serialized option). > **Active settings class:** `WP_Agentic_Writer_Settings_V2` (`includes/class-settings-v2.php`). > **Settings group:** `wp_agentic_writer_settings`. > **Form action:** `options.php`. --- ## Table of Contents 1. [Navigation Tabs](#1-navigation-tabs) 2. [Tab: General](#2-tab-general) 3. [Tab: AI Models](#3-tab-ai-models) 4. [Tab: Local Backend](#4-tab-local-backend) 5. [Tab: MEMANTO](#5-tab-memanto) 6. [Tab: OpenRouter Cost Log](#6-tab-openrouter-cost-log) 7. [Tab: Model Guide (Read-Only)](#7-tab-model-guide-read-only) 8. [Global Components](#8-global-components) 9. [AJAX Actions Reference](#9-ajax-actions-reference) 10. [Complete Option Key Index](#10-complete-option-key-index) 11. [Sanitization & Validation Rules](#11-sanitization--validation-rules) 12. [Key Files Reference](#12-key-files-reference) --- ## 1. Navigation Tabs The settings page is organized into 6 tabs grouped under two sections: **Configuration:** General, AI Models, Local Backend, MEMANTO **Analytics & Docs:** OpenRouter Cost Log, Model Guide | Tab ID | Label | Section | |--------|-------|---------| | `general` | General | Configuration | | `models` | AI Models | Configuration | | `local-backend` | Local Backend | Configuration | | `memanto` | MEMANTO | Configuration | | `cost-log` | OpenRouter Cost Log | Analytics & Docs | | `guide` | Model Guide | Analytics & Docs | --- ## 2. Tab: General ### Section 2.1 — API Configuration | Field | Option Key | Type | Input | Required | Default | Description | |-------|-----------|------|-------|----------|---------|-------------| | OpenRouter API Key | `openrouter_api_key` | `string` | `password` (with show/hide toggle) | Yes | `""` | Get from openrouter.ai/keys. | | Test Connection | _(button)_ | — | `button` | — | — | AJAX call to `wpaw_test_api_connection`. | ### Section 2.2 — OpenRouter Budget & Cost Tracking **Display data (read-only, fetched from backend):** | Data | Variable | Source | |------|----------|--------| | Used This Month | `$monthly_used` | `Cost_Tracker::get_monthly_total()` | | Budget Usage % | `$budget_percent` | Calculated: `(used / budget) * 100` | | Remaining | Calculated | `max(0, budget - used)` | **Fields:** | Field | Option Key | Type | Input | Default | Validation | Description | |-------|-----------|------|-------|---------|------------|-------------| | Monthly Budget (USD) | `monthly_budget` | `float` | `number` | `600` | `floatval()`, min 0, step 0.01 | Maximum spend per month. 0 = unlimited. | | Enable Cost Tracking | `cost_tracking_enabled` | `bool` | `checkbox` | `true` | Boolean | Show cost tracking in editor sidebar. | ### Section 2.3 — Research & Web Search | Field | Option Key | Type | Input | Default | Options | Description | |-------|-----------|------|-------|---------|---------|-------------| | Enable Web Search | `web_search_enabled` | `bool` | `checkbox` | `false` | — | Default for new posts; also toggleable per-request in editor sidebar. | | Search Depth | `search_depth` | `string` | `select` | `"medium"` | `low` / `medium` / `high` | Controls search depth level. | **OpenRouter Search Engine:** | Field | Option Key | Type | Input | Default | Options | Description | |-------|-----------|------|-------|---------|---------|-------------| | Search Engine | `search_engine` | `string` | `select` | `"auto"` | `auto` (Native → Exa fallback) / `native` (Free, built-in) / `exa` (Paid, ~$0.02/search) | Used when active model routes through OpenRouter. | **Brave Search API (for Local/Codex):** | Field | Option Key | Type | Input | Default | Description | |-------|-----------|------|-------|---------|-------------| | Brave Search API Key | `brave_search_api_key` | `string` | `password` | `""` | Used when active model is Local Backend or Codex. Free tier: 2,000 requests/month. | ### Section 2.4 — Clarification Quiz | Field | Option Key | Type | Input | Default | Options | Description | |-------|-----------|------|-------|---------|---------|-------------| | Enable Clarification Quiz | `enable_clarification_quiz` | `bool` | `checkbox` | `true` | — | Ask clarifying questions when context is missing. | | Confidence Threshold | `clarity_confidence_threshold` | `string` | `select` | `"0.6"` | `0.5` (Very Sensitive) / `0.6` (Sensitive - Recommended) / `0.7` (Balanced) / `0.8` (Strict) / `0.9` (Very Strict) | When to trigger the quiz. | | Context Categories | `required_context_categories` | `array` | multi-checkbox | All 7 checked | `target_outcome` / `target_audience` / `tone` / `content_depth` / `expertise_level` / `content_type` / `pov` | Which context dimensions to ask about. | ### Section 2.5 — Content Settings (Language) | Field | Option Key | Type | Input | Default | Description | |-------|-----------|------|-------|---------|-------------| | Preferred Languages | `preferred_languages` | `array` | multi-checkbox | `["auto", "English", "Indonesian"]` | Languages shown in the language selector when creating articles. | | Custom Languages | `custom_languages` | `array` | dynamic text input list with add/remove | `[]` | Add languages not in the predefined list. | **Available predefined languages (24):** `auto` (Auto-detect), `English`, `Indonesian` (Bahasa Indonesia), `Javanese` (Basa Jawa), `Sundanese` (Basa Sunda), `Spanish` (Español), `French` (Français), `Arabic` (العربية), `Chinese` (中文), `Japanese` (日本語), `Portuguese` (Português), `German` (Deutsch), `Hindi` (हिंदी), `Korean` (한국어), `Vietnamese` (Tiếng Việt), `Thai` (ไทย), `Tagalog`, `Malay` (Bahasa Melayu), `Russian` (Русский), `Italian` (Italiano), `Dutch` (Nederlands), `Polish` (Polski), `Turkish` (Türkçe), `Swedish` (Svenska) ### Section 2.6 — Advanced Settings | Field | Option Key | Type | Input | Default | Validation | Description | |-------|-----------|------|-------|---------|------------|-------------| | Enable Automated FAQ Schema | `enable_faq_schema` | `bool` | `checkbox` | `false` | Boolean | Auto-inject FAQPage JSON-LD. Compatible with Yoast/RankMath. Disable if SEO plugin handles it. | | Chat History Limit | `chat_history_limit` | `int` | `number` | `20` | `absint()`, capped at 200, min 0 | Messages stored per post. 0 = disable chat history. | --- ## 3. Tab: AI Models ### Section 3.1 — Quick Presets Three presets that populate the 6 model selectors below via JavaScript (not saved fields): | Preset | Chat/Clarity/Planning | Writing | Refinement | Image | Est. Cost | |--------|----------------------|---------|------------|-------|-----------| | **Budget** | Gemini 2.5 Flash | Mistral Small Creative | Gemini 2.5 Flash | FLUX.2 klein | ~$0.06/article | | **Balanced** | Gemini 2.5 Flash | Claude 3.5 Sonnet | Claude 3.5 Sonnet | Riverflow V2 Max | ~$0.14/article | | **Premium** | Gemini 3 Flash Preview | GPT-4.1 | GPT-4.1 | FLUX.2 max | ~$0.31/article | ### Section 3.2 — OpenRouter Provider Routing | Field | Option Key | Type | Input | Default | Description | |-------|-----------|------|-------|---------|-------------| | Enable Provider Routing | `openrouter_provider_routing_enabled` | `bool` | `checkbox` | `false` | Pin OpenRouter requests to a specific provider for BYOK/routing. | | Provider Slug | `openrouter_provider_slug` | `string` | `text` | `"auto"` | Examples: `openai`, `anthropic`, `google`, `z-ai`. | | Only Use This Provider | `openrouter_provider_only` | `bool` | `checkbox` | `false` | Prevents Azure or other providers when slug is `openai`. | | Allow Fallback Providers | `openrouter_allow_provider_fallbacks` | `bool` | `checkbox` | `false` | Leave off for BYOK-only behavior. | ### Section 3.3 — AI Model Configuration (6 model selectors) All selectors are populated via AJAX from the OpenRouter models API. Each selector shows which provider the model routes through. | Field | Option Key | Default Model | data-model-type | Description | |-------|-----------|--------------|-----------------|-------------| | Chat Model | `chat_model` | `google/gemini-2.5-flash` | `chat` | Discussion, research, recommendations | | Clarity Model | `clarity_model` | `google/gemini-2.5-flash` | `clarity` | Prompt analysis, quiz generation | | Planning Model | `planning_model` | `google/gemini-2.5-flash` | `planning` | Article outline generation | | Writing Model | `writing_model` | `anthropic/claude-3.5-haiku` | `execution` | Article draft generation (2-5k words) | | Refinement Model | `refinement_model` | `anthropic/claude-3.5-sonnet` | `execution` | Paragraph edits, rewrites, polish | | Image Model | `image_model` | `openai/gpt-4o` | `image` | Image generation | - Writing Model has a legacy alias `execution_model` (mapped to `writing_model` during sanitization). - Refresh Models button: AJAX call to `wpaw_refresh_models`. ### Section 3.4 — Custom Models | Sub-field | Type | Input | Description | |-----------|------|-------|-------------| | Model ID | `string` | `text` | Exact OpenRouter model ID. | | Display Name | `string` | `text` | Optional friendly name. | | Model Type | `string` | `select` | `text` or `image` | | Remove | — | `button` | Delete row. | Stored in separate option: `wp_agentic_writer_custom_models` (array of `{id, name, type}` objects). - Add button clones from a `