---
title: "Prepare a speech script with the Smart Voice Director"
method: POST
path: "/v1/audio/speech/scripts"
tags: ["audio"]
---

# Prepare a speech script with the Smart Voice Director

`POST /v1/audio/speech/scripts`

## Request

- Base URL: `https://api.beatra.ai` (the document declares no server; this is the origin it was published from)
- URL: `https://api.beatra.ai/v1/audio/speech/scripts`
- Auth: none declared. Required headers: `Idempotency-Key`

Creates an asynchronous Smart Voice Director task. The Smart Voice Director reads the text and optional instructions, then returns a script that is ready to synthesize, in Beatra speech markup tailored to the target voice and model: emotion, performance, sound effects, pauses and pronunciation. It never changes the words. Without a voice or model it recommends one, with alternatives, each with a name, a preview link and a reason. Send each script's synthesis object, unchanged, as the body of POST /v1/audio/speech; a script whose synthesis is null cannot be synthesized as is. Charged after completion from actual input, output and reasoning tokens. To submit a text, the balance must cover its estimate (the catalog's estimate_per_1000_characters_credits for its length, counting at least 1,000 characters) plus that of any other Smart Voice Director task in progress on the account. An account runs at most 2 Smart Voice Director tasks at a time. Nothing is charged when the Smart Voice Director could not direct the text (directed is false) or reuses an earlier reading of the same text.

## Headers

- `x-request-id` string, nullable
- `Idempotency-Key` string, required
- `authorization` string, nullable

## Request body

- SpeechScriptRequest: Direct a text: annotate it for performance, and recommend a voice and a speech model when none is given.
  - `metadata` object, nullable: Caller-supplied metadata; ≤16 keys, key ≤64 chars, value ≤512 chars
  - `callback_url` string, nullable: HTTPS URL beatra will POST the final Task envelope to when the Task reaches a terminal state
  - `callback_signing_key_id` string, nullable: Optional standalone callback signing key. Omit for unsigned callback delivery; requires callback_url when provided.
  - `input` string, required: Text to perform, in any supported language, 1 to 50,000 characters. It may already contain Beatra speech markup such as {pause 0.5} or {pron 行 hang2}; the Smart Voice Director keeps it and only adds to it. The words themselves are never changed.
  - `instructions` string, nullable: Optional requirements in natural language, in any language, up to 2,000 characters, for example "a bit suspenseful, whisper the last line". Without them the Smart Voice Director performs the text by its meaning.
  - `voice` string, nullable: Optional voice to perform for: a preset voice or one of your own cloned voices. Same meaning as voice in POST /v1/audio/speech. Omit it to let the Smart Voice Director recommend a voice.
  - `model` 'auto' | 'minimax-speech-2.8-hd' | 'minimax-speech-2.8-turbo' | 'doubao-seed-tts-3.0' | 'doubao-seed-tts-2.0' | 'elevenlabs-v4-turbo' | 'elevenlabs-v4': Optional speech model to perform for, with the same values and defaults as model in POST /v1/audio/speech. auto or omitted: resolved from the voice, or recommended together with the voice.
  - `language` string: Language of the input as a BCP-47 tag. Usually omit it (auto, the default): the language is detected. Send it only when the user names the language or a dialect the text cannot show, such as Cantonese (yue).
  - `context` SpeechScriptContext, nullable: Text around the input. It only helps the Smart Voice Director read the tone.
    - `before` string, nullable: Text before the input, up to 2,000 characters.
    - `after` string, nullable: Text after the input, up to 2,000 characters.

## Response `202`

Task accepted

