Canto-X1 情緒控制升級 — 11 種情緒,更傳神
廣東話出圖、剪輯、Gen片一條龍!1/1 截止
港嘢

機器可讀層

API 參考手冊

v1.0.0最後更新 OpenAPI 規格llms.txtdocs.md逐步指南

Canto-Gen(港嘢)公開 REST API — 文字轉語音與文件轉寫。

Canto-Gen 將廣東話文字轉化為自然、母語水平的語音。預設聲線以廣東話為本(Cantonese-optimized)。

快速開始

  1. 在 Creator 建立 API 金鑰(「API 金鑰」)。
  2. 以 GET /v1/voices 列出可用聲線。

同步生成 — 一個請求直接回傳音訊(短文字,≤300 計費 credits):

bash
curl -X POST https://api.canto-gen.com/v1/audio/speech \
  -H "Authorization: Bearer sk_live_…" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "cantogen-tts",
    "voice": "sum",
    "text": "你好,歡迎使用港嘢!",
    "response_format": "mp3"
  }'

非同步生成 — 提交任務後輪詢(任意長度,可批次 ≤25 項):

bash
# 1) 提交任務 — 回傳 202 Accepted 及 job_id
curl -X POST https://api.canto-gen.com/v1/audio/jobs \
  -H "Authorization: Bearer sk_live_…" \
  -H "Content-Type: application/json" \
  -d '{"model":"cantogen-tts","voice":"sum","text":"今日天氣幾好,一齊去行山啦。"}'

# 2) 每 2–5 秒輪詢一次,直至 status 變為 completed
curl -H "Authorization: Bearer sk_live_…" \
  https://api.canto-gen.com/v1/audio/jobs/{job_id}

# 3) 從回應的 audio_url 下載音訊
curl -o speech.mp3 "$AUDIO_URL"

完整的逐步指南(金鑰、定價、批次、SRT 字幕)請參閱:[/v1/docs](/v1/docs)。

除 GET /v1/voices(公開聲線目錄,可匿名存取)外,所有 endpoints 均需要以 Bearer token 方式傳入 API 金鑰:

text
Authorization: Bearer sk_live_…

請在 Creator 的「API 金鑰」頁面建立及管理金鑰。所有金鑰一律為 sk_live_…;免費方案的金鑰另受每日生成上限約束,任何方案的金鑰均可設定每月 credits 上限(留空 = 無上限)。兩種互補模式:

  1. 同步(短文字) — POST /v1/audio/speech 在同步隊列完全空閒時以 200 OK 直接回傳音訊 bytes。上限 300 個計費 credits,僅限 voice/design 模式(不支援 clone 及 srt)。隊列忙時請求會如實失敗並回傳503 {"error":"pool_cold"}(零扣費,不會靜默轉非同步)— 此時請改用非同步 endpoint;已接單但等待超過約 45 秒則 cooperative cancel+退款,回 503 sync_timeout(帶 Retry-After)— 保證交付請改用非同步 endpoint(2026-10-20 起,C3)。
  2. 非同步(任意長度) — POST /v1/audio/jobs 回傳 202 Accepted 連同job_id;每 2–5 秒輪詢 GET /v1/audio/jobs/{id} 直至 completed,然後下載預簽名的 audio_url。亦接受批次提交({"items":[…]},上限 25 項)。

錯誤

錯誤以穩定的 error code 配上可選的 message 回傳:

json
{ "error": "text_too_long", "message": "text exceeds 500 characters." }

觸發速率限制的請求會回傳 429 並附 Retry-After header(秒)。

參數上限(REST)

  • text:非同步 ≤ 500 字;同步 POST /v1/audio/speech ≤ 300 計費 credits。
  • instruction ≤ 500 字;合成優先次序 style → emotion → instruction(instruction 最終決定)。
  • style:英文 slug(中文 preset 作別名接受);emotion:11 值封閉 enum。
  • clone 只需 reference_audio(base64;單一請求 ≤4.4 MB,音頻約 ≤3 MB,樣本至少 3 秒)— prompt_text 已退役(送出會被忽略);design 用 gender + age;speed 已移除(忽略)。

實時 WebSocket

wss://api.canto-gen.com/v1/audio/realtime

港嘢另提供一條 WebSocket 實時端點,做 text-in → 串流 PCM audio-out。協議以 OpenAI Realtime 為基礎;港嘢加嘅事件/欄位標明為 extension。

js
// npm i ws
const WebSocket = require("ws");
const ws = new WebSocket("wss://api.canto-gen.com/v1/audio/realtime", {
  headers: { Authorization: `Bearer ${process.env.CANTOGEN_API_KEY}` },
});
ws.on("open", () => {
  ws.send(JSON.stringify({ type: "session.update", session: { voice: "sum", max_session_chars: 500 } }));
  ws.send(JSON.stringify({ type: "conversation.item.create",
    item: { type: "message", content: [{ type: "input_text", text: "你好,歡迎使用港嘢!" }] } }));
});
ws.on("message", (raw) => {
  const ev = JSON.parse(raw.toString());
  if (ev.type === "response.output_audio.delta") play(Buffer.from(ev.delta, "base64")); // PCM16 @ 48 kHz
  if (ev.type === "response.done") ws.close();
});

實時限制

  • idle_timeout_seconds: 120
  • max_session_duration_seconds: 300 (free) / unlimited (paid)
  • max_sessions_per_user: free 1 / lite 2 / starter 3 / pro 4 / studio 5 / enterprise 5
  • max_sessions_global: 8
  • max_session_chars_default: free 2000 / paid 20000
  • max_in_flight_utterances: 3
  • raw_chars_per_session: 20000
  • raw_chars_per_minute: 5000
  • utterance_lease_seconds: 60
  • max_frame_bytes: 65536

除 REST 之外,另有實時 WebSocket 端點(OpenAI Realtime base + 港嘢 extensions):wss://api.canto-gen.com/v1/audio/realtime,詳見 x-realtime-websocket 及 /v1/docs 的 Realtime WebSocket 一節。另設 ASR 實時轉寫 WebSocket:wss://api.canto-gen.com/v1/asr/realtime(audio-in → transcript-out,HK$1.40/音頻小時),詳見 x-asr-realtime-websocket。

認證

Base URL: https://api.canto-gen.com

除 GET /v1/voices(公開聲線目錄,可匿名存取)外,所有 endpoints 均需要以 Bearer token 方式傳入 API 金鑰:

text
Authorization: Bearer sk_live_…

請在 Creator 的「API 金鑰」頁面建立及管理金鑰。所有金鑰一律為 sk_live_…;免費方案的金鑰另受每日生成上限約束,任何方案的金鑰均可設定每月 credits 上限(留空 = 無上限)。

Authorization
Authorization: Bearer $CANTOGEN_API_KEY

Speech

文字轉語音生成
POST/v1/audio/speech

生成語音(同步,短文字)

同步生成語音(快線):回傳 200 OK 及音訊 bytes。

同步限制:文字上限 300 個計費 credits;僅接受 voice(預設)或design 模式 — clone 會回傳 400 clone_not_supported_sync,srt: true 會回傳 400 srt_not_supported_sync(兩者均請改用非同步POST /v1/audio/jobs)。

計費:本 endpoint 為實時語音,按 ceil(credits × 1.3) 實扣(X-Credits-Charged已含倍數);實時 WebSocket(逐句串流)按 ceil(字符 × 1.5) 實扣。

快線語義(先到先得):生成池完全空閒時先會接單——接單後同一個請求內等生成完成(一般 ~5–15 秒)並直接回傳 bytes;生成池忙(前面有任務)會如實回傳 `503 {"error":"pool_cold"}`(不扣費),請改用非同步。等待超過 ~45 秒會 cooperative cancel+退款,回傳 503 sync_timeout(帶 Retry-After;X-Request-Id 留作對帳)— 保證交付請改用非同步。

請選擇恰好一種聲音模式 — 三者互斥:

  • voice — GET /v1/voices 的預設聲線 slug(建議;所有預設聲線均已廣東話優化/香港聲線)。需要 tts:generate scope。
  • design — 以 gender + age 描述一個合成聲線。tts:generate scope 或細粒度 tts:design scope 均可接受(二者其一即可,因此現有 tts:generate 金鑰無需任何更改)。
  • clone — 以 base64 reference_audio 樣本複製聲線(需要tts:clone key scope)。只需 reference_audio;舊版 prompt_text欄位已退役(送出會被忽略)。

同時傳送多於一個 voice / design / clone 會回傳 400 voice_mode_conflict。

請求 body · SpeechRequest (必填)

欄位說明
modelstring · enum(1) · 否

The TTS model. Currently only cantogen-tts exists; other values return 400 invalid_model.

enum: cantogen-tts

default: cantogen-tts

voicestring · 否

Preset voice slug from GET /v1/voices. Required unless design or clone is used.

textstring · 是

The text to speak (1–500 characters on the async endpoint; the sync POST /v1/audio/speech caps at 300 billable credits). Cantonese text works best — 廣東話字正腔圓. Supports inline tone tags: insert [label] in the script, e.g. [笑聲]你好[唷!] — closed set of 15 tags (see the API guide, Inline tone tags). Unknown bracket tokens pass through untouched.

pitchinteger · 否

DEPRECATED (2026-09-20) — no effect under raw audio delivery. Still accepted with unchanged range validation (−12…+12 semitones, default 0), but the value is ignored.

default: 0

volumenumber · 否

DEPRECATED (2026-09-20) — no effect under raw audio delivery. Still accepted with unchanged range validation (0–10, default 1), but the value is ignored.

default: 1

emotionstring · enum(11) · 否

