Zend certified PHP/Magento developer

Magento 2 how to create various shipping methods from REST API response?

I already know how to create a single shipping custom method, with files system.xml, config.xml and Carrier.php, however I’m working with a REST API of a Carrier provider, and when I get the response, I get like 6 different shipping methods, from different Couriers, for example: Fedex, UPS and more.

How can I show this quotes and Couriers in Checkout Shipping side? I was checking USPS module and it has this code under vendor/magento/module-usps/etc/config.xml :

0_FCLE,0_FCL,0_FCP,1,2,3,4,6,7,13,16,17,22,23,25,27,28,33,34,35,36,37,42,43,53,55,56,57,61,INT_1,INT_2,INT_4,INT_6,INT_7,INT_8,INT_9,INT_10,INT_11,INT_12,INT_13,INT_14,INT_15,INT_16,INT_20,INT_26

But what I don’t get, is how USPS module creates different shipping methods, also I will need to have different Courier codes, in collectRates method, for example, the default shipping method has just one courier code:

/** @var MagentoShippingModelRateResult $result */
        $result = $this->rateResultFactory->create();

        /** @var MagentoQuoteModelQuoteAddressRateResultMethod $method */
        $method = $this->rateMethodFactory->create();

        $method->setCarrier($this->_code);
       // $method->setCarrierTitle($this->getConfigData('title'));
       $method->setCarrierTitle("Pakkkee");

        $method->setMethod($this->_code);
        $method->setMethodTitle($this->getConfigData('name'));

        $shippingCost = (float)$this->getConfigData('shipping_cost');

        $method->setPrice($shippingCost);
        $method->setCost($shippingCost);

        $result->append($method);

I will need something like this:

for($i = 0; $i < _code.length; i++){
    /** @var MagentoShippingModelRateResult $result */
            $result = $this->rateResultFactory->create();

        /** @var MagentoQuoteModelQuoteAddressRateResultMethod $method */
        $method = $this->rateMethodFactory->create();

        $method->setCarrier($this->_code[$i]);
        $method->setCarrierTitle($this->getConfigData('title'));


        $method->setMethod($this->_code[$i]);
        $method->setMethodTitle($this->getConfigData('name'));

        $shippingCost = (float)$this->getConfigData('shipping_cost');

        $method->setPrice($shippingCost);
        $method->setCost($shippingCost);

        $result->append($method);

}

Same for getAllowedMethods();

public function getAllowedMethods()
    {
       for($i = 0; $i < _code.length; i++){
        return [$this->_code[$i] => $this->getConfigData('name')];
       }
    }

The number of Couriers is dynamic, so creating many methods in config.xml will not be useful.

Greetings and thank you!