Calls AMB to rewrite text in a new tone.
Try it now
You can run this API directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After a successful run, OpenAPI Explorer can automatically generate SDK code examples.
Try it now
RAM authorization
The following table describes the authorization information for this API. You can use it in the Action element of a RAM policy statement to grant a RAM user or RAM role the permission to call this API. Details are as follows:
- Action: The specific permission point.
- Access level: The access level of each action. Valid values: Write, Read, and List.
-
Resource type: The resource types that support authorization for the action. Details are as follows:
- Required resource types are marked with a preceding asterisk (*).
- For operations that do not support resource-level authorization,
All Resourcesis used.
- Condition key: The condition keys defined by the cloud service itself.
- Dependent action: Other permissions required to successfully perform the action. The caller must have the permissions of all dependent actions for the operation to succeed.
| Action | Access level | Resource type | Condition key | Dependent action |
|---|---|---|---|---|
| aimiaobi:RunWriteToneGeneration | create | *All Resources * |
| None |
Request syntax
Request parameters
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
| WorkspaceId | string | Yes | Unique identifier of the Alibaba Cloud Model Studio workspace. To obtain it, see Workspace ID | llm-xxx |
| ReferenceData | object | Yes | Data required for generation | |
| Contents | array | Yes | List of body text blocks | |
| string | Yes | Body text | xxx | |
| TaskId | string | No | Unique identifier of the associated creation article Note You do not need to specify TaskId by default. The system generates it automatically. When the same TaskId is used in subsequent tasks, those tasks belong to the same conversation group. | 7AA2AE16-D873-5C5F-9708-15396C382EB1 |
| Prompt | string | Yes | Tone: for example, "lyrical", "bold", "subtle", "excited", "friendly", and "inspirational" | Inspirational |
Response elements
| Element | Type | Description | Example |
|---|---|---|---|
| object | Schema of Response | ||
| Header | object | Response headers | |
| ErrorCode | string | Error code | AccessForbid |
| ErrorMessage | string | Error message returned when the call fails. | xxx |
| Event | string | SSE event. | task-failed |
| SessionId | string | Session ID | F1953EE6-157C-40DC-BBF1-87C98AC27C51 |
| TaskId | string | Task ID | F1953EE6-157C-40DC-BBF1-87C98AC27C51 |
| TraceId | string | End-to-end trace ID | F1953EE6-157C-40DC-BBF1-87C98AC27C51 |
| Payload | object | Response body | |
| Output | object | Output | |
| Text | string | Generated text result | xxx |
| Usage | object | Token usage | |
| InputTokens | long | Number of tokens used for input | 1 |
| OutputTokens | long | Number of tokens used for output | 1 |
| TotalTokens | long | Total number of tokens used in this call | 2 |
| RequestId | string | Unique request ID | FB698445-61DA-5361-BF73-1C5F1157E888 |
Examples
Success response
JSON format
Error codes
| HTTP status code | Error code | Error message | Description |
|---|---|---|---|
| 403 | NoPermission | You are not authorized to perform this action. | Please check the workspaceId assignment |