All Products
Search
Document Center

Alibaba Cloud Model Studio:Prompt Template Overview

Last Updated:Mar 10, 2026

Building large language model (LLM) applications often means writing similar prompts for different scenarios -- a process that grows harder to maintain as your application scales. Prompt templates separate a prompt's fixed structure from its dynamic variables, so you can reuse, version, and optimize prompts in one place without redeploying application code.

Important

Prompt templates are available only in the International Edition (Singapore region).

How prompt templates work

  1. Create a template -- Save a template in the Model Studio console or through an API. Each template gets a unique template ID.

  2. Retrieve the template -- Call the GetPromptTemplate API with the template ID to get the template content.

  3. Generate the prompt -- Replace template variables with your business data to produce the final prompt.

  4. Send the prompt to a model -- Pass the generated prompt to a model and get a result.

Template types

Model Studio provides two types of prompt templates: pre-built prompt templates and custom prompt templates.

DimensionPre-built prompt templateCustom prompt template
SourceProvided by Model Studio. Covers common business scenarios.Created by you in the console or through an API.
EffectivenessOptimized for stable performance.Depends on your design quality.
Ease of useReady to use -- call directly from the console or API.May require iterative optimization. Familiarity with prompt engineering principles -- such as using clear instructions, providing examples, and applying format constraints -- helps. Some development and technical skills are also needed.
Best forGeneral scenarios such as creative copywriting and office assistance. Users with limited prompt design experience.Complex or domain-specific scenarios such as financial risk control and medical consultation. Scenarios that require strict output formats (JSON, lists).
ModifiableNoYes

Browse and manage pre-built templates

Browse templates

Open the Prompts page to browse the pre-built prompt templates that Model Studio provides.

View and manage a template

  • View details -- Click View Details on a template card to see the template name, content, variables, and ID.

  • Copy the prompt content -- Click Copy Prompt to copy the template content to your clipboard.

  • Create an application from a template -- Click ... > Create Application. The template content is automatically populated in the prompt editor of the Agent Application, where you can use it directly or modify it.

  • Duplicate as a custom template -- Click ... > Copy Template. This creates a custom prompt template named "Pre-built Template Name_Copy_Timestamp" on the Prompts page.

Create and manage custom templates

Create a template

Create custom prompt templates in the console or through an API.

Console

Choose one of the following approaches:

  • Start from a pre-built template -- On a pre-built prompt template card, click . . . > Copy Template. A custom prompt template named "Pre-built Template Name_Copy_Timestamp" is created.

  • Create from scratch -- On the Prompts page, click Create Prompt. Configure the template, then click Save.

    Create Prompt page

API

  1. Get your workspace ID. For details, see Get an APP ID and a workspace ID.

  2. Call the CreatePromptTemplate API to create the template.

Manage custom templates

After you create a custom prompt template, it appears on the Prompts page. From there:

  • Click Modify on a template card to edit the template content.

  • Click Copy Prompt to copy the template content.

  • Click ... > Create Application to populate the template in an Agent Application prompt editor.

  • Click ... > Copy Template to duplicate the template. The copy is named "Custom Template Name_Copy_Timestamp".

  • Click ... > Delete to delete the template.

Use a prompt template in the console

Console

  1. On a pre-built or custom template card, click Use Prompt > Create Application. The template content is populated in the agent application prompt.

  2. Select a model for the application and enter a question to test the prompt.

API

  1. Go to the GetPromptTemplate API reference page and click Debug.

  2. On the Configure Parameters tab, enter the following values:

  3. Click Initiate Call to run the API call.

SDK

  1. Go to the GetPromptTemplate API reference page and click Debug.

  2. On the Configure Parameters tab, enter the workspaceId and promptTemplateId. These values are automatically populated in the SDK example code.

  3. Click SDK Sample Code on the debug page.

  4. Run the example online, or download the full project and configure the accessKeyId and accessKeySecret before running it locally.

To get your AccessKey pair, see Obtain an AccessKey and an AgentKey.

Error codes

If an API call fails, see Error messages to troubleshoot the issue.

FAQ

What advantage does the GetPromptTemplate API have over hardcoding prompts in my code?

The GetPromptTemplate API separates prompt content from your application code. This means you can:

  • Update prompts without redeploying -- Edit and optimize prompts in the Model Studio console without modifying or redeploying your application code.

  • Centralize prompt management -- Store all prompts in one place so prompt engineers and developers can collaborate, track versions, and reuse prompts.

  • Keep prompts consistent -- Every part of your application and every service uses the same prompt version and structure, eliminating drift from manual maintenance.