Speaking emotion — one of the 11 prod canonical values (happy / angry / sad / surprise / fear / disgust / neutral / confused / anxious / affection / whisper). Legacy MiniMax values (fearful / disgusted / surprised / excited / gentle) are accepted and normalized. The Creator UI's Chinese emotion presets (雀躍 / 冷靜 …) are a separate gallery layer and are not API enum values.

enum: happy · angry · sad · surprise · fear · disgust · neutral · confused · anxious · affection · whisper

stylestring · 否

Delivery style. Canonical values are English slugs — rhythm: steady / composed / rapid / slow / drawl / brisk / dynamic / staccato; timbre: mellow / cute / sharp / lazy / breathy / hoarse / deep / crisp / feeble / trembling; scene: corporate / promo / wedding / guide / expo / ad / tutorial / news / travel / audiobook / latenight / product / fairytale / podcast / storytelling / sports; character: animation-hero / stylish-uncle / astronaut / support-agent / boss / grandma / lottery-host / news-anchor / sage / late-dj / teacher / storyteller / market-commentator / sports-commentator / girl-next-door / smart-kid. The original Chinese preset values (明快 / 圓潤 / 講古 …) are still accepted as aliases — both are normalized internally to the same canonical value before reaching the engine. Any other free text also passes through. Merged into the engine style slot (order: style → emotion → instruction).

instructionstring · 否

Free-text delivery direction in Cantonese, Chinese or English — e.g. 「用興奮嘅語氣講,好似慶祝生日咁」. Applied after style and emotion, so it has the final say on how the line is delivered. Values over 500 characters return 400 invalid_instruction.

response_formatstring · enum(2) · 否

Audio container format. Other formats return 400 unsupported_format.

enum: mp3 · wav

default: mp3

srtboolean · 否

Also generate SRT subtitles. When true, a completed job's srt field carries the subtitle content (billed at a higher credit rate).

default: false

seedinteger · 否

Reserved. Accepted and validated as an integer but not yet used for reproducibility.

sample_rateinteger · 否

Reserved. Accepted and validated as an integer but not yet applied.

designDesignObject · 否
cloneCloneObject · 否
cURL
curl -X POST "https://api.canto-gen.com/v1/audio/speech" \
  -H "Authorization: Bearer $CANTOGEN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"cantogen-tts","voice":"sum","text":"你好,歡迎使用港嘢!","response_format":"mp3"}'

範例

預設聲線(最簡單的用法)
{
  "model": "cantogen-tts",
  "voice": "sum",
  "text": "你好,歡迎使用港嘢!",
  "response_format": "mp3"
}
以 gender + age 設計聲線(tts:generate 或 tts:design scope)
{
  "model": "cantogen-tts",
  "design": {
    "gender": "female",
    "age": "young"
  },
  "text": "今日天氣幾好,一齊去行山啦。",
  "style": "brisk",
  "emotion": "happy"
}
自由文字演繹指示
{
  "model": "cantogen-tts",
  "voice": "sum",
  "text": "生日快樂!祝你心想事成!",
  "instruction": "用興奮嘅語氣講,好似慶祝生日咁"
}

回應

200

語音生成成功。回應 body 為原始音訊 bytes。

400

請求無效。原因請參考 error code。

invalid_model
{
  "error": "invalid_model",
  "message": "model must be \"cantogen-tts\"."
}
voice_mode_conflict
{
  "error": "voice_mode_conflict",
  "message": "voice is mutually exclusive with design and clone."
}
text_required
{
  "error": "text_required",
  "message": "text is required."
}
text_too_long
{
  "error": "text_too_long",
  "message": "text exceeds 500 characters."
}
unsupported_format
{
  "error": "unsupported_format",
  "message": "response_format supports mp3 and wav (MVP)."
}
invalid_emotion
{
  "error": "invalid_emotion",
  "message": "emotion must be one of: happy/angry/sad/surprise/fear/disgust/neutral/confused/anxious/affection/whisper."
}
invalid_instruction
{
  "error": "invalid_instruction",
  "message": "instruction exceeds 500 characters."
}
reference_audio_required
{
  "error": "reference_audio_required",
  "message": "clone.reference_audio is required."
}
design_gender_and_age_required
{
  "error": "design_gender_and_age_required",
  "message": "design.gender and design.age are required."
}
invalid_srt
{
  "error": "invalid_srt",
  "message": "srt must be a boolean."
}
clone_not_supported_sync
{
  "error": "clone_not_supported_sync",
  "hint": "use POST /v1/audio/jobs (async)"
}
srt_not_supported_sync
{
  "error": "srt_not_supported_sync",
  "hint": "use POST /v1/audio/jobs (async)"
}
401

API 金鑰缺失、格式錯誤、無效或已過期。

application/json
{
  "error": "invalid_or_expired_token"
}
403

禁止存取 — 金鑰缺少所需 scope(clone 請求需要 tts:clone;design 請求接受 tts:generate 或 tts:design),或已達金鑰的每月 credits 上限。

insufficient_scope
{
  "error": "insufficient_scope",
  "scope": "tts:clone"
}
monthly_cap_reached
{
  "error": "monthly_cap_reached",
  "used": 100000
}
429

觸發速率限制(每用戶每分鐘;同一帳戶嘅所有金鑰加埋計,開多把金鑰唔會突破總額)。請等待 Retry-After 秒後重試。

application/json
{
  "error": "rate_limit_exceeded",
  "retry_after": 42
}
503

同步快線不可用,按 error code 分:pool_cold=隊列忙,請求未被接受(不扣費),亦不會靜默轉用非同步;sync_generation_failed=等待期間任務失敗或取消(已自動退款);sync_timeout=同步等待超過約 45 秒 — 任務已 cooperative cancel 並於數秒內退款(回應帶 Retry-After,可稍後重試或改用非同步;X-Request-Id 留作對帳);jobs_unavailable=入隊基建暫時故障;service_unavailable=語音引擎暫時離線(維護或後端未就緒),請求未受理、不扣費(回應帶 Retry-After,預設 60 秒);rate_limit_unavailable=速率限制基建暫時不可用,為免放行未受管流量而拒絕,同樣未受理、不扣費(Retry-After 預設 5 秒)。長文字/要保證交付請改以 POST /v1/audio/jobs 提交。

application/json
{
  "error": "pool_cold",
  "hint": "use POST /v1/audio/jobs (async)"
}

Jobs

語音任務狀態
GET/v1/audio/jobs

列出你的生成紀錄

列出你自己嘅語音生成紀錄(最新先)。純 API 客戶唔使登入 web UI 就可以查返自己提交過乜、做到咗幾耐。

  • Owner-scoped:只會回你自己金鑰嘅紀錄(唔會洩露其他帳戶)。
  • 分頁:limit(1–100,預設 20)+ before(游標 = 上一頁最後一條紀錄嘅 id)。next_before 係下一頁嘅游標;null 表示冇下一頁。
  • `status` 過濾(可選):queued/processing/cancelling/done/error/cancelled。
  • `text_preview`:你生成嘅文字嘅有界預覽(最多 120 字)—— 想攞全文用GET /v1/audio/jobs/{id},或者自己保留原文。
  • `duration_ms`:音訊時長(毫秒;未生成完成 = null)。

⚠️ status 用任務實際狀態值(done/error/…);GET /v1/audio/jobs/{id}嘅輪詢面用公開狀態名(completed/failed/…)—— 兩套詞彙唔同,睇清自己讀緊邊個 endpoint。

路徑/查詢參數

欄位說明
limitinteger · 否

每頁行數(1–100,預設 20)。

default: 20

beforestring · uuid · 否

游標 — 上一頁最後一條紀錄嘅 id;之後(更舊)嘅紀錄由呢度續拉。

statusstring · enum(6) · 否

只回呢個狀態嘅紀錄(可選;任務實際狀態值)。

enum: queued · processing · cancelling · done · error · cancelled

cURL
curl "https://api.canto-gen.com/v1/audio/jobs" \
  -H "Authorization: Bearer $CANTOGEN_API_KEY"

回應

200

你嘅生成紀錄(最新先)。

application/json
{
  "jobs": [
    {
      "id": "b7e6f2a1-4c3d-4e5f-8a9b-0c1d2e3f4a5b",
      "status": "done",
      "created_at": "2026-10-29T09:12:00.000Z",
      "voice_slug": "sum",
      "duration_ms": 4200,
      "text_preview": "你好,歡迎使用港嘢!"
    }
  ],
  "next_before": null
}
400

參數無效 — invalid_limit(limit 唔係 1–100 嘅整數)/invalid_cursor(before 唔係你嘅 job id)/invalid_status(status 唔喺值集內)。

invalid_limit
{
  "error": "invalid_limit"
}
invalid_cursor
{
  "error": "invalid_cursor"
}
invalid_status
{
  "error": "invalid_status"
}
401

API 金鑰缺失、格式錯誤、無效或已過期。

application/json
{
  "error": "invalid_or_expired_token"
}
403

禁止存取 — 金鑰缺少所需 scope(clone 請求需要 tts:clone;design 請求接受 tts:generate 或 tts:design),或已達金鑰的每月 credits 上限。

application/json
{
  "error": "insufficient_scope",
  "scope": "tts:generate | tts:design"
}
503

後端暫時性問題(隊列/計費基礎設施)。請以退避方式重試。

application/json
{
  "error": "jobs_unavailable"
}
POST/v1/audio/jobs

提交語音任務(非同步)

提交語音任務作非同步生成。回傳 202 Accepted 連同job_id 與 poll_url;輪詢 GET /v1/audio/jobs/{id} 直至任務完成。

批次:傳送 {"items": [ …最多 25 個請求 body… ]} 以批次提交 —驗證為全有或全無(任何一項無效即以 400 invalid_items 拒絕整個請求);入隊後的失敗則逐項回報,202 body 會列出每項結果({index, job_id, …} 或 {index, status: "failed", error})。

請選擇恰好一種聲音模式 — 三者互斥:

  • voice — GET /v1/voices 的預設聲線 slug(建議;所有預設聲線均已廣東話優化/香港聲線)。需要 tts:generate scope。
  • design — 以 gender + age 描述一個合成聲線。tts:generate scope 或細粒度 tts:design scope 均可接受(二者其一即可,因此現有 tts:generate 金鑰無需任何更改)。
  • clone — 以 base64 reference_audio 樣本複製聲線(需要tts:clone key scope)。只需 reference_audio;舊版 prompt_text欄位已退役(送出會被忽略)。

同時傳送多於一個 voice / design / clone 會回傳 400 voice_mode_conflict。

路徑/查詢參數

欄位說明
Idempotency-Keystring · 否

重試安全鍵(alias:x-idempotency-key)。同一個值重播會回 409 duplicate_request(唔會再提交、唔會再扣費);任何字串都可以(UUID 原樣做 job_id,其他字串以 UUIDv5 確定性映射)。唔帶就每次當新提交。

請求 body · SpeechRequest (必填)

欄位說明
modelstring · enum(1) · 否

The TTS model. Currently only cantogen-tts exists; other values return 400 invalid_model.

enum: cantogen-tts

default: cantogen-tts

voicestring · 否

Preset voice slug from GET /v1/voices. Required unless design or clone is used.

textstring · 是

The text to speak (1–500 characters on the async endpoint; the sync POST /v1/audio/speech caps at 300 billable credits). Cantonese text works best — 廣東話字正腔圓. Supports inline tone tags: insert [label] in the script, e.g. [笑聲]你好[唷!] — closed set of 15 tags (see the API guide, Inline tone tags). Unknown bracket tokens pass through untouched.

pitchinteger · 否

DEPRECATED (2026-09-20) — no effect under raw audio delivery. Still accepted with unchanged range validation (−12…+12 semitones, default 0), but the value is ignored.

default: 0

volumenumber · 否

DEPRECATED (2026-09-20) — no effect under raw audio delivery. Still accepted with unchanged range validation (0–10, default 1), but the value is ignored.

default: 1

emotionstring · enum(11) · 否

Speaking emotion — one of the 11 prod canonical values (happy / angry / sad / surprise / fear / disgust / neutral / confused / anxious / affection / whisper). Legacy MiniMax values (fearful / disgusted / surprised / excited / gentle) are accepted and normalized. The Creator UI's Chinese emotion presets (雀躍 / 冷靜 …) are a separate gallery layer and are not API enum values.

enum: happy · angry · sad · surprise · fear · disgust · neutral · confused · anxious · affection · whisper

stylestring · 否

Delivery style. Canonical values are English slugs — rhythm: steady / composed / rapid / slow / drawl / brisk / dynamic / staccato; timbre: mellow / cute / sharp / lazy / breathy / hoarse / deep / crisp / feeble / trembling; scene: corporate / promo / wedding / guide / expo / ad / tutorial / news / travel / audiobook / latenight / product / fairytale / podcast / storytelling / sports; character: animation-hero / stylish-uncle / astronaut / support-agent / boss / grandma / lottery-host / news-anchor / sage / late-dj / teacher / storyteller / market-commentator / sports-commentator / girl-next-door / smart-kid. The original Chinese preset values (明快 / 圓潤 / 講古 …) are still accepted as aliases — both are normalized internally to the same canonical value before reaching the engine. Any other free text also passes through. Merged into the engine style slot (order: style → emotion → instruction).

instructionstring · 否

Free-text delivery direction in Cantonese, Chinese or English — e.g. 「用興奮嘅語氣講,好似慶祝生日咁」. Applied after style and emotion, so it has the final say on how the line is delivered. Values over 500 characters return 400 invalid_instruction.

response_formatstring · enum(2) · 否

Audio container format. Other formats return 400 unsupported_format.

enum: mp3 · wav

default: mp3

srtboolean · 否

Also generate SRT subtitles. When true, a completed job's srt field carries the subtitle content (billed at a higher credit rate).

default: false

seedinteger · 否

Reserved. Accepted and validated as an integer but not yet used for reproducibility.

sample_rateinteger · 否

Reserved. Accepted and validated as an integer but not yet applied.

designDesignObject · 否
cloneCloneObject · 否
cURL
curl -X POST "https://api.canto-gen.com/v1/audio/jobs" \
  -H "Authorization: Bearer $CANTOGEN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"cantogen-tts","voice":"sum","text":"你好,歡迎使用港嘢!","response_format":"mp3"}'

範例

預設聲線(最簡單的用法)
{
  "model": "cantogen-tts",
  "voice": "sum",
  "text": "你好,歡迎使用港嘢!",
  "response_format": "mp3"
}
複製聲線(需要 tts:clone scope)
{
  "model": "cantogen-tts",
  "clone": {
    "reference_audio": "data:audio/wav;base64,UklGRiQAAABXQVZFZm10IBAAAAABAAEAQB8AAEAfAAABAAgAZGF0YQAAAAA="
  },
  "text": "用我把聲講呢句嘢。"
}
批次提交(最多 25 項)
{
  "items": [
    {
      "model": "cantogen-tts",
      "voice": "sum",
      "text": "第一句。"
    },
    {
      "model": "cantogen-tts",
      "design": {
        "gender": "male",
        "age": "adult"
      },
      "text": "第二句。"
    }
  ]
}

回應

202

任務已受理。單一請求 → {job_id, status, poll_url, srt_requested};批次 → {jobs: [{index, job_id, status, poll_url, srt_requested} | {index, status: "failed", error}]}。

application/json
{
  "job_id": "b7e6f2a1-4c3d-4e5f-8a9b-0c1d2e3f4a5b",
  "status": "queued",
  "poll_url": "/v1/audio/jobs/b7e6f2a1-4c3d-4e5f-8a9b-0c1d2e3f4a5b",
  "srt_requested": false
}
400

請求無效 — 轉換層錯誤碼,或 too_many_items(>25)/invalid_items(批次全有或全無驗證)。

too_many_items
{
  "error": "too_many_items",
  "max": 25,
  "got": 26
}
invalid_items
{
  "error": "invalid_items",
  "items": [
    {
      "index": 1,
      "error": "text_required"
    }
  ]
}
voice_mode_conflict
{
  "error": "voice_mode_conflict",
  "message": "voice is mutually exclusive with design and clone."
}
text_too_long
{
  "error": "text_too_long",
  "message": "text exceeds 500 characters."
}
401

API 金鑰缺失、格式錯誤、無效或已過期。

application/json
{
  "error": "invalid_or_expired_token"
}
402

帳戶的 credits 池已用盡。

application/json
{
  "error": "character_limit_reached",
  "remaining": 0
}
403

禁止存取 — 金鑰缺少所需 scope(clone 請求需要 tts:clone;design 請求接受 tts:generate 或 tts:design),或已達金鑰的每月 credits 上限。

insufficient_scope
{
  "error": "insufficient_scope",
  "scope": "tts:clone"
}
monthly_cap_reached
{
  "error": "monthly_cap_reached",
  "used": 100000
}
429

觸發速率限制(每用戶每分鐘;同一帳戶嘅所有金鑰加埋計,開多把金鑰唔會突破總額)。請等待 Retry-After 秒後重試。

application/json
{
  "error": "rate_limit_exceeded",
  "retry_after": 42
}
503

後端暫時性問題(隊列/計費基礎設施)。請以退避方式重試。

application/json
{
  "error": "jobs_unavailable"
}
GET/v1/audio/jobs/{id}

查詢任務狀態

查詢以 POST /v1/audio/jobs 建立的語音任務狀態。

輪詢直至 status 變為 completed 或 failed。任務 completed 時,audio_url 為音訊的預簽名下載 URL。若提交時要求字幕(srt_requested: true),任務完成後 srt 欄位即為 SRT 字幕內容。

路徑/查詢參數

欄位說明
idstring · 是

由 POST /v1/audio/jobs 回傳的 job_id。

cURL
curl "https://api.canto-gen.com/v1/audio/jobs/b7e6f2a1-4c3d-4e5f-8a9b-0c1d2e3f4a5b" \
  -H "Authorization: Bearer $CANTOGEN_API_KEY"

回應

200

任務目前狀態。字幕就緒後會附上 srt。

application/json
{
  "job_id": "b7e6f2a1-4c3d-4e5f-8a9b-0c1d2e3f4a5b",
  "status": "completed",
  "poll_url": "/v1/audio/jobs/b7e6f2a1-4c3d-4e5f-8a9b-0c1d2e3f4a5b",
  "srt_requested": true,
  "srt": "1\n00:00:00,000 --> 00:00:02,400\n你好,歡迎使用港嘢!"
}
400

job id 格式錯誤。

application/json
{
  "error": "invalid_job_id"
}
401

API 金鑰缺失、格式錯誤、無效或已過期。

application/json
{
  "error": "invalid_or_expired_token"
}
404

無此 id 的任務(或該任務屬於另一把金鑰)。

application/json
{
  "error": "job_not_found"
}
DELETE/v1/audio/jobs/{id}

取消任務/刪除生成紀錄

以 DELETE 處理一個語音任務(POST /v1/audio/jobs 建立)。雙重語義,按任務狀態分流:

① 任務仲未完(`queued`/`processing`/`cancelling`)→ 取消(沿用 spec §4.4):

  • queued → 200:任務即時取消並全額退款(refunded 為實際退回的 credits 數)。
  • processing → 202:取消已受理,任務收線中 — 之後輪詢會見到 cancelling,隨後收斂為 cancelled。

② 任務已終態(`completed`/`failed`/`cancelled`)→ 刪除生成紀錄:

  • 200 { id, object: "job", deleted: true }:工作紀錄(連你生成嘅文字)、音檔同字幕副檔(.srt/.vtt/.json)即時刪走,唔設復原,物理清除喺30 日內完成(實際上即刻清除)。
  • 刪除次序:先刪資料庫紀錄、後刪音檔。

只可以處理自己金鑰嘅任務;搵唔到或者唔屬於你,一律回 404 job_not_found(唔會洩露 id 存在與否)。

路徑/查詢參數

欄位說明
idstring · 是

由 POST /v1/audio/jobs 回傳的 job_id。

cURL
curl -X DELETE "https://api.canto-gen.com/v1/audio/jobs/b7e6f2a1-4c3d-4e5f-8a9b-0c1d2e3f4a5b" \
  -H "Authorization: Bearer $CANTOGEN_API_KEY"

回應

200

任務未開始 — 已即時取消並全額退款。

cancelled
{
  "ok": true,
  "status": "cancelled",
  "refunded": 1234
}
deleted
{
  "id": "b7e6f2a1-4c3d-4e5f-8a9b-0c1d2e3f4a5b",
  "object": "job",
  "deleted": true
}
202

取消已受理 — 生成中的任務收線中;輪詢會見到 cancelling,隨後收斂為 cancelled。

application/json
{
  "ok": true,
  "status": "cancelling"
}
400

job id 格式錯誤。

application/json
{
  "error": "invalid_job_id"
}
401

API 金鑰缺失、格式錯誤、無效或已過期。

application/json
{
  "error": "invalid_or_expired_token"
}
404

無此 id 的任務(或該任務屬於另一把金鑰)。

application/json
{
  "error": "job_not_found"
}

Voices

聲線目錄
DELETE/v1/voices/{id}

刪除你的聲線

刪除一把你自己建立嘅聲線(POST /api/voice-gallery/upload 或設計聲線)。{id} 可以係聲線嘅 slug 或者 uuid id(兩個都係用戶面拎得到嘅識別碼)。

  • 即時失效:聲線即刻喺所有清單消失、唔可以再用於生成。
  • 永久清除:參考音檔 + 準備好嘅參考音頻 cache 副本即時刪走,唔設復原,物理清除喺 30 日內完成(實際上即刻清除)。
  • 官方預設聲線(GET /v1/voices 嗰啲)永遠唔可以刪 — 同你嘅聲線一律回 404 not_found(唔會洩露佢存在與否)。
  • 只可以刪自己金鑰嘅聲線;搵唔到或者唔屬於你,一律回 404 not_found。
  • 有生成工作仲引用緊呢把聲線 → 唔會刪,回 409 voice_busy(免得整爛條未完嘅工作);等嗰個工作完成之後再刪。
  • 需要 voices:manage scope(金鑰缺 scope → 403 insufficient_scope)。
  • 刪除次序:先刪資料庫紀錄、後刪音檔。

路徑/查詢參數

欄位說明
idstring · 是

聲線嘅 slug(例如 u-1a2b3c4d-9f8e7d6c)或者 uuid id。

cURL
curl -X DELETE "https://api.canto-gen.com/v1/voices/u-1a2b3c4d-9f8e7d6c" \
  -H "Authorization: Bearer $CANTOGEN_API_KEY"

回應

200

已刪除 — 聲線即時失效(唔再出現喺任何清單、唔可以再用於生成),檔案已經清走。

application/json
{
  "id": "b7e6f2a1-4c3d-4e5f-8a9b-0c1d2e3f4a5b",
  "object": "voice",
  "slug": "u-1a2b3c4d-9f8e7d6c",
  "deleted": true
}
400

無效 id(空或者太長)。

application/json
{
  "error": "invalid_id"
}
401

API 金鑰缺失、格式錯誤、無效或已過期。

application/json
{
  "error": "invalid_or_expired_token"
}
403

金鑰缺少 voices:manage scope。

application/json
{
  "error": "insufficient_scope"
}
404

搵唔到(或者唔屬於呢個 key,或者係官方預設聲線 —— 一律唔會洩露存在與否)。

application/json
{
  "error": "not_found"
}
409

有生成工作仲引用緊呢把聲線 → 唔會刪(免得整爛條未完嘅工作)。等佢完成之後再刪。

application/json
{
  "error": "voice_busy"
}
503

暫時刪除失敗,稍後重試。

application/json
{
  "error": "deletion_failed"
}
GET/v1/voices

列出聲線

列出官方聲線目錄。所有預設聲線均已廣東話優化(Cantonese-optimized)— 以各聲線的 slug 作為POST /v1/audio/speech(同步)或 POST /v1/audio/jobs(非同步)的voice 參數。

preview_url 無需額外授權即可串流短樣本。

cURL
curl "https://api.canto-gen.com/v1/voices" \
  -H "Authorization: Bearer $CANTOGEN_API_KEY"

回應

200

官方聲線目錄。

application/json
{
  "voices": [
    {
      "slug": "sum",
      "name": "心妍",
      "gender": "female",
      "age": "adult",
      "styles": [],
      "preview_url": "https://canto-gen.com/api/voice-clip?slug=sum"
    }
  ]
}
401

API 金鑰缺失、格式錯誤、無效或已過期。

application/json
{
  "error": "invalid_or_expired_token"
}
503

聲線目錄暫時無法存取。

application/json
{
  "error": "voice_gallery_unavailable"
}

Transcription

文件轉寫
POST/v1/asr/transcribe

文件轉寫(音檔轉文字)

上載音檔,同一請求內同步回傳轉寫文字。Canonical path:/v1/asr/transcribe —以 multipart/form-data 傳送。

欄位:file(必填,音檔)、model(必填)、language(選填,ISO-639-1)、response_format(json 預設/text)。srt/verbose_json 需要段級時間標記,暫不支援 — 送出回 400 unsupported_response_format。現階段轉寫以廣東話為本。

計費:按音頻時長計費,單位為 credits(1 credit = HK$0.001)— 文件轉寫 HK$0.80/小時,按秒計費、不進位。次序:① 方案每月 credits(免費 5,000/月)→ ② 預付錢包 credits(可透支至 −HK$5)→ ③ 已開啟自動增值者不足時自動增值後重試一次;仍不足回 402 insufficient_balance(未處理、零扣費)。請求受理前先按偵測到的時長預扣,完成後按實際時長結算;失敗、超時或服務不可用一律全額退回(只扣成功)。費率與餘額可用 GET /v1/balance 查詢。

無可辨識語音(靜音/純音樂/背景噪音):引擎照樣完成 — 回 200 連空 text(""),照實際音頻時長計費(業界主流約定 — 呢個係有效結果唔係錯誤;response_format=text 則回空字串)。

授權:任何有效 API key 就用得(ASR 面 — 包括 jobs/取回/realtime token —唔設 asr: 專屬 scope,單 key 模式)。

上限與同步窗(C3,2026-10-20):同步 route 單檔實際上限 4.5 MB(平台 request body 上限,超出回平台層 413 —建議先壓縮:16kHz mono Opus 16k,單檔 4.5MB 約載 33–40 分鐘);同步交付上限 8 分鐘(480 秒)音頻 — probe 到超過 → 400 audio_too_long(帶 duration_seconds+async_endpoint,處理前拒、零扣費);單請求音頻政策上限 4 小時(超出回 413 payload_too_large)。

冇每日音訊時長上限(2026-10-30 起對所有 plan 一視同仁):用量由 credits 配額+預付餘額 bound;免費方案另有每日 50 個生成提交上限(TTS 同 ASR 各自 50,分開計;超出回 429 sandbox_daily_limit)。(每次請求先 hold 實測時長、完成後按實際時長結算),唔會因為用得多而被日上限擋。

長音檔正路:POST /v1/asr/jobs(非同步,audio_url/storage_path 上限 500MB/4 小時)—提交即 202 queued,GET /v1/asr/transcriptions/{id} poll 文字。同一計費語義(方案月額先扣、預付餘額墊底)。

請求 body · TranscriptionRequest (必填)

欄位說明
filestring · binary · 是

The audio file to transcribe (wav, mp3, m4a/mp4, webm, ogg, flac). Max 4.5 MB effective (platform request-body cap); for longer audio use POST /v1/asr/jobs with audio_url or storage_path (up to 500 MB).

modelstring · 是

Transcription model name. Required by the API shape; any non-empty value is accepted — the current release offers a single Cantonese-optimized transcription model (cantogen-asr).

languagestring · 否

Optional ISO-639-1 language hint. Accepted as-is; transcription is currently Cantonese-optimized.

response_formatstring · enum(2) · 否

json (default) returns the structured object; text returns plain text. Segment-timestamp formats (srt, verbose_json) are not yet supported and return 400 unsupported_response_format.

enum: json · text

default: json

vocabularyarray · 否

Optional keyword-biasing list (up to 50 terms, each ≤30 chars after trim). Grant-gated: only accounts with the asr_vocabulary entitlement have it applied — without the grant the field is silently ignored and the request is processed exactly as if it were absent. On multipart requests send a JSON-encoded string array (e.g. '["term1","term2"]'). Stored default (API key requests): when the parameter is omitted, the vocabulary stored for your account (PUT /v1/asr/vocabulary) is applied automatically; when the parameter is present — including an empty array — the request value wins (an empty array means no biasing, it does not fall back to the stored list).

cURL
curl -X POST "https://api.canto-gen.com/v1/asr/transcribe" \
  -H "Authorization: Bearer $CANTOGEN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"file":"(binary audio file)","model":"cantogen-asr","response_format":"json"}'

範例

轉寫一個音檔
{
  "file": "(binary audio file)",
  "model": "cantogen-asr",
  "response_format": "json"
}

回應

200

轉寫成功。

