Skip to content

[Bug] speech synthesize --pronunciation sends wrong pronunciation_dict shape (array instead of {"tone":[...]}), API rejects it #187

Description

@richardsci

Summary

mmx speech synthesize --pronunciation "<from>/<to>" builds the wrong JSON shape for pronunciation_dict. It serializes it as an array of {tone, text} objects, but the MiniMax T2A API expects an object with a tone string array. Every request that uses --pronunciation therefore fails, so custom pronunciation (e.g. Chinese polyphonic characters / 多音字) is completely unusable from the CLI.

Environment

  • mmx 1.0.16
  • Region: cn (api.minimaxi.com)
  • Model: speech-2.8-hd
  • macOS (darwin)

Steps to reproduce

mmx speech synthesize \
  --text "我要去重庆出差。" \
  --pronunciation "重/(chong2)" \
  --out out.mp3

Actual result

Error: API error: invalid params, Mismatch type open_platform.PronunciationDict with value array "at index 258: mismatched type with value\n\n\tunciation_dict\":[{\"tone\":\"(chong\n\t................^...............\n" (HTTP 200)

Root cause

--dry-run --verbose shows the request body the CLI generates:

"pronunciation_dict": [
  {
    "tone": "(chong2)",
    "text": ""
  }
]

But the T2A API (/v1/t2a_v2) expects pronunciation_dict to be an object whose tone field is an array of word/(pronunciation) strings:

"pronunciation_dict": {
  "tone": ["重/(chong2)"]
}

See: https://platform.minimaxi.com/docs/api-reference/speech-t2a-http

So the CLI is:

  1. Emitting an array instead of an object.
  2. Splitting from/to into separate text / tone fields, whereas the API wants the original word/(pronunciation) kept as a single string inside tone.

Confirmed fix (works via raw API)

Sending the corrected body succeeds and produces audio with the overridden pronunciation:

curl -s https://api.minimaxi.com/v1/t2a_v2 \
  -H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \
  -d '{
    "model":"speech-2.8-hd",
    "text":"我要去重庆出差。",
    "voice_setting":{"voice_id":"English_expressive_narrator"},
    "audio_setting":{"format":"mp3","sample_rate":32000},
    "output_format":"hex",
    "pronunciation_dict":{"tone":["重/(chong2)"]}
  }'
# -> base_resp.status_code == 0, audio returned OK

Suggested fix

Change the --pronunciation serialization so that each from/to value is joined back into a single from/to string and collected under a tone array on an object:

"pronunciation_dict": { "tone": ["重/(chong2)", "行长/(hang2)(zhang3)"] }

i.e. don't split into {text, tone} and don't wrap in an outer array.

Impact

There is no CLI-level workaround — --pronunciation is the only entry point and its output structure is hard-coded, so custom pronunciation cannot be used at all until this is fixed. This blocks a common use case: correcting Chinese polyphonic characters (多音字) in TTS.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions