All Products
Search
Document Center

API Gateway:Access models deployed on PAI through an AI gateway

Last Updated:Dec 03, 2025

This topic describes how to access a model deployed on Platform for AI (PAI) through an AI gateway.

Prerequisites

Important

When you access the model using a private endpoint, ensure that the AI gateway instance and the PAI model are in the same VPC.

Procedure

Step 1: Create an AI service

  1. Log on to the AI Gateway console.

  2. In the navigation pane on the left, choose Instance. In the top menu bar, select a region.

  3. On the Instance page, click the target instance ID.

  4. In the navigation pane on the left, choose Service, then click the Services tab.

  5. Click Create Service. In the Create Service panel, configure the following parameters for the AI service:

    image

    Configuration Item

    Description

    Service Source

    Select AI Service.

    Service Name

    Enter a name for the gateway service, such as pai.

    Large Model Supplier

    Select the large model provider for the AI service. In this example, select PAI-EAS. If you do not have a model deployed on PAI through EAS, see Deploy a model with one click.

    Workspace

    The PAI workspace. For example, pai_xqrj0u0t******.

    EAS Service

    Select the name of the model deployed on PAI. For example, Qwen3-32B.

    Connection Type

    Select the connection type for the model deployed on PAI. Options include Internet and private network. In this example, select Private.

    API-KEY

    The API key for the model deployed on PAI is automatically obtained.

    Note

    This API key is used for identity verification between the AI gateway and the PAI-EAS service. The AI gateway automatically obtains the API key and establishes communication with the PAI-EAS service.

Step 2: Create a Model API

  1. Log on to the AI Gateway console.

  2. In the navigation pane on the left, choose Instance. In the top menu bar, select a region.

  3. On the Instance page, click the target instance ID.

  4. In the navigation pane on the left, choose Model API, then click Create Model API.

  5. In the Create Model API panel, configure the following basic information:

    image

  6. Click OK to create the Model API.

Step 3: Debug the Model API

  1. In the Actions column for the target Model API, click the Debugging button.

  2. In the Route Debugging panel, select the PAI model from the Model selection drop-down list. Then, on the Model Returned tab, you can interact with the large model.

    Important

    The Model Response tab uses the /v1/chat/completions chat API by default. To use other APIs, select the cURL Command or Row Output tab to debug using curl commands or an SDK.

  3. [Example] To call the completions API using the cURL Command tab, perform the following steps:

    1. On the cURL Command tab, copy the code sample provided by AI Gateway.

    2. Replace the url in the code sample with /v1/completions.

    3. Modify the data(body) section of the code sample to match the format that is required by /v1/completions:

    image