RunTranslateGeneration

Updated at:

Translates text for content creation using AMB.

Debug

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.

Debug

Authorization information

The following table describes the authorization information of the API. You can use it in the Action element of a RAM permission policy statement to grant a RAM user or RAM role the permission to call this API. Details are as follows:

  • Operation: the specific permission point.

  • Access level: the access level of each operation. Valid values: Write, Read, or List.

  • Resource type: the resource types that support authorization for the operation. Details are as follows:

    • Required resource types are marked with a leading 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 operation: other permissions required to successfully perform the operation. The caller must also have the permissions of the dependent operations for the operation to succeed.

OperationAccess levelResource typeCondition keyDependent operation
aimiaobi:RunTranslateGenerationcreate
*All Resources
*
    None
None

Request syntax

POST /quanmiao/aimiaobi/runTranslateGeneration HTTP/1.1

Request parameters

NameTypeRequiredDescriptionExample
WorkspaceIdstringYes

The unique ID of the Alibaba Cloud Model Studio workspace. For more information, see Workspace ID

llm-xxx
ReferenceDataobjectYes

The data required for generation

ContentsarrayYes

The list of content

stringYes

The content

xxx
TaskIdstringNo

Optional. The unique ID of the associated creative article

Note You do not need to specify TaskId. The system generates one automatically. If the TaskId of subsequent tasks is the same, these tasks belong to the same conversation group.
xxx
PromptstringYes

The supported target languages for translation (the source language is automatically detected by the system)

languageprompt
EnglishEnglish
Simplified ChineseChinese
JapaneseJapanese
KoreanKorean
SpanishSpanish
FrenchFrench
PortuguesePortuguese
GermanGerman
ItalianItalian
English

Response parameters

NameTypeDescriptionExample
object

Schema of Response

Headerobject

Response header

ErrorCodestring

The error code

AccessForbid
ErrorMessagestring

The error message.

xx
Eventstring

The SSE event.

task-failed
SessionIdstring

The session ID

91C2B2B8-7D12-4A8D-A724-1E576D30C096
TaskIdstring

The task ID

3f7045e099474ba28ceca1b4eb6d6e21
TraceIdstring

The trace ID

0abb781d17146157564845243e20b5
Payloadobject

Response body

Outputobject

Output

Textstring

The text generation result

xx
Usageobject

Token usage

InputTokenslong

The number of tokens used for the input

1
OutputTokenslong

The number of tokens used for the output

1
TotalTokenslong

The total number of tokens used in this call

2
RequestIdstring

The unique request ID

DA021073-17CE-5CCF-9FEB-93226C766887

Examples

Success response example

JSON format

{
  "Header": {
    "ErrorCode": "AccessForbid",
    "ErrorMessage": "xx",
    "Event": "task-failed",
    "SessionId": "91C2B2B8-7D12-4A8D-A724-1E576D30C096",
    "TaskId": "3f7045e099474ba28ceca1b4eb6d6e21",
    "TraceId": "0abb781d17146157564845243e20b5"
  },
  "Payload": {
    "Output": {
      "Text": "xx"
    },
    "Usage": {
      "InputTokens": 1,
      "OutputTokens": 1,
      "TotalTokens": 2
    }
  },
  "RequestId": "DA021073-17CE-5CCF-9FEB-93226C766887"
}

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.