[wp-trac] [WordPress Trac] #64872: WP AI Client: Add AI REST API Endpoints (`wp-ai/v1`)

WordPress Trac noreply at wordpress.org
Fri May 1 08:11:52 UTC 2026


#64872: WP AI Client: Add AI REST API Endpoints (`wp-ai/v1`)
-------------------------------------------------+-------------------------
 Reporter:  gziolo                               |       Owner:  (none)
     Type:  enhancement                          |      Status:  new
 Priority:  normal                               |   Milestone:  7.1
Component:  AI                                   |     Version:  trunk
 Severity:  normal                               |  Resolution:
 Keywords:  ai-client has-patch has-unit-tests   |     Focuses:  rest-api
  2nd-opinion                                    |
-------------------------------------------------+-------------------------

Comment (by darshitrajyaguru97):

 Following up on the previous feedback, I looked into a few areas that
 might help improve this further:

 === **1. Capability handling ===

 Using `manage_options` for `prompt_ai` feels a bit too broad, especially
 since AI usage can have cost implications.

 It might be better to introduce a separate capability like
 `use_ai_features` and map it using `map_meta_cap()`. This would:
 * Give more control over who can use AI features
 * Make it easier to adjust permissions in the future (per role or per
 site)
 * Follow how capabilities are usually handled in Core

 === **2. Providers and models endpoints ===

 Right now, `list_ai_providers` and `list_ai_models` are separate. This
 might be more complex than needed.

 We could simplify this by having a single endpoint (for example
 `/ai/providers`) that returns providers along with their models. This
 would:
 * Reduce duplicate logic
 * Avoid multiple API calls from the client

 If there’s a reason to keep them separate (like performance or different
 auth needs), it would be helpful to mention that.

 === **3. Capability checks implementation ===

 Using `map_meta_cap` instead of `user_has_cap` would be more in line with
 Core standards and ensure consistent behavior.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/64872#comment:8>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list