admin_url( 'admin-ajax.php' ), 'nonce' => wp_create_nonce( 'psa_batch_enrich' ), ) ); } // ── Field renderers ───────────────────────────────────────────────── public static function render_section_description(): void { printf( '
' . __( 'This plugin uses OpenRouter to access AI models.', 'peptide-search-ai' ) . '
', esc_url( 'https://openrouter.ai/' ) ); } public static function render_api_key_field(): void { if ( defined( 'PSA_OPENROUTER_KEY' ) && PSA_OPENROUTER_KEY ) { echo ' '; echo '' . esc_html__( 'Configured via wp-config.php', 'peptide-search-ai' ) . ''; echo '' . esc_html__( 'The API key is securely set using the PSA_OPENROUTER_KEY constant.', 'peptide-search-ai' ) . '
'; } else { $value = PSA_Admin::get_setting( 'api_key', '' ); $display_value = ! empty( $value ) ? '••••••••' : ''; printf( '', esc_attr( $display_value ) ); printf( '%s %s.
', esc_html__( 'Your OpenRouter API key.', 'peptide-search-ai' ), esc_html__( 'Get one here', 'peptide-search-ai' ) ); } } public static function render_model_field(): void { $value = PSA_Admin::get_setting( 'ai_model', '' ); printf( '', esc_attr( $value ), esc_attr__( 'Leave blank for default', 'peptide-search-ai' ) ); echo '' . esc_html__( 'Model for full content generation. Default: google/gemini-2.5-flash', 'peptide-search-ai' ) . '
'; } public static function render_validation_model_field(): void { $value = PSA_Admin::get_setting( 'validation_model', '' ); printf( '', esc_attr( $value ), esc_attr__( 'Leave blank for default', 'peptide-search-ai' ) ); echo '' . esc_html__( 'Lighter model for name validation. Default: google/gemini-2.0-flash-001', 'peptide-search-ai' ) . '
'; } public static function render_publish_field(): void { $value = PSA_Admin::get_setting( 'auto_publish', 'draft' ); echo ''; } public static function render_pubchem_field(): void { $value = PSA_Admin::get_setting( 'use_pubchem', '1' ); printf( '', checked( $value, '1', false ), esc_html__( 'Cross-reference with PubChem for verified molecular data', 'peptide-search-ai' ) ); } public static function render_budget_field(): void { $value = PSA_Admin::get_setting( 'monthly_budget', PSA_Config::DEFAULT_MONTHLY_BUDGET ); printf( '', esc_attr( $value ) ); echo '' . esc_html__( 'Set to 0 for unlimited.', 'peptide-search-ai' ) . '
'; } // ── Settings page ─────────────────────────────────────────────────── public static function render_settings_page(): void { $migrate_url = wp_nonce_url( admin_url( 'options-general.php?page=peptide-search-ai&psa_action=migrate_categories' ), 'psa_migrate_categories' ); ?>[peptide_search] —
[peptide_directory] —
GET /wp-json/peptides/v1/search?q=BPC-157 —
GET /wp-json/peptide-search-ai/v1/compounds?search=&category=&page=1 —
$
0 ) : ?>
⚠ includes estimates
| created_at ); ?> | model ); ?> |
~' : ''; ?>total_tokens ) ); ?>' : ''; ?> | ~$' : '$'; ?>estimated_cost_usd, 4 ) ); ?>' : ''; ?> | request_type ); ?> | peptide_name ); ?> | success ) ? '✓' : '✗'; ?> |