Translate text (SSE)
Translate `content` from source to target language and stream segments over SSE. Choose the strategy with `mode`: `fast` (default) segmented, `stream` sliding-window, `raw` direct model pass-through.
`content` defaults to max 65536 characters (`RD_MAX_TEXT_CHARS`); longer text or `Content-Length` above `RD_MAX_REQUEST_BYTES` (default 262144) returns 413. Invalid languages, identical source/target, missing/extra fields, or invalid `mode` return 400. `X-Openapi-Amount` is set only on the 200 stream, from input `content` when the stream is created.
Request Parameters
List of parameters supported by this API endpoint
| Name | Type | Example | Description |
|---|---|---|---|
Required | string | 本发明涉及一种用于图像识别的装置,包括处理器和存储器。
所述处理器被配置为对输入图像进行分类。 | Source text to translate. Must not be blank. Default max 65536 characters. |
Required | object | zh | Source language code. |
Required | object | en | Target language code; must differ from source. |
| string | fast | Translation mode: `fast` (default) segmented, `stream` sliding-window, `raw` direct pass-through. Example: `fast`. |
Response Schema
Structure of the API response data
| Field Name | Type | Example | Description |
|---|---|---|---|
_meta | object | {
"openapi_billing": {
"version": 1,
"multiplier": "2"
}
} | Billing metadata on the SSE JSON body (not an HTTP header). |
stateRequired | string | success | Execution status |
progress | string | 1/2 | Translation progress as ``current/total`` segments (e.g. ``3/10``). `raw` is typically ``1/1``. |
textOriginalRequired | string | 本发明涉及一种用于图像识别的装置,包括处理器和存储器。 | Source segment text |
textTranslatedRequired | string | The present invention relates to an apparatus for image recognition, comprising a processor and a memory. | Translated segment text |
translatedCharacterCountRequired | integer | 105 | Character count of this translated segment |
Success Response Example
Example of a successful API response
JSON
{
"_meta": {
"openapi_billing": {
"version": 1,
"multiplier": "2"
}
},
"state": "success",
"status": true,
"progress": "1/2",
"error_code": 0,
"textOriginal": "本发明涉及一种用于图像识别的装置,包括处理器和存储器。",
"textTranslated": "The present invention relates to an apparatus for image recognition, comprising a processor and a memory.",
"translatedCharacterCount": 105
}Error Codes
List of possible error codes returned by this endpoint
Business Errors
| Error Code | Description |
|---|---|
68300004 | Invalid parameter! |
68300005 | Search api failure! |
68300006 | Analytic basic access error! |
68300007 | Bad request! |
68300008 | Service error, please try again later! |
68300010 | The file does not comply with upload specifications! |
Platform Errors
| Error Code | Description |
|---|---|
67200001 | API call exceeds the total limit set by the platform! |
67200002 | Quota exceeds the limit! |
67200003 | Access token expired or authentication error! |
67200004 | No permission or API package quota has exceeded the limit! |
67200005 | Insufficient balance, call failed! |
67200006 | This client has expired and call failed! |
67200007 | Exceeded the call limit, call failed! |
HTTP Status Codes
| Status Code | Description |
|---|---|
0 | Success |
400 | Validation failed before the stream starts. Body is always `{"error":"..."}`; no `TYPE` field and no billing header. |
413 | Payload too large. `content` exceeds `RD_MAX_TEXT_CHARS` (default 65536) or `Content-Length` exceeds `RD_MAX_REQUEST_BYTES` (default 262144). Body is `{"error":"..."}` with no billing header. |
Performance Metrics
Expected performance characteristics for this endpoint
Normal Response Time
5000 ms
Max Response Time
10000 ms