The QI agreement is contained in section 6 of IRS Rev. Proc. 2017-15. Application for QI status is done online via the IRS's QI, WP, WT Application and Account Management System.
The applicant must be a non-US financial institution, which generally includes non-US banks and asset management companies. In addition, the applicant must have a FATCA status of Participating FFI or Registered Deemed-Compliant FFI, including a Model 1 or 2 IGA FFI.
The IRS will not enter into a QI Agreement for an applicant resident in a country that does not have IRS approved KYC rules.
Once the applicant has created a user, the QI application process can be started. Note that the applicant must completed and upload a signed Form SS-4, Application for an Employer Identification Number, in order to be assigned a unique QI identification number (QI-EIN).
The application will be notified by email when the appplication is approved.