application/json
{
  "id": "b7e6f2a1-4c3d-4e5f-8a9b-0c1d2e3f4a5b",
  "object": "transcription",
  "text": "今日天氣幾好,一齊去行山啦。",
  "duration_seconds": 1830,
  "charged_hkd": 0.4067
}
400

請求無效 — invalid_request(multipart 缺 file/model、音檔為空或音檔格式不支援)、unsupported_response_format(response_format 暫只支援 json/text)或 audio_too_long(音頻超過同步交付上限 8 分鐘/480 秒 — 回應帶 duration_seconds+async_endpoint: /v1/asr/jobs,處理前拒、零扣費;長音檔改用 POST /v1/asr/jobs)。

invalid_request
{
  "error": "invalid_request",
  "message": "file field is required."
}
unsupported_response_format
{
  "error": "unsupported_response_format",
  "message": "Supported formats: json, text. Segment-timestamp formats are not yet supported."
}
401

API 金鑰缺失、格式錯誤、無效或已過期。

application/json
{
  "error": "invalid_or_expired_token"
}
402

請求的 credits 配額與預付餘額合計不足以預扣本次轉寫費用(未開始處理、零扣費)。請前往 /account/billing 增值後重試。

application/json
{
  "error": "insufficient_balance",
  "message": "Top up your prepaid balance and retry."
}
413

音檔超出平台 request-body 上限(4.5 MB)— 先壓縮(16kHz mono Opus 16k,約 33–40 分鐘/4.5MB)或改用 POST /v1/asr/jobs(audio_url/storage_path 上限 500 MB/4 小時,自動非同步)。

application/json
{
  "error": "payload_too_large",
  "message": "Audio exceeds the 4.5 MB request-body cap — compress (Opus 16k) or use POST /v1/asr/jobs."
}
503

轉寫服務暫時不可用(時長偵測失敗、計費系統或轉寫管線暫時故障;同步窗內引擎排隊/退化亦歸此類 — 屬瞬態,帶 Retry-After 可稍後重試)。已預扣金額全額退回 — 只扣成功。

engine_unavailable
{
  "error": "engine_unavailable"
}
billing_unavailable
{
  "error": "engine_unavailable",
  "message": "billing_unavailable"
}
POST/v1/asr/jobs

非同步提交轉寫任務(upfront async)

提交即回 202 queued,唔使等同步窗。三種進場:multipart file(≤4.5MB 平台上限)、JSON audio_url(server 側下載 — 繞過 4.5MB;https only、上限 500MB/4 小時、拒內網位址)、JSON storage_path(只限 browser session — Creator 大檔 lane;API key caller 送 → 400)。之後 poll GET /v1/asr/transcriptions/{id}:queued → processing → completed(text/duration_seconds 在場)/failed(error 在場)。冇可辨識語音(靜音/純音樂)照樣 completed + 空 text("")+照計費 — 跟同步面同一約定,有效結果唔係錯誤。第一次見 completed 按實際時長結算錢包 hold(冪等)。費用同 /v1/asr/transcribe:HK$0.80/小時,按秒計費、只扣成功。

請求 body · TranscriptionRequest (必填)

欄位說明
filestring · binary · 是

The audio file to transcribe (wav, mp3, m4a/mp4, webm, ogg, flac). Max 4.5 MB effective (platform request-body cap); for longer audio use POST /v1/asr/jobs with audio_url or storage_path (up to 500 MB).

modelstring · 是

Transcription model name. Required by the API shape; any non-empty value is accepted — the current release offers a single Cantonese-optimized transcription model (cantogen-asr).

languagestring · 否

Optional ISO-639-1 language hint. Accepted as-is; transcription is currently Cantonese-optimized.

response_formatstring · enum(2) · 否

json (default) returns the structured object; text returns plain text. Segment-timestamp formats (srt, verbose_json) are not yet supported and return 400 unsupported_response_format.

enum: json · text

default: json

vocabularyarray · 否

Optional keyword-biasing list (up to 50 terms, each ≤30 chars after trim). Grant-gated: only accounts with the asr_vocabulary entitlement have it applied — without the grant the field is silently ignored and the request is processed exactly as if it were absent. On multipart requests send a JSON-encoded string array (e.g. '["term1","term2"]'). Stored default (API key requests): when the parameter is omitted, the vocabulary stored for your account (PUT /v1/asr/vocabulary) is applied automatically; when the parameter is present — including an empty array — the request value wins (an empty array means no biasing, it does not fall back to the stored list).

cURL
curl -X POST "https://api.canto-gen.com/v1/asr/jobs" \
  -H "Authorization: Bearer $CANTOGEN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"file":"(binary audio file)","model":"cantogen-asr","response_format":"json"}'

範例

轉寫一個音檔
{
  "file": "(binary audio file)",
  "model": "cantogen-asr",
  "response_format": "json"
}
audio_url 進場
{
  "audio_url": "https://example.com/long-audio.ogg",
  "model": "cantogen-asr"
}
storage_path 進場(只限 browser session)
{
  "storage_path": "asr-uploads/free/user-uuid/018f3c2a-7b12-4c5d-9e8f-a1b2c3d4e5f6.wav",
  "model": "cantogen-asr"
}

回應

202

已入隊 — poll GET /v1/asr/transcriptions/{id} 收文字。

application/json
{
  "id": "1cabbd7b-741d-46a1-b83e-ed259247a57c",
  "object": "transcription",
  "status": "queued",
  "retrieval": "/v1/asr/transcriptions/1cabbd7b-741d-46a1-b83e-ed259247a57c"
}
400

無效參數/音頻 URL 被拒(https only、內網位址、500MB cap);storage_path 非法(爛形狀、同時帶 audio_url、API key caller 送 storage_path)。

invalid_request
{
  "error": "invalid_request"
}
audio_url_must_be_https
{
  "error": "audio_url_must_be_https"
}
audio_url_host_not_allowed
{
  "error": "audio_url_host_not_allowed"
}
audio_url_too_large
{
  "error": "audio_url_too_large"
}
storage_path_session_only
{
  "error": "storage_path_session_only"
}
401

API 金鑰缺失、格式錯誤、無效或已過期。

application/json
{
  "error": "invalid_or_expired_token"
}
402

預付餘額不足(未入隊、零扣費)。

application/json
{
  "error": "insufficient_balance"
}
403

storage_path 唔屬於認證用戶(防跨用戶)。

application/json
{
  "error": "storage_path_forbidden"
}
404

storage_path 指住嘅物件唔存在(未上載完/已過 TTL — free 24 小時/paid 7 日)。

application/json
{
  "error": "storage_path_not_found"
}
413

音頻超出 4 小時上限。

application/json
{
  "error": "payload_too_large"
}
503

提交基建暫時故障 — 已退款,Retry-After 後重試。

application/json
{
  "error": "asr_queue_submit_failed"
}
GET/v1/asr/transcriptions/{id}

取回長音檔轉寫結果(非同步 202 嘅 poll 面)

非同步轉寫取回面 — poll 呢條收文字:queued → processing → completed(text/duration_seconds 在場)/failed(error 在場)。冇可辨識語音(靜音/純音樂)照樣 completed + 空 text("")+照計費(跟同步面約定 — 有效結果唔係錯誤)。第一次見 completed 按實際時長結算錢包 hold(冪等,重複 poll 唔會重收)。只可以取回自己 key 嘅結果。提交面:POST /v1/asr/jobs(202 queued)。

路徑/查詢參數

欄位說明
idstring · uuid · 是

202 回應帶返嚟嘅 id。

cURL
curl "https://api.canto-gen.com/v1/asr/transcriptions/{id}" \
  -H "Authorization: Bearer $CANTOGEN_API_KEY"

回應

200

目前狀態(completed 時 text/duration_seconds 在場)。提交時帶咗 vocabulary(grant-gated)嘅 job — text 交出前 server 會剝朗誦殘渣(recitation strip);無詞表 job 原文照交。

application/json
{
  "id": "0117bfb9-215a-4559-a94f-e27b525d600c",
  "object": "transcription",
  "status": "completed",
  "text": "多謝大家抽空過嚟,我哋即刻開始今日嘅環節。嗯。",
  "duration_seconds": 631.2,
  "error": null,
  "created_at": "2026-10-18T10:00:00.000Z",
  "completed_at": "2026-10-18T10:04:12.000Z"
}
400

無效 id。

application/json
{
  "error": "invalid_id"
}
401

API 金鑰缺失、格式錯誤、無效或已過期。

application/json
{
  "error": "invalid_or_expired_token"
}
404

搵唔到(或唔屬於呢個 key)。

application/json
{
  "error": "not_found"
}
503

暫時讀取失敗,稍後重試。

application/json
{
  "error": "retrieval_failed"
}
DELETE/v1/asr/transcriptions/{id}

刪除轉寫紀錄(連音檔)

刪除一條轉寫紀錄:文字稿同上載嘅音檔即時失效、唔設復原,物理清除喺 30 日內完成(實際上即刻清除)。只可以刪自己 key 嘅紀錄(唔屬於自己 → 404,唔會洩露 id 存在與否)。刪除次序:先刪資料庫紀錄、後刪音檔。

路徑/查詢參數

欄位說明
idstring · uuid · 是

202 回應帶返嚟嘅 id(= asr_long_transcriptions.request_id)。

cURL
curl -X DELETE "https://api.canto-gen.com/v1/asr/transcriptions/{id}" \
  -H "Authorization: Bearer $CANTOGEN_API_KEY"

回應

200

已刪除。

application/json
{
  "id": "0117bfb9-215a-4559-a94f-e27b525d600c",
  "object": "transcription",
  "deleted": true
}
400

無效 id。

application/json
{
  "error": "invalid_id"
}
401

API 金鑰缺失、格式錯誤、無效或已過期。

application/json
{
  "error": "invalid_or_expired_token"
}
404

搵唔到(或唔屬於呢個 key)。

