Skip to main content

RunWriteToneGeneration

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 Resources is 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.
ActionAccess levelResource typeCondition keyDependent action
aimiaobi:RunWriteToneGenerationcreate
*All Resources
*
    None
None

Request syntax

POST /quanmiao/aimiaobi/runWriteToneGeneration HTTP/1.1

Request parameters

ParameterTypeRequiredDescriptionExample
WorkspaceIdstringYes

Unique identifier of the Alibaba Cloud Model Studio workspace. To obtain it, see Workspace ID

llm-xxx
ReferenceDataobjectYes

Data required for generation

ContentsarrayYes

List of body text blocks

stringYes

Body text

xxx
TaskIdstringNo

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
PromptstringYes

Tone: for example, "lyrical", "bold", "subtle", "excited", "friendly", and "inspirational"

Inspirational

Response elements

ElementTypeDescriptionExample
object

Schema of Response

Headerobject

Response headers

ErrorCodestring

Error code

AccessForbid
ErrorMessagestring

Error message returned when the call fails.

xxx
Eventstring

SSE event.

task-failed
SessionIdstring

Session ID

F1953EE6-157C-40DC-BBF1-87C98AC27C51
TaskIdstring

Task ID

F1953EE6-157C-40DC-BBF1-87C98AC27C51
TraceIdstring

End-to-end trace ID

F1953EE6-157C-40DC-BBF1-87C98AC27C51
Payloadobject

Response body

Outputobject

Output

Textstring

Generated text result

xxx
Usageobject

Token usage

InputTokenslong

Number of tokens used for input

1
OutputTokenslong

Number of tokens used for output

1
TotalTokenslong

Total number of tokens used in this call

2
RequestIdstring

Unique request ID

FB698445-61DA-5361-BF73-1C5F1157E888

Examples

Success response JSON format
{
  "Header": {
    "ErrorCode": "AccessForbid",
    "ErrorMessage": "xxx",
    "Event": "task-failed",
    "SessionId": "F1953EE6-157C-40DC-BBF1-87C98AC27C51",
    "TaskId": "F1953EE6-157C-40DC-BBF1-87C98AC27C51",
    "TraceId": "F1953EE6-157C-40DC-BBF1-87C98AC27C51"
  },
  "Payload": {
    "Output": {
      "Text": "xxx"
    },
    "Usage": {
      "InputTokens": 1,
      "OutputTokens": 1,
      "TotalTokens": 2
    }
  },
  "RequestId": "FB698445-61DA-5361-BF73-1C5F1157E888"
}

Error codes

HTTP status codeError codeError messageDescription
403NoPermissionYou are not authorized to perform this action.Please check the workspaceId assignment
Visit the Error Center to view more error codes.