feat(models): OpenRouter model picker + AJAX refresh + cost preview (v0.11.0 complete)

- AJAX endpoint 'prautoblogger_refresh_models' for manual model registry refresh
- Admin UI button on AI Models tab to trigger refresh (nonce + capability gated)
- Cost preview integration in field renderer using historical token averages
- New public method on Cost Tracker: get_avg_tokens_for_stages(array $stages, int $days = 30): array
- Enhanced field renderer with capability-specific cost calculation (outline+draft+polish for writing, single stage for analysis/editor)
- Autoloader updated to scan ajax/ directory for model registry refresh handler
- Admin JS enhanced with AJAX toggle handler for refresh button
- Template updated with refresh button + nonce in AI Models section
- CHANGELOG + CONVENTIONS + version bump to 0.11.0
- All files under 300-line cap, PHPCS-clean

Spec: https://github.com/peptiderepo/prautoblogger/issues/111
Open questions all resolved per seq-02 plan-ack.
This commit is contained in:
peptiderepo
2026-04-23 04:46:18 +00:00
parent e3e867353a
commit 353aa4eee4
11 changed files with 350 additions and 9 deletions

View File

@@ -30,6 +30,7 @@ class PRAutoBlogger_Autoloader {
'models/',
'frontend/',
'services/',
'ajax/',
);
/**