All Products
Search
Document Center

Alibaba Cloud Model Studio:Custom plug-ins

Last Updated:Dec 25, 2025

If the official plug-ins in Alibaba Cloud Model Studio do not meet your business needs, you can create a custom plug-in to extend the capabilities of your large language model (LLM). This document guides you through creating, debugging, and using plug-ins to integrate your required APIs.

Workflow

  1. Create a plugin: Define the basic information for the plugin.

  2. Add a tool: Configure the API path, request parameters, and response data for the plugin.

  3. Debug and publish: Test the API connectivity online and publish the tool after you confirm that it works correctly.

  4. Use in an application: Associate the plug-in with an agent and call it through conversational testing or API integration.

Create a custom plug-in

Create a custom-developed plug-in

Step 1: Create a plug-in

  1. Go to the Plug-ins page and click Create Plug-in.

    image

  2. Enter the plug-in information.

    image

    Plug-in Name: Enter a descriptive name. You can use Chinese and English characters.

    Example: Dormitory Agreement Query Tool Test

    Plug-in Description: Enter a brief description of the plug-in's features and scenarios. This description helps the LLM determine whether to call the plug-in for the current task. Use natural language for the description.

    Example: Queries the content of a specific dormitory agreement entry based on the input numeric index.

    Plug-in URL: The endpoint of the plug-in.

    Example:https://domitorgreement-plugin-example-icohrkdjxy.cn-beijing.fcapp.run
    • For the same domain name, different paths are treated as different APIs. These paths correspond to the Tool Path that you configure when you create a tool.

    • Different tools under the same plug-in use the same domain name. The tool path of each tool corresponds to a separate API.

      For example, a plug-in contains two APIs:

      Query: https://xxx.com/query

      Delete: https://xxx.com/delete

      In this example, https://xxx.com is the Plug-in URL. /query and /delete correspond to the Tool Path. This indicates that the plug-in contains two tools.

    If authentication is required, turn on the Enable Authentication switch and enter the authentication settings.

    Authentication parameter description

    Headers (Optional)

    If authentication is required, you can pass authentication information through a custom header.

    Enable Authentication (Optional)

    Specifies whether authentication is required when a Model Studio application calls your custom plug-in. Whether authentication is required depends on the security policy of the API provider.

    Authentication Type

    The authentication methods are Service-level Authentication and User-level Authentication.

    • Location: You can place the authentication information in the header or query.

      • Header: Place the authentication information in the Authorization field of the HTTP request header. This information is not visible in the URL.

      • Query: Place the authentication information in the URL. For example, https://example.com?api_key=123456.

    • Parameter Name: If you place the authentication information in the query, specify the parameter used for authentication, such as "api_key". If you place the authentication information in the header, the parameter is "Authorization" by default.

    • Type:

      • basic: No content is added before the token that you provide.

      • bearer: "Bearer" is added before the token.

      • appcode: "APPCODE" is added before the token.

      Both types are specified in the authentication parameter. For example, if you select `bearer`, the plugin call format is `("Authorization": "Bearer <YOUR_TOKEN>")`.

    • Token (Service-level Authentication): The authentication token obtained from the API provider, such as an API key.

  3. After you enter the information, click Confirm Create Plug-in > Create Tool or click Continue to Add Tool.

Step 2: Create a tool

  1. Enter the tool information, configure input and output parameters, and set advanced configurations.

    image

    Tool parameter description

    Tool information

    Tool Name

    Enter a descriptive name. Chinese and English are supported.

    Tool Description

    A brief description of the tool's features and scenarios.

    This helps the large model determine whether to call the tool for the current task. Use natural language for the description and provide examples if possible.

    Tool Path

    The relative path to the Plug-in URL.

    The path must start with a forward slash (/).

    This path is appended to the Plug-in URL to construct the complete URL.

    Request Method

    Select the GET or POST request method to call the API operation as needed.

    Submission Method

    The encoding type of the request or response.

    • application/json: The body content is data in the JSON format.

    • application/x-www-form-urlencoded: Encodes form data into key-value pairs.

      • This encoding method is used for POST requests. Form data is encoded into key-value pairs and transmitted through URL encoding. Multiple key-value pairs are separated by ampersands (&). Each key and value are separated by an equal sign (=). URL encoding converts special characters into a percent sign (%) followed by two hexadecimal digits. For example, a space is encoded as %20, & is encoded as %26, and = is encoded as %3D.

      • Example: name=John Doe&age=25 is encoded as name=John%20Doe&age=25.

    Configure input and output parameters

    Configure Input Parameters

    Click Add Input Parameter and configure the parameters.

    Parameter Name: Use a name that is as descriptive as possible to help the LLM understand what parameter information needs to be identified. For example, use a meaningful word such as city.

    Parameter Description: A concise and accurate description of the input parameter's function. This helps the LLM better understand how to retrieve the parameter. For example, for a date parameter, you can describe the date format, such as yyyy-MM-dd.

    Type: The parameter type.

    Important

    Sub-properties under the Object type cannot be empty. Click the image icon at the end of the object row to add a sub-property.

    Passing Method: Set this parameter accurately.

    • LLM Recognition: The parameter value needs to be extracted from the user input by the LLM.

    • Business Pass-through: The parameter value is actively passed from an external source. The data is not processed or modified during transmission.

      When you call an application using the DashScope SDK or an HTTP interface, the input parameters of the business pass-through type in the plug-in are passed to the application through biz_params and user_defined_params. For more information, see Pass plug-in parameters through an API.

    Configure Output Parameters

    Click Add Output Parameter and configure the parameters. All parameters are required.

    The LLM filters and reorganizes the results returned by the API based on the definition of the output parameters and the user's question. The final answer is then returned to the user.

    Similar to input parameters, output parameters must be described as concisely and accurately as possible, with as few nested levels as possible.

    Important

    Both GET and POST request methods support the Object type for parameters. However, sub-properties under the Object type cannot be empty. Click the image icon at the end of the object row to add a sub-property.

    Advanced Configuration (Optional)

    Advanced Configuration

    Add call examples for the LLM to reduce missed recalls and incorrect recalls.

    This is typically used in scenarios where input parameters are complex and the model is prone to construction errors. Providing examples improves the accuracy of the LLM in calling the plug-in.

    Value: The expected call input parameters that the LLM should construct when the user enters the current query. For example, if a user enters "Query the weather in Hangzhou for tomorrow", the expected input parameter is {"city": "Hangzhou", "date": "2025-04-25"}.

  2. After you complete the configuration, click Save Draft.

  3. Debug the tool API online to check if it can be called.

    image

    Click Test Tool. If authentication is enabled, enter the authentication information and the values of the input parameters, and then click Start Running.

    If the run fails, adjust the configuration based on the error message in the Run Result section and test again until the run succeeds.

    You can enter the values for the input parameters manually or using code. For complex input parameters, use the Code Editing mode. In the code editor, you can submit the complete input parameters and their corresponding values in JSON format.

  4. After the test succeeds, click Publish. Only tools that are Published can be called in applications.

