Getting started with Model Proxy

Updated at:

This article describes how to create a Model Proxy and complete the initial configuration, including adding model services, creating model APIs, and configuring users and whitelists, to help you quickly get started with Model Proxy.

Step 1: Create a Model Proxy

  1. Log on to the PolarDB console. In the left-side navigation pane, choose PolarDB AI > Model Proxy.

  2. Click Create Model Proxy Instance to open the purchase page.

  3. On the purchase page, select the region, ecosystem, and Specifications based on your business requirements.

Note

Deploy the Model Proxy in the same VPC as your business services, such as PolarDB Agent Express, to ensure internal network connectivity.

Step 2: Add a model service

  1. Return to the PolarDB console. In the left-side navigation pane, choose PolarDB AI > Model Proxy.

  2. On the Model Proxy page, click the Instance ID / Name of the instance you created.

  3. In the left-side navigation pane of the instance details page, choose Model Management > Model Service and click Add Model Service.

  4. Configure the following parameters:

    • Service Name: Enter a custom name for your model service.

    • Model Provider: Select your model service provider, such as Bailian, Bailian - Singapore, or Bailian - US.

    • Category: Select the model service type. Currently, only Text is supported.

    • Protocol: Select the model service's protocol. Supported protocols include openai-chat, openai-responses, and Anthropic.

    • Service Endpoint (base_url): The API address of the model provider. For example, the API address of Alibaba Cloud Model Studio.

    • API-KEY: The access key for the model service.

Step 3: Create a model API

  1. In the left-side navigation pane of the instance details page, choose Model Management > Model API and click Create Model API.

  2. Configure the following parameters:

    • API Name: Enter a custom name for your model API.

    • Base Path: The API routing prefix, which must be globally unique within the Model Proxy.

    • Category: Select the API type. Currently, only Text is supported.

    • Protocol: Select the API's protocol. Supported protocols include openai-chat, openai-responses, and Anthropic.

    • Load Balancing Algorithm: Select the API's load balancing algorithm.

    • Service Type: Supports Single Service and Multiple Services (Weighted) modes.

    • Service List: Select the configured model services. The Service Name is required and represents the model name exposed through the API.

    • Fallback: Specify whether to enable a fallback service.

Step 4: Create users and user groups

Create a user group

  1. In the left-side navigation pane of the instance details page, choose User Group Management > User Group and click Create User Group.

  2. Enter a User Group Name and configure related settings. You can organize user groups based on your company's organizational structure.

Create a user

  1. In the left-side navigation pane of the instance details page, choose User Group Management > User and click Create User.

  2. Enter the User Group Name and configure the relevant settings. You can organize user groups based on your enterprise's organizational structure.

  3. Select a User Group, enter a unique User Name, and configure related settings. The system automatically generates an API key for the user.

Note

The API key is encrypted for storage. Save the API key in a secure location when it is first displayed. If you lose the API key, you can copy it again by clicking the copy icon in the API Key column for that user.

Step 5: Configure an IP whitelist

To allow services within a VPC to access the Model Proxy, you must add the CIDR block of the VPC to the Model Proxy's whitelist.

  1. In the left-side navigation pane of the instance details page, select Whitelist.

  2. Configure the whitelist policy:

    • Add Whitelist: Add the CIDR block of the VPC or VSwitch that needs to access the Model Proxy.

    • Select Security Groups: Add the security group that needs to access the Model Proxy.

(Optional) Step 6: Enable internet access

By default, the Model Proxy allows access only from within a VPC. If your business scenario requires the Model Proxy to access model services over the internet, such as the public APIs of Alibaba Cloud's Model Studio, you must configure an Internet NAT Gateway.

Procedure

  1. Create an Internet NAT Gateway: Go to the NAT Gateway - Internet NAT Gateway purchase page. During creation, select the same VPC and VSwitch as your PolarDB for PostgreSQL instance.

  2. Configure SNAT entries: Go to the Internet NAT Gateway page. In the Actions column for your gateway, click Configure SNAT , and then click Create SNAT Entry. Configure the parameters as follows:

    • SNAT Entry: VPC level.

    • Select EIP: From the drop-down list, select the desired Elastic IP Address.

Note

Enabling internet access incurs fees for the Internet NAT Gateway and internet traffic. For more information, see NAT Gateway billing.

Next steps

After the initial setup, you can: