{"id":24302774,"url":"https://github.com/taigrr/elevenlabs","last_synced_at":"2025-09-26T05:32:12.609Z","repository":{"id":153671673,"uuid":"628787398","full_name":"taigrr/elevenlabs","owner":"taigrr","description":"ElevenLabs Artificial Voice Synthesis Client","archived":false,"fork":false,"pushed_at":"2024-11-26T05:39:34.000Z","size":88,"stargazers_count":42,"open_issues_count":0,"forks_count":12,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-11-26T06:28:28.167Z","etag":null,"topics":["ai","elevenlabs","go","golang","golang-library","speech","speech-synthesis","tts"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"0bsd","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/taigrr.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"taigrr","patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":null}},"created_at":"2023-04-17T01:29:27.000Z","updated_at":"2024-11-26T05:39:38.000Z","dependencies_parsed_at":null,"dependency_job_id":"11f18fbc-57d1-4916-9e32-1501ee91d9f5","html_url":"https://github.com/taigrr/elevenlabs","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/taigrr%2Felevenlabs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/taigrr%2Felevenlabs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/taigrr%2Felevenlabs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/taigrr%2Felevenlabs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/taigrr","download_url":"https://codeload.github.com/taigrr/elevenlabs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234292179,"owners_count":18809308,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai","elevenlabs","go","golang","golang-library","speech","speech-synthesis","tts"],"created_at":"2025-01-17T00:19:19.583Z","updated_at":"2025-09-26T05:32:12.603Z","avatar_url":"https://github.com/taigrr.png","language":"Go","funding_links":["https://github.com/sponsors/taigrr"],"categories":[],"sub_categories":[],"readme":"# elevenlabs\n\n[![License 0BSD](https://img.shields.io/badge/License-0BSD-pink.svg)](https://opensource.org/licenses/0BSD)\n[![GoDoc](https://godoc.org/github.com/taigrr/elevenlabs?status.svg)](https://godoc.org/github.com/taigrr/elevenlabs)\n[![Go Mod](https://img.shields.io/badge/go.mod-v1.20-blue)](go.mod)\n[![Go Report Card](https://goreportcard.com/badge/github.com/taigrr/elevenlabs?branch=master)](https://goreportcard.com/report/github.com/taigrr/elevenlabs)\n\nUnofficial [elevenlabs.io](https://beta.elevenlabs.io/) ([11.ai](http://11.ai)) voice synthesis client\n\nThis library is not affiliated with, nor associated with ElevenLabs in any way.\n\nElevenLabs' official api documentation, upon which this client has been\nderived, [can be found here](https://api.elevenlabs.io/docs).\n\n## Purpose\n\nThis go client provides an easy interface to create synthesized voices and\nmake TTS (text-to-speech) requests to elevenlabs.io\n\nAs a prerequisite, you must already have an account with elevenlabs.io.\nAfter creating your account, you can get your API key [from here](https://help.elevenlabs.io/hc/en-us/articles/14599447207697-How-to-authorize-yourself-using-your-xi-api-key-).\n\n## Test Program\n\nTo test out an example `say` program, run:\n\n`go install github.com/taigrr/elevenlabs/cmd/say@latest`\n\nSet the `XI_API_KEY` environment variable, and pipe it some text to give it a whirl!\n\n## Example Code\n\n### Text-to-Speech Example\n\nTo use this library, create a new client and send a TTS request to a voice.\nThe following code block illustrates how one might replicate the say/espeak\ncommand, using the streaming endpoint.\nI've opted to go with gopxl's beep package, but you can also save the file\nto an mp3 on-disk.\n\n```go\npackage main\n\nimport (\n        \"bufio\"\n        \"context\"\n        \"io\"\n        \"log\"\n        \"os\"\n        \"time\"\n\n        \"github.com/gopxl/beep/v2\"\n        \"github.com/gopxl/beep/v2/mp3\"\n        \"github.com/gopxl/beep/v2/speaker\"\n\n        \"github.com/taigrr/elevenlabs/client\"\n        \"github.com/taigrr/elevenlabs/client/types\"\n)\n\nfunc main() {\n        ctx := context.Background()\n        // load in an API key to create a client\n        client := client.New(os.Getenv(\"XI_API_KEY\"))\n        // fetch a list of voice IDs from elevenlabs\n        ids, err := client.GetVoiceIDs(ctx)\n        if err != nil {\n                panic(err)\n        }\n        // prepare a pipe for streaming audio directly to beep\n        pipeReader, pipeWriter := io.Pipe()\n        reader := bufio.NewReader(os.Stdin)\n        text, _ := reader.ReadString('\\n')\n        go func() {\n                // stream audio from elevenlabs using the first voice we found\n                err = client.TTSStream(ctx, pipeWriter, text, ids[0], types.SynthesisOptions{Stability: 0.75, SimilarityBoost: 0.75, Style: 0.0, UseSpeakerBoost: true})\n                if err != nil {\n                        panic(err)\n                }\n                pipeWriter.Close()\n        }()\n        // decode and prepare the streaming mp3 as it comes through\n        streamer, format, err := mp3.Decode(pipeReader)\n        if err != nil {\n                log.Fatal(err)\n        }\n        defer streamer.Close()\n        speaker.Init(format.SampleRate, format.SampleRate.N(time.Second/10))\n        done := make(chan bool)\n        // play the audio\n        speaker.Play(beep.Seq(streamer, beep.Callback(func() {\n                done \u003c- true\n        })))\n        \u003c-done\n}\n```\n\n### Sound Generation Example\n\nThe following example demonstrates how to generate sound effects using the Sound Generation API:\n\n```go\npackage main\n\nimport (\n        \"context\"\n        \"os\"\n\n        \"github.com/taigrr/elevenlabs/client\"\n)\n\nfunc main() {\n        ctx := context.Background()\n        // Create a new client with your API key\n        client := client.New(os.Getenv(\"XI_API_KEY\"))\n\n        // Generate a sound effect and save it to a file\n        f, err := os.Create(\"footsteps.mp3\")\n        if err != nil {\n                panic(err)\n        }\n        defer f.Close()\n\n        // Basic usage (using default duration and prompt influence)\n        err = client.SoundGenerationWriter(ctx, f, \"footsteps on wooden floor\", 0, 0)\n        if err != nil {\n                panic(err)\n        }\n\n        // Advanced usage with custom duration and prompt influence\n        audio, err := client.SoundGeneration(\n                ctx,\n                \"heavy rain on a tin roof\",\n                5.0,    // Set duration to 5 seconds\n                0.5,    // Set prompt influence to 0.5\n        )\n        if err != nil {\n                panic(err)\n        }\n        os.WriteFile(\"rain.mp3\", audio, 0644)\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftaigrr%2Felevenlabs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftaigrr%2Felevenlabs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftaigrr%2Felevenlabs/lists"}