If you have multiple API keys for the same service and would like to rotate between them (round robin), there is an addon specifically designed for that: Dynamic Keys.
If you want your user to use their own API keys you will need to write the code to allow them to write their own API Key somewhere. For example, you could let them add it directly into their WordPress Profile.
As for AI Engine, you can inject this API Key in many different ways. In the Filters, pay attention to the mwai_ai_query filter; it’s the one used right before the request is sent to the AI. Here is a simple example:
add_filter( 'mwai_ai_query', function ( $query ) {
$apiKey = get_user_meta( get_current_user_id(), 'apiKey', true );
$query->setApiKey( $apiKey );
return $query;
}, 10, 2 );