{"id":15433145,"url":"https://github.com/simonw/ospeak","last_synced_at":"2025-04-09T23:19:24.484Z","repository":{"id":205884474,"uuid":"715389408","full_name":"simonw/ospeak","owner":"simonw","description":"CLI tool for running text through OpenAI Text to speech","archived":false,"fork":false,"pushed_at":"2023-12-13T06:12:17.000Z","size":35,"stargazers_count":140,"open_issues_count":7,"forks_count":7,"subscribers_count":7,"default_branch":"main","last_synced_at":"2024-05-01T23:17:38.539Z","etag":null,"topics":["openai","openai-api","text-to-speech"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/simonw.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"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}},"created_at":"2023-11-07T03:23:30.000Z","updated_at":"2024-05-01T19:11:29.000Z","dependencies_parsed_at":"2023-11-07T04:05:44.023Z","dependency_job_id":"8a5ab2ae-9db0-4514-82df-9aed5eecd0b0","html_url":"https://github.com/simonw/ospeak","commit_stats":null,"previous_names":["simonw/ospeak"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonw%2Fospeak","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonw%2Fospeak/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonw%2Fospeak/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonw%2Fospeak/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/simonw","download_url":"https://codeload.github.com/simonw/ospeak/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248125793,"owners_count":21051803,"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":["openai","openai-api","text-to-speech"],"created_at":"2024-10-01T18:32:05.433Z","updated_at":"2025-04-09T23:19:24.455Z","avatar_url":"https://github.com/simonw.png","language":"Python","funding_links":[],"categories":["openai"],"sub_categories":[],"readme":"# ospeak\n\n[![PyPI](https://img.shields.io/pypi/v/ospeak.svg)](https://pypi.org/project/ospeak/)\n[![Changelog](https://img.shields.io/github/v/release/simonw/ospeak?include_prereleases\u0026label=changelog)](https://github.com/simonw/ospeak/releases)\n[![Tests](https://github.com/simonw/ospeak/workflows/Test/badge.svg)](https://github.com/simonw/ospeak/actions?query=workflow%3ATest)\n[![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://github.com/simonw/ospeak/blob/master/LICENSE)\n\nCLI tool for running text through the [OpenAI Text to speech](https://platform.openai.com/docs/guides/text-to-speech) API and speaking or saving the result\n\nSee [ospeak: a CLI tool for speaking text in the terminal via OpenAI](https://simonwillison.net/2023/Nov/7/ospeak/) for background on this project.\n\n## Installation\n\nInstall this tool using `pipx`:\n```bash\npipx install ospeak\n```\nNote, on MacOS there's a [broken dependency](https://github.com/simonw/ospeak/issues/4) with Python 3.12 so instead run:\n```bash \npipx install --python /path/to/python3.11 ospeak\n```\n\nThis tool also depends on `ffmpeg`. You can install that on macOS using [Homebrew](https://brew.sh/) like this:\n```bash\nbrew install ffmpeg\n```\nNote that `ospeak` has dependencies that are currently incompatible with [LLM](https://llm.datasette.io) (see [this issue](https://github.com/simonw/llm/issues/325)) so the two tools need to be installed in different virtual environments, hence the recommendation to use [pipx](https://pypa.github.io/pipx/).\n\n## Usage\n\nTo get your computer to say something, run:\n```bash\nospeak \"Hello there\"\n```\nYou will need an OpenAI API key. You can set that as an environment variable:\n```bash\nexport OPENAI_API_KEY=\"...\"\n```\nOr you can pass it using `--token`:\n```bash\nospeak --token \"...\" \"Hello there\"\n```\nYou can pipe content into the tool:\n```bash\necho \"Hello there\" | ospeak\n```\nUse `-v/--voice VOICE` to select a voice. The default is `alloy`. The other options are:\n\n- `echo`\n- `fable`\n- `onyx`\n- `nova`\n- `shimmer`\n\nYou can pass `-v all` to hear all of the voices, each with the name of the voice spoken first.\n```bash\nospeak \"This is my voice\" -v all\n```\nThe `-m/--model` option can be used to select a different model. The default is `tts-1`. Use `-m tts-1-hd` for a higher quality model that takes slightly longer to generate audio:\n```bash\nospeak \"This is higher quality\" -m tts-1-hd\n```\nTo adjust the speed, pass `-x/--speed` with a value between 0.25 and 4 (the default is 1.0):\n```bash\nospeak \"This is my fast voice\" -x 2\n```\nTo write the audio to a file, pass `-o/--output` with a filename ending in either `.mp3` or `.wav`:\n```bash\nospeak \"This is my voice\" -o voice.mp3\n```\nThis will not speak out loud. If you want it to also speak, add the `-s/--speak` option:\n```bash\nospeak \"This is my voice\" -o voice.mp3 -s\n```\n\n## ospeak --help\n\n\u003c!-- [[[cog\nimport cog\nfrom ospeak import cli\nfrom click.testing import CliRunner\nrunner = CliRunner()\nresult = runner.invoke(cli.cli, [\"--help\"])\nhelp = result.output.replace(\"Usage: cli\", \"Usage: ospeak\")\ncog.out(\n    \"```\\n{}\\n```\".format(help)\n)\n]]] --\u003e\n```\nUsage: ospeak [OPTIONS] [TEXT]\n\n  CLI tool for running text through OpenAI Text to speech\n\n  Set the OPENAI_API_KEY environment variable to your OpenAI API key to avoid\n  using the --token option every time.\n\n  Example usage:\n\n      ospeak \"Everyone deserves a pelican\" --voice alloy -x 1.5\n\nOptions:\n  --version                       Show the version and exit.\n  -v, --voice [alloy|echo|fable|onyx|nova|shimmer|all]\n                                  Voice to use\n  -m, --model TEXT                Model to use - defaults to tts-1\n  -o, --output FILE               Save audio to this file on disk\n  -x, --speed FLOAT RANGE         Speed of the voice  [0.25\u003c=x\u003c=4.0]\n  -s, --speak                     Speak the text even when saving to a file\n  --token TEXT                    OpenAI API key\n  --help                          Show this message and exit.\n\n```\n\u003c!-- [[[end]]] --\u003e\n\n## Development\n\nTo contribute to this tool, first checkout the code. Then create a new virtual environment:\n```bash\ncd ospeak\npython -m venv venv\nsource venv/bin/activate\n```\nNow install the dependencies and test dependencies:\n```bash\npip install -e '.[test]'\n```\nTo run the tests:\n```bash\npytest\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimonw%2Fospeak","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsimonw%2Fospeak","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimonw%2Fospeak/lists"}