application/json
{
  "error": "not_found"
}
503

暫時刪除失敗,稍後重試。

application/json
{
  "error": "deletion_failed"
}
GET/v1/asr/vocabulary

讀取本帳戶嘅關鍵詞詞庫

讀取你帳戶嘅 ASR 關鍵詞詞庫(一本,per-account)。terms 係已清理嘅詞列表(每詞 ≤30 字、最多 50 個);updated_at 係上次更新時間(未建立過 → null)。詞庫用喺 keyword biasing:API key 客戶(sk_)叫 POST /v1/asr/transcribe/POST /v1/asr/jobs 冇帶 vocabulary 參數時自動套用呢本;帶咗參數(包括空陣列)就以請求為準。需先開通關鍵詞詞庫功能(未開通 → 403)。

cURL
curl "https://api.canto-gen.com/v1/asr/vocabulary" \
  -H "Authorization: Bearer $CANTOGEN_API_KEY"

回應

200

本帳戶嘅詞庫(未建立過 → 空列表)。

application/json
{
  "scope": "api",
  "terms": [
    "證監會",
    "庫務局"
  ],
  "updated_at": "2026-10-28T09:00:00.000Z"
}
401

API 金鑰缺失、格式錯誤、無效或已過期。

application/json
{
  "error": "invalid_or_expired_token"
}
403

未開通關鍵詞詞庫功能。

application/json
{
  "error": "asr_vocabulary_not_granted",
  "message": "Keyword vocabulary is not enabled for this account. Ask Canto-Gen support to enable the asr_vocabulary feature for your account, then retry."
}
503

暫時讀取失敗,稍後重試。

application/json
{
  "error": "vocabulary_read_failed"
}
PUT/v1/asr/vocabulary

覆寫本帳戶嘅關鍵詞詞庫

覆寫你帳戶嘅 ASR 關鍵詞詞庫(整本替換,唔係增量)。terms 會先清理(去空白、去重、丟棄超過 30 字嘅詞、最多保留 50 個)再儲存;回應係實際儲存咗嘅內容。傳空陣列 {"terms": []} 等於清空(同一效果可以用 DELETE)。需先開通關鍵詞詞庫功能(未開通 → 403)。

請求 body · AsrVocabularyRequest (必填)

欄位說明
termsarray · 是

The terms to store — up to 50 terms, each ≤30 characters after trimming. The list is cleaned before it is stored (trimmed, de-duplicated, over-long terms dropped, capped at 50). An empty array clears the list.

cURL
curl -X PUT "https://api.canto-gen.com/v1/asr/vocabulary" \
  -H "Authorization: Bearer $CANTOGEN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"terms":["證監會","庫務局"]}'

範例

兩個關鍵詞
{
  "terms": [
    "證監會",
    "庫務局"
  ]
}
清空(等效 DELETE)
{
  "terms": []
}

回應

200

已儲存(回實際儲存值)。

application/json
{
  "scope": "api",
  "terms": [
    "證監會",
    "庫務局"
  ],
  "updated_at": "2026-10-28T09:00:00.000Z"
}
400

body 唔啱(唔係有效 JSON/缺 terms/terms 唔係字串陣列)。

terms_required
{
  "error": "terms_required"
}
invalid_terms
{
  "error": "invalid_terms"
}
401

API 金鑰缺失、格式錯誤、無效或已過期。

application/json
{
  "error": "invalid_or_expired_token"
}
403

未開通關鍵詞詞庫功能。

application/json
{
  "error": "asr_vocabulary_not_granted",
  "message": "Keyword vocabulary is not enabled for this account. Ask Canto-Gen support to enable the asr_vocabulary feature for your account, then retry."
}
503

暫時儲存失敗,稍後重試。

application/json
{
  "error": "vocabulary_write_failed"
}
DELETE/v1/asr/vocabulary

清空本帳戶嘅關鍵詞詞庫

清空你帳戶嘅 ASR 關鍵詞詞庫(等效 PUT {"terms": []} — 詞庫變成空列表,updated_at 會更新)。之後 API key 客戶嘅轉寫請求如果冇帶 vocabulary 參數,就唔會再套任何詞。需先開通關鍵詞詞庫功能(未開通 → 403)。

cURL
curl -X DELETE "https://api.canto-gen.com/v1/asr/vocabulary" \
  -H "Authorization: Bearer $CANTOGEN_API_KEY"

回應

200

已清空。

application/json
{
  "ok": true,
  "scope": "api",
  "terms": [],
  "updated_at": "2026-10-28T09:00:00.000Z"
}
401

API 金鑰缺失、格式錯誤、無效或已過期。

application/json
{
  "error": "invalid_or_expired_token"
}
403

未開通關鍵詞詞庫功能。

application/json
{
  "error": "asr_vocabulary_not_granted",
  "message": "Keyword vocabulary is not enabled for this account. Ask Canto-Gen support to enable the asr_vocabulary feature for your account, then retry."
}
503

暫時清空失敗,稍後重試。

application/json
{
  "error": "vocabulary_write_failed"
}
POST/v1/asr/realtime/token

簽發實時轉寫 ephemeral token(瀏覽器用)

簽一枚短命 cst_… token 俾瀏覽器開 wss://api.canto-gen.com/v1/asr/realtime 而唔使曝露永久 sk_ key。Token HMAC 簽名、scope 綁 asr:realtime、TTL 60–600 秒(預設 300)。永遠喺伺服器端 mint(用 sk_ key 或已登入 session),瀏覽器只經 query ?token= 帶去開 WS — 永遠唔准將永久 API key 放入 URL。可選 vocabulary(關鍵詞偏置,asr_vocabulary 權限限定;無權限靜默忽略)— sk_ 同 session caller 都一樣可以帶。

請求 body · AsrRealtimeTokenRequest (選填)

欄位說明
expires_in_secondsnumber · 否

Token TTL(秒)。60–600,預設 300。

vocabularyarray · 否

Optional keyword-biasing list for this session (up to 50 terms, each ≤30 chars after trim). Grant-gated: only accounts with the asr_vocabulary entitlement have it applied — without the grant the list is silently ignored and the token is minted exactly as if it were absent. Per-request only: this endpoint does not apply your stored vocabulary (PUT /v1/asr/vocabulary) — pass the terms you want in the request.

cURL
curl -X POST "https://api.canto-gen.com/v1/asr/realtime/token" \
  -H "Authorization: Bearer $CANTOGEN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"expires_in_seconds":300}'

範例

預設 300 秒
{
  "expires_in_seconds": 300
}

回應

200

token 已簽發。

application/json
{
  "token": "cst_eyJzdWIiOiJ1MSIsInNjb3BlIjoiYXNyOnJlYWx0aW1lIn0.x8Y",
  "expires_in": 300,
  "ws_url": "wss://api.canto-gen.com/v1/asr/realtime",
  "token_type": "cst"
}
401

API 金鑰缺失、格式錯誤、無效或已過期。

application/json
{
  "error": "invalid_or_expired_token"
}
429

次數超限(每用戶 30/分鐘;單把金鑰 15/分鐘 — 同一帳戶所有金鑰加埋計)。

application/json
{
  "error": "rate_limited"
}

Balance

帳戶餘額
GET/v1/balance

查詢預付餘額

查詢帳戶預付餘額(HKD)及文件轉寫/實時聽寫費率、自動儲值設定。

  • balance_hkd — 目前預付餘額(HKD,2 位小數顯示)。
  • balance_hkd_exact — 同一餘額嘅 4 位小數實數(2026-10-18 additive — sub-cent 扣減可審)。
  • asr — 費率:文件轉寫 HK$0.80/小時、實時聽寫 HK$1.40/小時(1.75 倍),按秒計費(audio_second)。
  • auto_topup — 自動儲值設定(啟用狀態、觸發門檻、儲值金額)。

測試金鑰期間回傳測試環境餘額(與正式環境互相隔離)。餘額不足請前往 /account/billing 儲值。

cURL
curl "https://api.canto-gen.com/v1/balance" \
  -H "Authorization: Bearer $CANTOGEN_API_KEY"

回應

200

預付餘額與費率。

application/json
{
  "object": "balance",
  "currency": "HKD",
  "balance_hkd": 50,
  "balance_hkd_exact": 49.9975,
  "asr": {
    "batch_rate_hkd_per_hour": 0.8,
    "realtime_rate_hkd_per_hour": 1.4,
    "billed_unit": "audio_second"
  },
  "auto_topup": {
    "enabled": true,
    "threshold_hkd": 20,
    "amount_hkd": 100
  }
}
401

API 金鑰缺失、格式錯誤、無效或已過期。

application/json
{
  "error": "invalid_or_expired_token"
}
503

餘額查詢暫時失敗。請稍後重試。

application/json
{
  "error": "balance_read_failed"
}
GET/v1/usage

用量明細(預付錢包 ledger)

列出你帳戶嘅預付錢包 ledger 明細(append-only 唯一真相)— 每筆入帳/扣帳帶 kind(top_up/hold/hold_release/refund/adjustment…)、有號金額(4dp)、扣後餘額;用量類仲有 unit/quantity/當時 rate,自我解釋。hold+hold_release 成對(預扣 → 實際時長結算)。回應同時帶 summary(本期用量摘要):period_start(當前帳單週期開始日 — 付費方案係訂閱周年日,唔係曆月初 1 號)、used_chars(本期已用 credits)、limit_chars(方案本期配額)、remaining_chars(本期剩餘)、credit_chars(credit 池)、balance_hkd/balance_hkd_exact(預付錢包餘額)— 唔使逐筆加總就可以同自己嘅系統對帳。游標分頁:limit(1–100,預設 20)+ starting_after(上一頁最後一筆 id)。測試金鑰期間回 test 環境 ledger。金額 4dp 原樣輸出(/v1/balance 仍係 2dp 顯示面)。

