The package is installed as typecast-python, but imported as typecast.
Make sure you have version 0.1.5 or higher installed. You can check your version with pip show typecast-python. If you have an older version, run pip install --upgrade typecast-python to update.
ssfm-v30 offers two emotion control modes: Preset and Smart.
Smart Mode
Preset Mode
Let the AI infer emotion from context:
Copy
Ask AI
from typecast import Typecastfrom typecast.models import TTSRequest, SmartPromptclient = Typecast()response = client.text_to_speech(TTSRequest( text="Everything is going to be okay.", model="ssfm-v30", voice_id="tc_672c5f5ce59fac2a48faeaee", prompt=SmartPrompt( emotion_type="smart", previous_text="I just got the best news!", # Optional context next_text="I can't wait to celebrate!" # Optional context )))
Explicitly set emotion with preset values:
Copy
Ask AI
from typecast import Typecastfrom typecast.models import TTSRequest, PresetPromptclient = Typecast()response = client.text_to_speech(TTSRequest( text="I am so excited to show you these features!", model="ssfm-v30", voice_id="tc_672c5f5ce59fac2a48faeaee", prompt=PresetPrompt( emotion_type="preset", emotion_preset="happy", # normal, happy, sad, angry, whisper, toneup, tonedown emotion_intensity=1.5 # Range: 0.0 to 2.0 )))
Recommended: Use the LanguageCode enum for type-safe language selection. You can also pass the ISO 639-3 code as a string (e.g., "eng").The SDK supports 37 languages with ISO 639-3 codes:
Language
Code
Language
Code
Language
Code
English
eng
Japanese
jpn
Ukrainian
ukr
Korean
kor
Greek
ell
Indonesian
ind
Spanish
spa
Tamil
tam
Danish
dan
German
deu
Tagalog
tgl
Swedish
swe
French
fra
Finnish
fin
Malay
msa
Italian
ita
Chinese
zho
Czech
ces
Polish
pol
Slovak
slk
Portuguese
por
Dutch
nld
Arabic
ara
Bulgarian
bul
Russian
rus
Croatian
hrv
Romanian
ron
Bengali
ben
Hindi
hin
Hungarian
hun
Hokkien
nan
Norwegian
nor
Punjabi
pan
Thai
tha
Turkish
tur
Vietnamese
vie
Cantonese
yue
Use the LanguageCode enum for type-safe language selection: