{"id":27373,"library":"sarvamai","title":"Sarvam AI Python SDK","description":"Official Python SDK for Sarvam AI APIs, providing access to text-to-speech, speech-to-text, translation, and text generation models. Current version 0.1.28. Actively maintained with monthly releases.","status":"active","version":"0.1.28","language":"python","source_language":"en","source_url":"https://github.com/sarvamai/sarvam-python-sdk","tags":["sarvam","ai","tts","stt","translation","llm"],"install":[{"cmd":"pip install sarvamai","lang":"bash","label":"Install latest"}],"dependencies":[],"imports":[{"note":"","wrong":"","symbol":"SarvamAI","correct":"from sarvamai import SarvamAI"}],"quickstart":{"code":"from sarvamai import SarvamAI\n\nclient = SarvamAI(api_key=os.environ.get('SARVAM_API_KEY', ''))\nresponse = client.text_to_speech(text='Hello world', target_language_code='hi-IN')\nprint(response.audio_content)","lang":"python","description":"Initialize client with API key and call TTS endpoint."},"warnings":[{"fix":"Export SARVAM_API_KEY environment variable or pass api_key to constructor.","message":"api_key parameter is required; no default key or fallback. Must be set via environment variable or passed explicitly.","severity":"gotcha","affected_versions":"all"},{"fix":"Ensure text is already in the target language's script (e.g., Devanagari for Hindi).","message":"All text inputs should be provided in the target language script; no automatic transliteration.","severity":"gotcha","affected_versions":"all"},{"fix":"Replace `client.tts(...)` with `client.text_to_speech(...)`.","message":"In v0.1.20, the `client.tts` method was renamed to `client.text_to_speech`. Old code using `.tts` will break.","severity":"breaking","affected_versions":">=0.1.20"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Set SARVAM_API_KEY environment variable to a valid key from Sarvam AI dashboard.","cause":"Missing or incorrect API key.","error":"sarvamai.exceptions.AuthenticationError: Invalid API key"},{"fix":"Upgrade to >=0.1.0: pip install --upgrade sarvamai","cause":"Installed version <0.1.0 which uses positional argument for key.","error":"TypeError: __init__() got an unexpected keyword argument 'api_key'"},{"fix":"Use `.text_to_speech()` instead.","cause":"Code uses deprecated `.tts` method.","error":"AttributeError: 'SarvamAI' object has no attribute 'tts'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}