路徑/查詢參數

欄位說明
limitinteger · 否

每頁行數(1–100,預設 20)。

default: 20

starting_afterstring · uuid · 否

游標 — 上一頁最後一筆嘅 entry id;之後(更舊)嘅記錄由呢度續拉。

cURL
curl "https://api.canto-gen.com/v1/usage" \
  -H "Authorization: Bearer $CANTOGEN_API_KEY"

回應

200

Ledger 明細頁(新到舊)。

application/json
{
  "object": "list",
  "summary": {
    "period_start": "2026-10-10",
    "used_chars": 2339,
    "limit_chars": 370000,
    "remaining_chars": 367661,
    "credit_chars": 5765,
    "currency": "HKD",
    "balance_hkd": 49.98,
    "balance_hkd_exact": 49.9775,
    "balance_credits": 49977.5
  },
  "data": [
    {
      "id": "3fcf4ca5-a996-813f-9714-c45e59549a24",
      "object": "wallet_ledger_entry",
      "created_at": "2026-10-17T10:34:00.000Z",
      "kind": "hold_release",
      "amount_hkd": 0.0001,
      "balance_after_hkd": 49.9775,
      "unit": "audio_second",
      "quantity": 11.46,
      "rate_hkd_per_hour": 0.8,
      "note": null
    }
  ],
  "has_more": true,
  "next_cursor": "3f9f4ca5-a996-8149-a631-d7c4351b7bb3"
}
400

無效參數。

application/json
{
  "error": "invalid_cursor"
}
401

API 金鑰缺失、格式錯誤、無效或已過期。

application/json
{
  "error": "invalid_or_expired_token"
}
503

Ledger 暫時讀取失敗,稍後重試。

application/json
{
  "error": "usage_read_failed"
}

Account

帳戶生命週期(刪除/私隱)
POST/v1/account/deletion

刪除你的帳戶

刪除你自己嘅帳戶(自我服務刪除)。純 API 客戶唔使登入 web UI 就用得。

兩步確認(body { confirmEmail, confirmWord }):

  • confirmEmail — 必須(大小寫不敏感)等於你嘅帳戶電郵;
  • confirmWord — 必須大小寫敏感等於 DELETE。

唔對 → 400(confirm_missing/confirm_email_mismatch/confirm_word_mismatch)。

前置條件(409):

  • active_jobs — 仲有未完成嘅生成工作(queued/processing/cancelling);
  • team_owner — 你係一個仲有其他成員嘅工作區擁有者(要先解散/轉讓)。

成功(200 { ok: true, purge_by }):

  • 即時停用:帳戶即刻鎖晒(登入被封、現有 session 全部失效)。
  • 永久清除:你嘅生成紀錄、聲線、參考音頻等個人資料由每日清理程序清走,purge_by 係完成清除嘅上限時刻(法定保留嘅帳目/用量紀錄唔會清)。

重複請求係冪等嘅(同一個帳戶只有一條刪除申請)。

請求 body · AccountDeletionRequest (必填)

欄位說明
confirmEmailstring · 是

Your account email (compared case-insensitively).

confirmWordstring · enum(1) · 是

Must be exactly DELETE (case-sensitive).

enum: DELETE

cURL
curl -X POST "https://api.canto-gen.com/v1/account/deletion" \
  -H "Authorization: Bearer $CANTOGEN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"confirmEmail":"you@example.com","confirmWord":"DELETE"}'

範例

兩步確認
{
  "confirmEmail": "you@example.com",
  "confirmWord": "DELETE"
}

回應

200

刪除申請已記錄 — 帳戶即時停用,資料由每日清理程序清走。

application/json
{
  "ok": true,
  "purge_by": "2026-11-02T03:00:00.000Z"
}
400

兩步確認唔啱 — confirm_missing/confirm_email_mismatch/confirm_word_mismatch。

confirm_missing
{
  "error": "confirm_missing"
}
confirm_email_mismatch
{
  "error": "confirm_email_mismatch"
}
confirm_word_mismatch
{
  "error": "confirm_word_mismatch"
}
401

API 金鑰缺失、格式錯誤、無效或已過期。

application/json
{
  "error": "invalid_or_expired_token"
}
409

前置條件唔過 — active_jobs(仲有未完成生成工作)/team_owner(你係仲有其他成員嘅工作區擁有者)。

active_jobs
{
  "error": "active_jobs"
}
team_owner
{
  "error": "team_owner"
}
503

刪除申請暫時寫唔入,稍後重試。

application/json
{
  "error": "deletion_request_failed"
}
GET/v1/account/telemetry

質素訊號(匿名使用統計)設定

讀/寫本帳戶嘅質素訊號 opt-out(匿名使用統計)。

  • telemetry_opt_out: true = 關閉自動行為遙測(例如你嘅使用行為記錄);
  • 用戶主動提交嘅評分/回報唔受影響(嗰啲係你明示嘅意圖,唔當成遙測)。

每個帳戶一個設定(同一帳戶嘅所有金鑰共用 user_profiles.telemetry_opt_out)。

cURL
curl "https://api.canto-gen.com/v1/account/telemetry" \
  -H "Authorization: Bearer $CANTOGEN_API_KEY"

回應

200

目前嘅質素訊號設定。

application/json
{
  "telemetry_opt_out": false
}
401

API 金鑰缺失、格式錯誤、無效或已過期。

application/json
{
  "error": "invalid_or_expired_token"
}
503

設定暫時讀唔到,稍後重試。

application/json
{
  "error": "telemetry_read_failed"
}
PUT/v1/account/telemetry

質素訊號(匿名使用統計)設定

讀/寫本帳戶嘅質素訊號 opt-out(匿名使用統計)。

  • telemetry_opt_out: true = 關閉自動行為遙測(例如你嘅使用行為記錄);
  • 用戶主動提交嘅評分/回報唔受影響(嗰啲係你明示嘅意圖,唔當成遙測)。

每個帳戶一個設定(同一帳戶嘅所有金鑰共用 user_profiles.telemetry_opt_out)。

請求 body · TelemetryPreference (必填)

欄位說明
telemetry_opt_outboolean · 是

True = turn automatic behavioural telemetry off.

cURL
curl -X PUT "https://api.canto-gen.com/v1/account/telemetry" \
  -H "Authorization: Bearer $CANTOGEN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"telemetry_opt_out":true}'

範例

關閉匿名使用統計
{
  "telemetry_opt_out": true
}

回應

200

設定已儲存。

application/json
{
  "ok": true,
  "telemetry_opt_out": true
}
400

body 無效 — invalid_telemetry_opt_out(telemetry_opt_out 唔係 boolean)。

application/json
{
  "error": "invalid_telemetry_opt_out"
}
401

API 金鑰缺失、格式錯誤、無效或已過期。

application/json
{
  "error": "invalid_or_expired_token"
}
503

設定暫時儲存唔到,稍後重試。

application/json
{
  "error": "telemetry_update_failed"
}

資料結構

SpeechRequest

請選擇恰好一種聲音模式 — 三者互斥:

  • voice — GET /v1/voices 的預設聲線 slug(建議;所有預設聲線均已廣東話優化/香港聲線)。需要 tts:generate scope。
  • design — 以 gender + age 描述一個合成聲線。tts:generate scope 或細粒度 tts:design scope 均可接受(二者其一即可,因此現有 tts:generate 金鑰無需任何更改)。
  • clone — 以 base64 reference_audio 樣本複製聲線(需要tts:clone key scope)。只需 reference_audio;舊版 prompt_text欄位已退役(送出會被忽略)。

同時傳送多於一個 voice / design / clone 會回傳 400 voice_mode_conflict。

欄位

欄位說明
modelstring · enum(1) · 否

The TTS model. Currently only cantogen-tts exists; other values return 400 invalid_model.

enum: cantogen-tts

default: cantogen-tts

voicestring · 否

Preset voice slug from GET /v1/voices. Required unless design or clone is used.

textstring · 是

The text to speak (1–500 characters on the async endpoint; the sync POST /v1/audio/speech caps at 300 billable credits). Cantonese text works best — 廣東話字正腔圓. Supports inline tone tags: insert [label] in the script, e.g. [笑聲]你好[唷!] — closed set of 15 tags (see the API guide, Inline tone tags). Unknown bracket tokens pass through untouched.

pitchinteger · 否

DEPRECATED (2026-09-20) — no effect under raw audio delivery. Still accepted with unchanged range validation (−12…+12 semitones, default 0), but the value is ignored.

default: 0

volumenumber · 否

DEPRECATED (2026-09-20) — no effect under raw audio delivery. Still accepted with unchanged range validation (0–10, default 1), but the value is ignored.

default: 1

emotionstring · enum(11) · 否

Speaking emotion — one of the 11 prod canonical values (happy / angry / sad / surprise / fear / disgust / neutral / confused / anxious / affection / whisper). Legacy MiniMax values (fearful / disgusted / surprised / excited / gentle) are accepted and normalized. The Creator UI's Chinese emotion presets (雀躍 / 冷靜 …) are a separate gallery layer and are not API enum values.

enum: happy · angry · sad · surprise · fear · disgust · neutral · confused · anxious · affection · whisper

stylestring · 否

Delivery style. Canonical values are English slugs — rhythm: steady / composed / rapid / slow / drawl / brisk / dynamic / staccato; timbre: mellow / cute / sharp / lazy / breathy / hoarse / deep / crisp / feeble / trembling; scene: corporate / promo / wedding / guide / expo / ad / tutorial / news / travel / audiobook / latenight / product / fairytale / podcast / storytelling / sports; character: animation-hero / stylish-uncle / astronaut / support-agent / boss / grandma / lottery-host / news-anchor / sage / late-dj / teacher / storyteller / market-commentator / sports-commentator / girl-next-door / smart-kid. The original Chinese preset values (明快 / 圓潤 / 講古 …) are still accepted as aliases — both are normalized internally to the same canonical value before reaching the engine. Any other free text also passes through. Merged into the engine style slot (order: style → emotion → instruction).

