Subtitle translation
in your workflow.
Connect Premiere Pro plugins and custom tools to the same Basic and Plus translation service you use on the website.
Quick start
Create a key, then download the Node.js example. It estimates the cost, submits a task, polls its status and saves the translated SRT. It requires Node.js 20 or newer and no additional packages.
export AST_BASE_URL='https://your-website-origin'
export AST_API_KEY='ast_YOUR_API_KEY'
node translate-subtitle.mjs input.srt zh plus translated.srt my-job-001
# Add true as the final argument for bilingual subtitles:
node translate-subtitle.mjs input.srt zh plus bilingual.srt my-job-001 trueReplace the base URL with this website's origin and place the downloaded script beside your SRT file. Choose basic or plus explicitly. Reuse the same job key, input and options after a network failure. A repeated download with the same job key reuses the existing translation; choose an output filename that does not already exist.
Authentication
Open Dashboard → Security → API keys. Give the key a name to create it. You can view and copy the full key again at any time, or revoke it from the same page.
Authorization: Bearer ast_YOUR_API_KEYUse this website's origin as your base URL. All 6 endpoints require a valid key. Each account can have 5 active keys. API keys access API-created translations and your credit balance.
Use your own account key. Keep it private and never bundle a shared key into a distributed plugin. Cookies and query-string keys are not accepted.
Six endpoints
| Method | Path | Purpose |
|---|---|---|
| GET | /api/v1/capabilities | Languages, tiers, limits |
| GET | /api/v1/credits | Credit balance |
| POST | /api/v1/translations/estimate | Preview cost |
| POST | /api/v1/translations | Create a task |
| GET | /api/v1/translations/{taskId} | Status and progress |
| GET | /api/v1/translations/{taskId}/result | Download SRT |
JSON success responses wrap the result in { "data": ... }. Successful result downloads always return SRT.
Estimate & submit
Both POST endpoints accept the same JSON body. Send Content-Type: application/json.
{
"fileName": "interview.srt",
"subtitle": "1\n00:00:01,000 --> 00:00:03,000\nHello!\n",
"targetLanguage": "zh",
"modelTier": "plus"
}subtitle, targetLanguage, and modelTier are required. Explicitly choose basic or plus; omitting modelTier returns 400 INVALID_REQUEST. Source language is detected automatically. Get target language codes from /api/v1/capabilities.
Optional glossary entries contain source and target. Optional characters entries use those fields plus gender (male or female) and aliases (a list of names). See the OpenAPI schema for exact shapes. Unknown fields are rejected.
First POST to /api/v1/translations/estimate. It returns creditCost, availableCredits, sufficientCredits, and subtitle counts. This previews cost without creating a task or reserving credits.
Create a task
curl "$AST_BASE_URL/api/v1/translations" \
-H "Authorization: Bearer $AST_API_KEY" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: premiere-sequence-123-zh-v1' \
--data-binary @request.jsonSave the JSON body as request.json. Set the two environment variables to your website origin and API key.
A new task returns 202 Accepted with data.id, data.creditCost, data.statusUrl, and data.resultUrl. The Location header points to its status endpoint.
{
"data": {
"id": "6f476119-c02f-49a9-b61f-2b3327bd318c",
"status": "pending",
"fileName": "interview.srt",
"modelTier": "plus",
"targetLanguage": "zh",
"creditCost": "1.00",
"statusUrl": "/api/v1/translations/6f476119-c02f-49a9-b61f-2b3327bd318c",
"resultUrl": "/api/v1/translations/6f476119-c02f-49a9-b61f-2b3327bd318c/result"
}
}Generate one Idempotency-Key per intended translation and keep it when retrying. Identical requests return the same task with HTTP 200. A different body with the same key returns 409. Keys are scoped to your account and survive API key rotation.
The header accepts 1–128 letters, numbers, dots, underscores, colons, or hyphens. A replay whose task has expired or been deleted returns 410. Use a new key only when you intend to create another billable task.
Progress & results
Poll the status URL every 5 seconds. Status is pending, processing, completed, or failed. progress is a percentage or null when unavailable; errorCode describes a failed task.
curl --fail "$AST_BASE_URL/api/v1/translations/$TASK_ID" \
-H "Authorization: Bearer $AST_API_KEY"Set TASK_ID to data.id from submission. Progress responses include the task fields above plus progress and errorCode; both can be null. Stop polling on failed and display the error. Use a new job key only for an intentional new translation attempt.
When complete, GET the result URL and save the response text as an SRT file. The response type is application/x-subrip; charset=utf-8. Omit includeOriginal or set it to false for translation only. Add ?includeOriginal=true for bilingual captions, with the source followed by its translation.
curl --fail "$AST_BASE_URL/api/v1/translations/$TASK_ID/result?includeOriginal=true" \
-H "Authorization: Bearer $AST_API_KEY" \
--output translated-bilingual.srtThe format parameter is not supported and returns 400 INVALID_REQUEST. Errors are returned as JSON. A result requested too early returns 409 TRANSLATION_NOT_READY with Retry-After: 5. Failed translations return 409 TRANSLATION_FAILED.
Download completed results promptly. The website's deletion and retention rules also apply to API tasks. Missing or inaccessible tasks return 404. API tasks appear in your subtitle history.
Credits & limits
API translations use your existing credits and the website's tier pricing and minimum charge. There is no additional API surcharge. Use the estimate endpoint for each file; it does not lock pricing. The accepted task's creditCost is the amount reserved.
Credits are reserved while a task is pending or processing and charged once on successful completion. Reserved credits remain valid for that task if their original expiration passes while queued. Failure or deletion releases the reservation: unexpired credits return to the available balance; expired credits remain expired. A failed task has no translation charge. The balance endpoint returns decimal strings: availableCredits, reservedCredits, and totalCredits (available plus reserved).
{ "data": { "availableCredits": "9.00", "reservedCredits": "1.00", "totalCredits": "10.00" } }- 60 requests per 60-second window per account, across all keys.
- 10 POST requests per window, shared by estimates and submissions.
- 3 pending or processing API tasks at once.
- One file and one target language per task.
- 1 MiB UTF-8 subtitle text; 2 MiB total JSON; 5,000 cues.
- Cue text length follows the website setting (default 500 characters).
- 200 glossary entries; 100 characters with up to 20 aliases each. Terms and names are limited to 200 characters.
Read live limits from /api/v1/capabilities. Responses include X-RateLimit-Limit, X-RateLimit-Remaining, and X-RateLimit-Reset (Unix seconds). Honor Retry-After on 429 responses. Translation completion time depends on the queue and input.
Errors & retries
{
"error": {
"code": "INSUFFICIENT_CREDITS",
"message": "Your account does not have enough available credits."
},
"requestId": "..."
}400: invalid input. 401: invalid or revoked key. 402: insufficient credits. 404: missing/inaccessible task. 409: conflicting key, unfinished or failed translation. 410: replayed task expired. 413: input too large. 415: expected JSON. 422: subtitle rejected. 429: request or active-task limit. 502: incomplete result. 503: service, model, or queue unavailable.
Retry network errors and temporary server failures with the same Idempotency-Key and body. Wait for the Retry-After duration when present. After a terminal translation failure, a deliberate retry requires a new key. Include X-Request-Id and the task ID when contacting support.
Premiere Pro workflow
- Select or export an SRT file.
- Estimate the cost and submit it with the selected target language.
- Show task progress, then save the translated SRT.
- Import it into Premiere and place it on a caption track.
Declare this origin in the UXP manifest's network permissions and request file access for SRT input/output. Public endpoints support CORS for Bearer authorization without cookies.
Use numbered SRT cues with HH:MM:SS,mmm timestamps, non-empty text, and blank lines between cues. Existing subtitle cleanup applies: formatting tags are removed, cues are renumbered, and overlapping secondary overlay text may be filtered. Retained timestamps are preserved. Premiere styling is not carried by SRT.
Automatic access to an existing caption track must be verified against your Premiere version. The API accepts subtitle text; transcribe audio to subtitles before submitting.