Use a plug-in

Console

  • Method 1: In the Tools list, add a published tool to an application.

    A tool can be associated only with an Agent Application that is in the same workspace.
    1. In the row that contains the tool, click Add to Application and select the target application.

    2. In the application, you can see that the tool has been successfully added.

      You can also add other tools. You can add up to 10 tools. The application decides which tool to call.
    3. Test whether the plug-in works as expected.

      • No authentication: You can chat with the LLM in the input box to test the plug-in.

      • User-level or service-level authentication: Before you start a conversation, click image to configure the authentication token to be passed. If you do not leave the current page, you only need to configure it once.

      • If the Passing Method for an input parameter of the tool is set to Business Pass-through, you must click image to configure the variable value to be passed before you start a conversation. If you do not leave the current page, you only need to enter the value once.

    4. After the test is complete, Publish the application.

  • Method 2: In the Plug-ins list, add the tools under a plug-in to an agent.

    1. Find the target plug-in and click Add to Agent.

      A tool can be associated only with an Agent Application that is in the same workspace.
      By default, only published tools are added. You can select up to 10 published tools to add to an agent application.
    2. Follow the steps in Method 1 to test the plug-in on the application details page and Publish the application.

  • Method 3: In Model Studio Applications, add the plug-in tool, test the plug-in, and publish the application.

API

Obtain the tool ID

The tool ID identifies a specific tool. When you call a tool using an API, you must pass the correct tool ID to ensure that the request is correctly identified.

  1. In the Plug-ins list, find the plug-in to which the tool belongs and click View.

  2. Hover the mouse pointer over the image icon next to the tool name.

  3. Click the image icon to copy the tool ID.

    image

  • When you call an application using an API, if a plug-in associated with the application has business pass-through parameters or has user-level authentication enabled, you must pass the authentication information or pass-through parameter information using the biz_params parameter. For more information, see the DashScope API Reference.

Manage custom plug-ins and tools

Delete a plug-in

Important

If you delete a plug-in, all tools under that plug-in are deleted and the applications that call the plug-in become invalid. This operation cannot be undone. Proceed with caution.

In the Plug-ins list, find the target plug-in and click ... > Delete.

Edit a plug-in

  1. In the Plug-ins list, find the target plug-in and click View.

  2. In the upper-right corner, click Edit Plug-in, modify the plug-in information, and save the changes.

    The plug-in information takes effect immediately after it is saved. If you modify the plug-in URL, header, or authentication information, tool calls may be affected. You must test and publish the tools again.

Editing tools

After you modify the tool information, you must test and publish the tool again for the changes to take effect.

  1. In the Plug-ins list, find the plug-in to which the tool belongs and click View.

  2. In the row that contains the tool, click Edit, modify the tool information, and then click Save Draft.

  3. Click Test Tool to debug the tool online.

  4. After the run succeeds, click Publish.

Delete a tool

Important

If you delete a tool, the applications that call this tool become invalid. This operation cannot be undone. Proceed with caution.

  1. In the Plug-ins list, find the plug-in to which the tool belongs and click View.

  2. In the row that contains the tool, click Delete.

Error codes

The following table describes common error messages that may occur when you publish a tool.

Error code

Error message

Description

130040

The parameter description for xx is missing.

Cause: The description for the xx parameter is missing.

Solution: Add the parameter description and publish the tool again.

130022

Failed to save the tool information/Check whether the sample parameters are correct.

Possible cause 1: A sub-property of an Object type parameter in the input or output parameters is empty.

Solution: Click the image icon at the end of the object row to add a sub-property.

Possible cause 2: The request method is GET, but an input parameter is of the Object type.

Solution: The GET request method does not support the Object type for input parameters. Select another type.