instructionstring · 否

Free-text delivery direction in Cantonese, Chinese or English — e.g. 「用興奮嘅語氣講,好似慶祝生日咁」. Applied after style and emotion, so it has the final say on how the line is delivered. Values over 500 characters return 400 invalid_instruction.

response_formatstring · enum(2) · 否

Audio container format. Other formats return 400 unsupported_format.

enum: mp3 · wav

default: mp3

srtboolean · 否

Also generate SRT subtitles. When true, a completed job's srt field carries the subtitle content (billed at a higher credit rate).

default: false

seedinteger · 否

Reserved. Accepted and validated as an integer but not yet used for reproducibility.

sample_rateinteger · 否

Reserved. Accepted and validated as an integer but not yet applied.

designDesignObject · 否
cloneCloneObject · 否

DesignObject

以描述方式指定合成聲線,而非選用預設聲線。接受 tts:generate 或 tts:design key scope(二者其一即可)。

欄位

欄位說明
genderstring · enum(2) · 是

Voice gender.

enum: male · female

agestring · enum(7) · 是

Voice age band. Prefer child, teenage, adult, midage, elder. teen (alias of teenage) and young (alias of adult) are deprecated but still accepted.

enum: child · teenage · adult · midage · elder · teen · young

CloneObject

從參考樣本複製聲線。需要具備 tts:clone scope 的 API 金鑰。

欄位

欄位說明
reference_audiostring · 是

Base64 audio sample (data URL such as data:audio/wav;base64,… or raw base64). Use a clean sample of at least 3 seconds — shorter samples are rejected; long samples are auto-trimmed to ~15–20 s on sentence boundaries.

JobStatus

語音任務的狀態。由 GET /v1/audio/jobs/{id}(200)回傳,亦是 POST /v1/audio/jobs 的 202 body。非同步生成經 POST /v1/audio/jobs 提交;同步 POST /v1/audio/speech 直接回傳音訊 bytes(200)。

欄位

欄位說明
job_idstring · 是

Job id (UUID).

statusstring · enum(6) · 是

Job lifecycle state. cancelling is transient — after DELETE /v1/audio/jobs/{id} on an in-flight job it settles as cancelled.

enum: queued · processing · cancelling · completed · failed · cancelled

poll_urlstring · 是

Relative URL of the job poll endpoint for this job.

srt_requestedboolean · 是

Whether the job was submitted with srt: true.

srtstring · 否

SRT subtitle content. Present only when subtitles were requested and the job has completed with captions materialized. Additive — its absence never affects other fields.

audio_urlstring · uri · 否

Pre-signed download URL for the generated audio. Present only once status is completed — URLs from the materialized library are valid for 1 hour, worker URLs (not yet materialized) for 7 days. Additive — its absence never affects other fields.

Voice

一條預設聲線。所有官方聲線均已廣東話優化(Cantonese-optimized)。

欄位

欄位說明
slugstring · 是

Use as the voice parameter of POST /v1/audio/speech (sync) or POST /v1/audio/jobs (async).

namestring · 是

Display name (Chinese name as-is).

genderstring · 否

Voice gender.

agestring · 否

Voice age range.

stylesarray · 否

Supported speaking styles/emotions.

preview_urlstring · 否

URL streaming a short preview sample (no extra auth needed).

TranscriptionRequest

文件轉寫(音檔轉文字)

欄位

欄位說明
filestring · binary · 是

The audio file to transcribe (wav, mp3, m4a/mp4, webm, ogg, flac). Max 4.5 MB effective (platform request-body cap); for longer audio use POST /v1/asr/jobs with audio_url or storage_path (up to 500 MB).

modelstring · 是

Transcription model name. Required by the API shape; any non-empty value is accepted — the current release offers a single Cantonese-optimized transcription model (cantogen-asr).

languagestring · 否

Optional ISO-639-1 language hint. Accepted as-is; transcription is currently Cantonese-optimized.

response_formatstring · enum(2) · 否

json (default) returns the structured object; text returns plain text. Segment-timestamp formats (srt, verbose_json) are not yet supported and return 400 unsupported_response_format.

enum: json · text

default: json

vocabularyarray · 否

Optional keyword-biasing list (up to 50 terms, each ≤30 chars after trim). Grant-gated: only accounts with the asr_vocabulary entitlement have it applied — without the grant the field is silently ignored and the request is processed exactly as if it were absent. On multipart requests send a JSON-encoded string array (e.g. '["term1","term2"]'). Stored default (API key requests): when the parameter is omitted, the vocabulary stored for your account (PUT /v1/asr/vocabulary) is applied automatically; when the parameter is present — including an empty array — the request value wins (an empty array means no biasing, it does not fall back to the stored list).

AsrJobUrlRequest

非同步提交(JSON 進場)— audio_url:server 側下載音頻,繞過 4.5MB 上載上限;storage_path:只限 browser session(Creator 大檔 lane,先經 /api/asr/upload-url 簽 URL 直傳上載,物件 free 24 小時/paid 7 日 TTL)。兩者二擇一,同時出現 → 400。

欄位

欄位說明
audio_urlstring · uri · 否

https URL of the audio file (server-side fetch; up to 500 MB / 4 hours).

storage_pathstring · 否

Upload path as returned by POST /api/asr/upload-url (browser session callers only — API-key requests are rejected with 400 storage_path_session_only). The path must belong to the authenticated user; a cross-account path returns 403 storage_path_forbidden. Max 500 MB / 4 hours of audio.

modelstring · enum(1) · 否

enum: cantogen-asr

languagestring · 否

ISO-639-1 language hint (optional).

vocabularyarray · 否

Optional keyword-biasing list (up to 50 terms, each ≤30 chars after trim). Grant-gated: only accounts with the asr_vocabulary entitlement have it applied — without the grant the field is silently ignored and the job is processed exactly as if it were absent. When granted, the stored transcript has recitation residue stripped before it is returned by the poll endpoint. Stored default (API key requests): when the parameter is omitted, the vocabulary stored for your account (PUT /v1/asr/vocabulary) is applied automatically; when the parameter is present — including an empty array — the request value wins (an empty array means no biasing, it does not fall back to the stored list).

callback_urlstring · uri · 否

Optional https webhook — POSTed { id, object, status, duration_seconds?, error? } when the job reaches completed/failed (2xx = delivered; failed attempts retried up to 5 times). When your account has a webhook signing secret configured (issued and rotated by support), every callback also carries x-canto-signature: t=<unix seconds>,v1=<hex HMAC-SHA256(secret, "<t>." + raw body)> plus x-timestamp (ISO 8601, same second). Verify against the raw request body in constant time and reject requests whose |now − t| > 300 seconds. Accounts without a secret receive unsigned callbacks (payload unchanged).

AsrRealtimeTokenRequest

Token TTL(秒)。60–600,預設 300。

欄位

欄位說明
expires_in_secondsnumber · 否

Token TTL(秒)。60–600,預設 300。

vocabularyarray · 否

Optional keyword-biasing list for this session (up to 50 terms, each ≤30 chars after trim). Grant-gated: only accounts with the asr_vocabulary entitlement have it applied — without the grant the list is silently ignored and the token is minted exactly as if it were absent. Per-request only: this endpoint does not apply your stored vocabulary (PUT /v1/asr/vocabulary) — pass the terms you want in the request.

Transcription

轉寫成功。

欄位

欄位說明
idstring · 是

Transcription request id (UUID).

objectstring · enum(1) · 是

Always transcription.

enum: transcription

textstring · 是

The transcribed text.

duration_secondsnumber · 否

Audio duration in seconds (rounded to 2 decimals) — the billing basis.

charged_hkdnumber · 否

HKD actually settled for this request (success-only billing, per-second, no rounding up). Additive — its absence never affects other fields.

AsrVocabularyRequest

關鍵詞詞庫(整本替換)。

欄位

欄位說明
termsarray · 是

The terms to store — up to 50 terms, each ≤30 characters after trimming. The list is cleaned before it is stored (trimmed, de-duplicated, over-long terms dropped, capped at 50). An empty array clears the list.

AsrVocabulary

本帳戶嘅關鍵詞詞庫。

欄位

欄位說明
scopestring · enum(1) · 是

Always api — the public API vocabulary scope.

enum: api

termsarray · 是

The stored terms (cleaned).

updated_atstring · 否

ISO-8601 timestamp of the last change (null when the list was never set).

Balance

預付餘額與費率。

欄位

欄位說明
objectstring · enum(1) · 是

Always balance.

enum: balance

currencystring · enum(1) · 是

Prepaid-balance currency.

enum: HKD

balance_hkdnumber · 是

The current prepaid balance in HKD (2-decimal display; test keys report the test-environment balance).

balance_hkd_exactnumber · 否

The same balance at 4 decimals (2026-10-18 additive) — sub-cent charges (e.g. 0.0025) stay auditable.

asrobject · 是

查詢預付餘額

auto_topupobject · 是

AccountDeletionRequest

刪除帳戶嘅兩步確認 body。

欄位

欄位說明
confirmEmailstring · 是

Your account email (compared case-insensitively).

confirmWordstring · enum(1) · 是

Must be exactly DELETE (case-sensitive).

enum: DELETE

TelemetryPreference

質素訊號 opt-out 設定 body。

欄位

欄位說明
telemetry_opt_outboolean · 是

True = turn automatic behavioural telemetry off.

Error

欄位

欄位說明
errorstring · 是

Stable machine-readable error code.

messagestring · 否

Optional human-readable explanation.