[{"data":1,"prerenderedAt":469},["ShallowReactive",2],{"guide-\u002Fguides\u002Ftext-to-speech":3,"developer-code-1hamfo3":467,"developer-code-13krb3x":468},{"id":4,"title":5,"body":6,"description":458,"extension":459,"meta":460,"navigation":461,"path":463,"seo":464,"stem":465,"__hash__":466},"guides\u002Fguides\u002Ftext-to-speech.md","Text-to-Speech API",{"type":7,"value":8,"toc":452},"minimark",[9,13,28,33,71,75,86,148,159,203,384,388,424,428,448],[10,11,12],"p",{},"The VisionStory Text-to-Speech API converts text into natural MP3 audio with any public or cloned voice. The request is synchronous: a successful response returns the generated audio bytes directly.",[14,15,16],"blockquote",{},[10,17,18,22,23,27],{},[19,20,21],"strong",{},"Beta access."," This endpoint is allowlisted during beta. If a request returns ",[24,25,26],"code",{},"403 \u002F not enabled",", contact your VisionStory representative. An active subscription is required.",[29,30,32],"h2",{"id":31},"text-to-speech-api-endpoint","Text-to-speech API endpoint",[34,35,36,52],"table",{},[37,38,39],"thead",{},[40,41,42,46,49],"tr",{},[43,44,45],"th",{},"Method",[43,47,48],{},"Path",[43,50,51],{},"What it does",[53,54,55],"tbody",{},[40,56,57,63,68],{},[58,59,60],"td",{},[24,61,62],{},"POST",[58,64,65],{},[24,66,67],{},"\u002Fapi\u002Fv1\u002Ftts",[58,69,70],{},"Synthesize speech from text; returns MP3 audio",[29,72,74],{"id":73},"generate-mp3-speech-from-text","Generate MP3 speech from text",[10,76,77,78,81,82,85],{},"Send ",[24,79,80],{},"text"," and a ",[24,83,84],{},"voice_id"," (from GET \u002Fapi\u002Fv1\u002Fvoices — a public or your own cloned voice). The service automatically picks the best synthesis strategy for the voice and the text language.",[87,88,93],"pre",{"className":89,"code":90,"language":91,"meta":92,"style":92},"language-bash shiki shiki-themes github-light github-dark","curl -s -X POST -H \"X-API-Key: $VISIONSTORY_API_KEY\" -H \"Content-Type: application\u002Fjson\" -d '{\"text\": \"Hello from VisionStory.\", \"voice_id\": \"YOUR_VOICE_ID\"}' https:\u002F\u002Fopenapi.visionstory.ai\u002Fapi\u002Fv1\u002Ftts --output speech.mp3\n","bash","",[24,94,95],{"__ignoreMap":92},[96,97,100,104,108,111,115,118,121,125,128,130,133,136,139,142,145],"span",{"class":98,"line":99},"line",1,[96,101,103],{"class":102},"sScJk","curl",[96,105,107],{"class":106},"sj4cs"," -s",[96,109,110],{"class":106}," -X",[96,112,114],{"class":113},"sZZnC"," POST",[96,116,117],{"class":106}," -H",[96,119,120],{"class":113}," \"X-API-Key: ",[96,122,124],{"class":123},"sVt8B","$VISIONSTORY_API_KEY",[96,126,127],{"class":113},"\"",[96,129,117],{"class":106},[96,131,132],{"class":113}," \"Content-Type: application\u002Fjson\"",[96,134,135],{"class":106}," -d",[96,137,138],{"class":113}," '{\"text\": \"Hello from VisionStory.\", \"voice_id\": \"YOUR_VOICE_ID\"}'",[96,140,141],{"class":113}," https:\u002F\u002Fopenapi.visionstory.ai\u002Fapi\u002Fv1\u002Ftts",[96,143,144],{"class":106}," --output",[96,146,147],{"class":113}," speech.mp3\n",[10,149,150,151,154,155,158],{},"The response body is the raw MP3 (",[24,152,153],{},"audio\u002Fmpeg",", 44.1 kHz). Usage and billing come back in ",[19,156,157],{},"response headers",", not the body:",[34,160,161,171],{},[37,162,163],{},[40,164,165,168],{},[43,166,167],{},"Header",[43,169,170],{},"Meaning",[53,172,173,183,193],{},[40,174,175,180],{},[58,176,177],{},[24,178,179],{},"X-Audio-Duration-Sec",[58,181,182],{},"Length of the generated audio, in seconds",[40,184,185,190],{},[58,186,187],{},[24,188,189],{},"X-Usage-Characters",[58,191,192],{},"Characters billed",[40,194,195,200],{},[58,196,197],{},[24,198,199],{},"X-Cost-Credit",[58,201,202],{},"Credits charged for this call",[87,204,208],{"className":205,"code":206,"language":207,"meta":92,"style":92},"language-python shiki shiki-themes github-light github-dark","import requests, os\n\nresp = requests.post(\n    \"https:\u002F\u002Fopenapi.visionstory.ai\u002Fapi\u002Fv1\u002Ftts\",\n    headers={\"X-API-Key\": os.environ[\"VISIONSTORY_API_KEY\"]},\n    json={\"text\": \"Hello from VisionStory.\", \"voice_id\": \"YOUR_VOICE_ID\"},\n    timeout=240,\n)\nresp.raise_for_status()\nwith open(\"speech.mp3\", \"wb\") as f:\n    f.write(resp.content)\nprint(\"credits charged:\", resp.headers.get(\"X-Cost-Credit\"))\n","python",[24,209,210,219,226,238,247,271,304,317,323,329,358,364],{"__ignoreMap":92},[96,211,212,216],{"class":98,"line":99},[96,213,215],{"class":214},"szBVR","import",[96,217,218],{"class":123}," requests, os\n",[96,220,222],{"class":98,"line":221},2,[96,223,225],{"emptyLinePlaceholder":224},true,"\n",[96,227,229,232,235],{"class":98,"line":228},3,[96,230,231],{"class":123},"resp ",[96,233,234],{"class":214},"=",[96,236,237],{"class":123}," requests.post(\n",[96,239,241,244],{"class":98,"line":240},4,[96,242,243],{"class":113},"    \"https:\u002F\u002Fopenapi.visionstory.ai\u002Fapi\u002Fv1\u002Ftts\"",[96,245,246],{"class":123},",\n",[96,248,250,254,256,259,262,265,268],{"class":98,"line":249},5,[96,251,253],{"class":252},"s4XuR","    headers",[96,255,234],{"class":214},[96,257,258],{"class":123},"{",[96,260,261],{"class":113},"\"X-API-Key\"",[96,263,264],{"class":123},": os.environ[",[96,266,267],{"class":113},"\"VISIONSTORY_API_KEY\"",[96,269,270],{"class":123},"]},\n",[96,272,274,277,279,281,284,287,290,293,296,298,301],{"class":98,"line":273},6,[96,275,276],{"class":252},"    json",[96,278,234],{"class":214},[96,280,258],{"class":123},[96,282,283],{"class":113},"\"text\"",[96,285,286],{"class":123},": ",[96,288,289],{"class":113},"\"Hello from VisionStory.\"",[96,291,292],{"class":123},", ",[96,294,295],{"class":113},"\"voice_id\"",[96,297,286],{"class":123},[96,299,300],{"class":113},"\"YOUR_VOICE_ID\"",[96,302,303],{"class":123},"},\n",[96,305,307,310,312,315],{"class":98,"line":306},7,[96,308,309],{"class":252},"    timeout",[96,311,234],{"class":214},[96,313,314],{"class":106},"240",[96,316,246],{"class":123},[96,318,320],{"class":98,"line":319},8,[96,321,322],{"class":123},")\n",[96,324,326],{"class":98,"line":325},9,[96,327,328],{"class":123},"resp.raise_for_status()\n",[96,330,332,335,338,341,344,346,349,352,355],{"class":98,"line":331},10,[96,333,334],{"class":214},"with",[96,336,337],{"class":106}," open",[96,339,340],{"class":123},"(",[96,342,343],{"class":113},"\"speech.mp3\"",[96,345,292],{"class":123},[96,347,348],{"class":113},"\"wb\"",[96,350,351],{"class":123},") ",[96,353,354],{"class":214},"as",[96,356,357],{"class":123}," f:\n",[96,359,361],{"class":98,"line":360},11,[96,362,363],{"class":123},"    f.write(resp.content)\n",[96,365,367,370,372,375,378,381],{"class":98,"line":366},12,[96,368,369],{"class":106},"print",[96,371,340],{"class":123},[96,373,374],{"class":113},"\"credits charged:\"",[96,376,377],{"class":123},", resp.headers.get(",[96,379,380],{"class":113},"\"X-Cost-Credit\"",[96,382,383],{"class":123},"))\n",[29,385,387],{"id":386},"billing-limits-and-storage","Billing, limits, and storage",[389,390,391,402,408,418],"ul",{},[392,393,394,397,398,401],"li",{},[19,395,396],{},"Synchronous & not stored."," The audio is returned inline and is ",[19,399,400],{},"not"," saved on our side — persist the bytes yourself; a repeat call regenerates and bills again.",[392,403,404,407],{},[19,405,406],{},"Billing:"," 2 credits per 1,000 characters (rounded up), charged only on success. There is no free allowance.",[392,409,410,413,414,417],{},[19,411,412],{},"Character limit:"," long text is supported up to a per-request cap; exceeding it returns ",[24,415,416],{},"400",".",[392,419,420,423],{},[19,421,422],{},"Concurrency:"," synchronous generation is capped at a few concurrent requests per key during beta; excess requests are rejected rather than queued.",[29,425,427],{"id":426},"related-visionstory-api-guides","Related VisionStory API guides",[389,429,430,441],{},[392,431,432,437,438,440],{},[433,434,436],"a",{"href":435},"\u002Fguides\u002Fvoices","Voices"," — pick or clone the ",[24,439,84],{}," to speak with.",[392,442,443,447],{},[433,444,446],{"href":445},"\u002Freference","API reference"," — full request schema and error codes.",[449,450,451],"style",{},"html pre.shiki code .sScJk, html code.shiki .sScJk{--shiki-default:#6F42C1;--shiki-dark:#B392F0}html pre.shiki code .sj4cs, html code.shiki .sj4cs{--shiki-default:#005CC5;--shiki-dark:#79B8FF}html pre.shiki code .sZZnC, html code.shiki .sZZnC{--shiki-default:#032F62;--shiki-dark:#9ECBFF}html pre.shiki code .sVt8B, html code.shiki .sVt8B{--shiki-default:#24292E;--shiki-dark:#E1E4E8}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html pre.shiki code .szBVR, html code.shiki .szBVR{--shiki-default:#D73A49;--shiki-dark:#F97583}html pre.shiki code .s4XuR, html code.shiki .s4XuR{--shiki-default:#E36209;--shiki-dark:#FFAB70}",{"title":92,"searchDepth":221,"depth":221,"links":453},[454,455,456,457],{"id":31,"depth":221,"text":32},{"id":73,"depth":221,"text":74},{"id":386,"depth":221,"text":387},{"id":426,"depth":221,"text":427},"Convert text to natural MP3 speech with a public or cloned VisionStory voice, including request examples, billing headers, limits, and storage guidance.","md",{},{"title":462,"order":273},"Text to Speech","\u002Fguides\u002Ftext-to-speech",{"title":5,"description":458},"guides\u002Ftext-to-speech","B-UlFC5eEOkNjT4XJKYU6FN5ExUOAc3PTamuu-Gy1Bw","\u003Cpre class=\"shiki github-dark-default\" style=\"background-color:#0d1117;color:#e6edf3\" tabindex=\"0\">\u003Ccode>\u003Cspan class=\"line\">\u003Cspan style=\"color:#FFA657\">curl\u003C\u002Fspan>\u003Cspan style=\"color:#79C0FF\"> -s\u003C\u002Fspan>\u003Cspan style=\"color:#79C0FF\"> -X\u003C\u002Fspan>\u003Cspan style=\"color:#A5D6FF\"> POST\u003C\u002Fspan>\u003Cspan style=\"color:#79C0FF\"> -H\u003C\u002Fspan>\u003Cspan style=\"color:#A5D6FF\"> \"X-API-Key: \u003C\u002Fspan>\u003Cspan style=\"color:#E6EDF3\">$VISIONSTORY_API_KEY\u003C\u002Fspan>\u003Cspan style=\"color:#A5D6FF\">\"\u003C\u002Fspan>\u003Cspan style=\"color:#79C0FF\"> -H\u003C\u002Fspan>\u003Cspan style=\"color:#A5D6FF\"> \"Content-Type: application\u002Fjson\"\u003C\u002Fspan>\u003Cspan style=\"color:#79C0FF\"> -d\u003C\u002Fspan>\u003Cspan style=\"color:#A5D6FF\"> '{\"text\": \"Hello from VisionStory.\", \"voice_id\": \"YOUR_VOICE_ID\"}'\u003C\u002Fspan>\u003Cspan style=\"color:#A5D6FF\"> https:\u002F\u002Fopenapi.visionstory.ai\u002Fapi\u002Fv1\u002Ftts\u003C\u002Fspan>\u003Cspan style=\"color:#79C0FF\"> --output\u003C\u002Fspan>\u003Cspan style=\"color:#A5D6FF\"> speech.mp3\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003C\u002Fspan>\u003C\u002Fcode>\u003C\u002Fpre>","\u003Cpre class=\"shiki github-dark-default\" style=\"background-color:#0d1117;color:#e6edf3\" tabindex=\"0\">\u003Ccode>\u003Cspan class=\"line\">\u003Cspan style=\"color:#FF7B72\">import\u003C\u002Fspan>\u003Cspan style=\"color:#E6EDF3\"> requests, os\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E6EDF3\">resp \u003C\u002Fspan>\u003Cspan style=\"color:#FF7B72\">=\u003C\u002Fspan>\u003Cspan style=\"color:#E6EDF3\"> requests.post(\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#A5D6FF\">    \"https:\u002F\u002Fopenapi.visionstory.ai\u002Fapi\u002Fv1\u002Ftts\"\u003C\u002Fspan>\u003Cspan style=\"color:#E6EDF3\">,\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#FFA657\">    headers\u003C\u002Fspan>\u003Cspan style=\"color:#FF7B72\">=\u003C\u002Fspan>\u003Cspan style=\"color:#E6EDF3\">{\u003C\u002Fspan>\u003Cspan style=\"color:#A5D6FF\">\"X-API-Key\"\u003C\u002Fspan>\u003Cspan style=\"color:#E6EDF3\">: os.environ[\u003C\u002Fspan>\u003Cspan style=\"color:#A5D6FF\">\"VISIONSTORY_API_KEY\"\u003C\u002Fspan>\u003Cspan style=\"color:#E6EDF3\">]},\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#FFA657\">    json\u003C\u002Fspan>\u003Cspan style=\"color:#FF7B72\">=\u003C\u002Fspan>\u003Cspan style=\"color:#E6EDF3\">{\u003C\u002Fspan>\u003Cspan style=\"color:#A5D6FF\">\"text\"\u003C\u002Fspan>\u003Cspan style=\"color:#E6EDF3\">: \u003C\u002Fspan>\u003Cspan style=\"color:#A5D6FF\">\"Hello from VisionStory.\"\u003C\u002Fspan>\u003Cspan style=\"color:#E6EDF3\">, \u003C\u002Fspan>\u003Cspan style=\"color:#A5D6FF\">\"voice_id\"\u003C\u002Fspan>\u003Cspan style=\"color:#E6EDF3\">: \u003C\u002Fspan>\u003Cspan style=\"color:#A5D6FF\">\"YOUR_VOICE_ID\"\u003C\u002Fspan>\u003Cspan style=\"color:#E6EDF3\">},\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#FFA657\">    timeout\u003C\u002Fspan>\u003Cspan style=\"color:#FF7B72\">=\u003C\u002Fspan>\u003Cspan style=\"color:#79C0FF\">240\u003C\u002Fspan>\u003Cspan style=\"color:#E6EDF3\">,\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E6EDF3\">)\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E6EDF3\">resp.raise_for_status()\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#FF7B72\">with\u003C\u002Fspan>\u003Cspan style=\"color:#79C0FF\"> open\u003C\u002Fspan>\u003Cspan style=\"color:#E6EDF3\">(\u003C\u002Fspan>\u003Cspan style=\"color:#A5D6FF\">\"speech.mp3\"\u003C\u002Fspan>\u003Cspan style=\"color:#E6EDF3\">, \u003C\u002Fspan>\u003Cspan style=\"color:#A5D6FF\">\"wb\"\u003C\u002Fspan>\u003Cspan style=\"color:#E6EDF3\">) \u003C\u002Fspan>\u003Cspan style=\"color:#FF7B72\">as\u003C\u002Fspan>\u003Cspan style=\"color:#E6EDF3\"> f:\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E6EDF3\">    f.write(resp.content)\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#79C0FF\">print\u003C\u002Fspan>\u003Cspan style=\"color:#E6EDF3\">(\u003C\u002Fspan>\u003Cspan style=\"color:#A5D6FF\">\"credits charged:\"\u003C\u002Fspan>\u003Cspan style=\"color:#E6EDF3\">, resp.headers.get(\u003C\u002Fspan>\u003Cspan style=\"color:#A5D6FF\">\"X-Cost-Credit\"\u003C\u002Fspan>\u003Cspan style=\"color:#E6EDF3\">))\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003C\u002Fspan>\u003C\u002Fcode>\u003C\u002Fpre>",1788166855861]