Custom query_vars and parse_request on wp-admin

I think this does what you’re trying to achieve. Regarding multisite 404s, you have to flush rewrite rules on every site within multisite where you want this rule to get added. A quick method for testing purposes is to visit the permalinks settings page for each site you’re testing. Also note, I removed the .php extension from your rule. I think you’ll otherwise get strange behavior – REQUEST will curiously be an empty array.

function wpd_api_rule(){
    add_rewrite_rule( 'my-api/?$', 'index.php?my-api=1', 'top' );
}
add_action( 'init', 'wpd_api_rule' );

function wpd_query_vars( $query_vars ){
    $query_vars[] = 'my-api';
    return $query_vars;
}
add_filter( 'query_vars', 'wpd_query_vars' );

function wpd_parse_request( $wp ){
    if( array_key_exists( 'my-api', $wp->query_vars ) ) {
        // AJAX API example -
        // you might want to whitelist actions here
        // use wp_ajax_nopriv_ if not logged in
        do_action( 'wp_ajax_' . $_REQUEST['action'] );
        die(0);
    }
}
add_action( 'parse_request', 'wpd_parse_request' );