- TaskEnvelope: Standard Task envelope. Returned by every async-creation endpoint, GET /v1/tasks/{id}, and the body of customer callback POSTs.
  - `object` 'task'
  - `task_id` string, required
  - `status` 'queued' | 'running' | 'succeeded' | 'failed' | 'canceled', required
  - `capability` string, required
  - `workload_type` 'model' | 'social_operation'
  - `model` string, nullable: Caller-requested model verbatim (may be 'auto'). Null for social_operation tasks.
  - `resolved_model` string, nullable: Actual model that ran (null until execution starts; equals model for explicit-model calls)
  - `model_selection_reason` unknown
  - `social` SocialTaskIdentity, nullable
    - `platform` string, required
    - `operation_key` string, required
    - `operation_name` string, required
    - `schema_hash` string, required
  - `metadata` object, nullable
  - `input` object, nullable
  - `progress` AppApiV1SchemasCommonTaskProgress, nullable
    - `percent` integer, nullable
    - `stage` string, nullable
    - `message` string, nullable
  - `output` object, nullable
  - `warnings` TaskWarning[]
    - `code` string, required: e.g. option_clamped / auto_routed
    - `message` string, required
    - `field` string, nullable
  - `error` AppApiV1SchemasCommonTaskError, nullable
    - `code` string, required: Stable machine-readable public error code.
    - `type` string, required: Stable public error family.
    - `message` string, required: Human-readable safe failure reason.
    - `retryable` boolean, required: Whether the same logical request may succeed when retried unchanged.
    - `param` string, nullable: JSON Pointer to the relevant request or output field.
    - `details` object, nullable: Provider-neutral expected, received, supported, or candidate failure facts.
    - `request_id` string, required: Request trace identifier for support and correlation.
  - `usage` UsageObject, nullable
    - `input_tokens` integer, nullable
    - `output_tokens` integer, nullable
    - `cache_read_tokens` integer, nullable
    - `cache_creation_tokens` integer, nullable
    - `reasoning_tokens` integer, nullable
    - `image_count` integer, nullable
    - `image_pixels` integer, nullable
    - `video_seconds` number, nullable
    - `input_video_seconds` number, nullable: Authoritative input-video seconds included in settled video usage.
    - `output_video_seconds` number, nullable: Authoritative generated/output-video seconds included in settled video usage.
    - `audio_seconds` number, nullable
    - `characters` integer, nullable
    - `lines` UsageLine[]
      - `meter` string, required: e.g. input_token / output_token / image_count / input_video_second / output_video_second
      - `quantity` string, required: Decimal — number of meter units consumed
      - `unit` string, required: Display unit, e.g. 'token' / 'image' / 'second'
      - `billed_amount_credits` string, nullable: Credits charged for this usage line. Populated by PR-2/3.
    - `credits` string, nullable: Credits charged for this Task. Populated by PR-2 / PR-3.
  - `billing` TaskBilling, nullable
    - `charged_credits` string, nullable: Credits charged to wallet for this Task. Populated by PR-2/3.
    - `refunded_credits` string, nullable: Credits refunded for this Task. Populated by PR-3.
    - `granted_credits` string, nullable: Credits on this Task covered by a directed grant rather than by the wallet, net of any revocation. Absent when no grant applied.
    - `grant_source` string, nullable: Which grant covered it. Present exactly when granted_credits is.
    - `net_charged_credits` string, nullable: Final customer charge: charged_credits minus refunded_credits minus granted_credits. This is the number to report as what the Task cost.
  - `callback` TaskCallback, nullable
    - `url` string, required
    - `status` 'pending' | 'dispatching' | 'delivered' | 'retrying' | 'failed', required
    - `attempt_count` integer, required
    - `delivered_at` string, date-time, nullable
    - `last_error` string, nullable: Stable Beatra-owned callback delivery failure summary.
  - `created_at` string, date-time, required
  - `started_at` string, date-time, nullable
  - `deadline_at` string, date-time, nullable
  - `completed_at` string, date-time, nullable
  - `cancel_requested_at` string, date-time, nullable
  - `links` TaskLinks, required
    - `self` string, required
    - `cancel` string, nullable
    - `assets` string, nullable: Absolute customer-console URL for viewing and managing the generated artifacts.

## Other responses

- `402`: The balance does not cover the estimate for this text plus that of any other Smart Voice Director task in progress on the account (details.reason director_estimate)
- `404`: Voice not found
- `422`: Invalid request, a voice that does not match the model, or a voice that is not ready
- `429`: Too many requests, 2 Smart Voice Director tasks already in progress on the account (details.reason director_inflight_limit), or the Smart Voice Director at capacity (details.reason director_busy). Honor Retry-After.
- `503`: The Smart Voice Director or the selected voice or model is temporarily unavailable.

## Changes

- **2026-12-01** `169708e3a8de`: 1 info
  - added the new `doubao-seed-tts-3.0` enum value to the request property `model`
- **2026-11-08** `73ee7b0fc8ac`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/beatra/apis/agent-service-api/changes/v1/audio/speech/scripts/post.md)

---

[API](https://skmtc.dev/beatra/apis/agent-service-api.md) - [All operations](https://skmtc.dev/beatra/apis/agent-service-api/llms.txt) - [OpenAPI document](https://skmtc.dev/beatra/apis/agent-service-api/revisions/54a093c28eee?raw)
