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.
Prompt templates are available only in the International Edition (Singapore region).
How prompt templates work
Create a template -- Save a template in the Model Studio console or through an API. Each template gets a unique template ID.
Retrieve the template -- Call the GetPromptTemplate API with the template ID to get the template content.
Generate the prompt -- Replace template variables with your business data to produce the final prompt.
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.
| Dimension | Pre-built prompt template | Custom prompt template |
|---|---|---|
| Source | Provided by Model Studio. Covers common business scenarios. | Created by you in the console or through an API. |
| Effectiveness | Optimized for stable performance. | Depends on your design quality. |
| Ease of use | Ready 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 for | General 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). |
| Modifiable | No | Yes |
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 . 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 . 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 . 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.

API
Get your workspace ID. For details, see Get an APP ID and a workspace ID.
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 to copy the template content.
Click to populate the template in an Agent Application prompt editor.
Click to duplicate the template. The copy is named "Custom Template Name_Copy_Timestamp".
Click to delete the template.
Use a prompt template in the console
Console
On a pre-built or custom template card, click . The template content is populated in the agent application prompt.
Select a model for the application and enter a question to test the prompt.
API
Go to the GetPromptTemplate API reference page and click Debug.
On the Configure Parameters tab, enter the following values:
workspaceId -- Your workspace ID. See Get an APP ID and a workspace ID.
promptTemplateId -- The template ID. Find this on the template card in the console.
Click Initiate Call to run the API call.
SDK
Go to the GetPromptTemplate API reference page and click Debug.
On the Configure Parameters tab, enter the workspaceId and promptTemplateId. These values are automatically populated in the SDK example code.
workspaceId -- Your workspace ID. See Get an APP ID and a workspace ID.
promptTemplateId -- The template ID. Find this on the template card in the console.
Click SDK Sample Code on the debug page.
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.