{
  "schemaVersion": "1.0",
  "item": {
    "slug": "openai-tts-python",
    "name": "openai-tts-python",
    "source": "tencent",
    "type": "skill",
    "category": "开发工具",
    "sourceUrl": "https://clawhub.ai/merend/openai-tts-python",
    "canonicalUrl": "https://clawhub.ai/merend/openai-tts-python",
    "targetPlatform": "OpenClaw"
  },
  "install": {
    "downloadMode": "redirect",
    "downloadUrl": "/downloads/openai-tts-python",
    "sourceDownloadUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=openai-tts-python",
    "sourcePlatform": "tencent",
    "targetPlatform": "OpenClaw",
    "installMethod": "Manual import",
    "extraction": "Extract archive",
    "prerequisites": [
      "OpenClaw"
    ],
    "packageFormat": "ZIP package",
    "includedAssets": [
      "README.md",
      "skill.md",
      "openai_tts.py",
      "manifest.json"
    ],
    "primaryDoc": "SKILL.md",
    "quickSetup": [
      "Download the package from Yavira.",
      "Extract the archive and review SKILL.md first.",
      "Import or place the package into your OpenClaw setup."
    ],
    "agentAssist": {
      "summary": "Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.",
      "steps": [
        "Download the package from Yavira.",
        "Extract it into a folder your agent can access.",
        "Paste one of the prompts below and point your agent at the extracted folder."
      ],
      "prompts": [
        {
          "label": "New install",
          "body": "I downloaded a skill package from Yavira. Read SKILL.md from the extracted folder and install it by following the included instructions. Then review README.md for any prerequisites, environment setup, or post-install checks. Tell me what you changed and call out any manual steps you could not complete."
        },
        {
          "label": "Upgrade existing",
          "body": "I downloaded an updated skill package from Yavira. Read SKILL.md from the extracted folder, compare it with my current installation, and upgrade it while preserving any custom configuration unless the package docs explicitly say otherwise. Then review README.md for any prerequisites, environment setup, or post-install checks. Summarize what changed and any follow-up checks I should run."
        }
      ]
    },
    "sourceHealth": {
      "source": "tencent",
      "slug": "openai-tts-python",
      "status": "healthy",
      "reason": "direct_download_ok",
      "recommendedAction": "download",
      "checkedAt": "2026-05-12T09:54:01.943Z",
      "expiresAt": "2026-05-19T09:54:01.943Z",
      "httpStatus": 200,
      "finalUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=openai-tts-python",
      "contentType": "application/zip",
      "probeMethod": "head",
      "details": {
        "probeUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=openai-tts-python",
        "contentDisposition": "attachment; filename=\"openai-tts-python-1.0.1.zip\"",
        "redirectLocation": null,
        "bodySnippet": null,
        "slug": "openai-tts-python"
      },
      "scope": "item",
      "summary": "Item download looks usable.",
      "detail": "Yavira can redirect you to the upstream package for this item.",
      "primaryActionLabel": "Download for OpenClaw",
      "primaryActionHref": "/downloads/openai-tts-python"
    },
    "validation": {
      "installChecklist": [
        "Use the Yavira download entry.",
        "Review SKILL.md after the package is downloaded.",
        "Confirm the extracted package contains the expected setup assets."
      ],
      "postInstallChecks": [
        "Confirm the extracted package includes the expected docs or setup files.",
        "Validate the skill or prompts are available in your target agent workspace.",
        "Capture any manual follow-up steps the agent could not complete."
      ]
    },
    "downloadPageUrl": "https://openagent3.xyz/downloads/openai-tts-python",
    "agentPageUrl": "https://openagent3.xyz/skills/openai-tts-python/agent",
    "manifestUrl": "https://openagent3.xyz/skills/openai-tts-python/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/openai-tts-python/agent.md"
  },
  "agentAssist": {
    "summary": "Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.",
    "steps": [
      "Download the package from Yavira.",
      "Extract it into a folder your agent can access.",
      "Paste one of the prompts below and point your agent at the extracted folder."
    ],
    "prompts": [
      {
        "label": "New install",
        "body": "I downloaded a skill package from Yavira. Read SKILL.md from the extracted folder and install it by following the included instructions. Then review README.md for any prerequisites, environment setup, or post-install checks. Tell me what you changed and call out any manual steps you could not complete."
      },
      {
        "label": "Upgrade existing",
        "body": "I downloaded an updated skill package from Yavira. Read SKILL.md from the extracted folder, compare it with my current installation, and upgrade it while preserving any custom configuration unless the package docs explicitly say otherwise. Then review README.md for any prerequisites, environment setup, or post-install checks. Summarize what changed and any follow-up checks I should run."
      }
    ]
  },
  "documentation": {
    "source": "clawhub",
    "primaryDoc": "SKILL.md",
    "sections": [
      {
        "title": "OpenAI TTS",
        "body": "Text-to-speech conversion using OpenAI's TTS API for generating high-quality, natural-sounding audio from text."
      },
      {
        "title": "Features",
        "body": "6 different voice options (male/female)\nStandard and HD quality models\nAutomatic text chunking for long content (4096 char limit)\nMultiple output formats (mp3, opus, aac, flac)"
      },
      {
        "title": "Activation",
        "body": "This skill activates when the user:\n\nRequests audio/voice output: \"read this to me\", \"convert to audio\", \"generate speech\", \"make this an audio file\"\nUses keywords: \"tts\", \"openai tts\", \"text to speech\", \"voice\", \"audio\", \"podcast\"\nNeeds content spoken for accessibility, multitasking, or podcast creation\nSpecifies voice preferences: \"alloy\", \"echo\", \"fable\", \"onyx\", \"nova\", \"shimmer\"\nAsks to \"narrate\", \"speak\", or \"vocalize\" text"
      },
      {
        "title": "Requirements",
        "body": "OPENAI_API_KEY environment variable must be set\nPython 3.8+\nDependencies: openai, pydub (optional, for long text)"
      },
      {
        "title": "Voices",
        "body": "VoiceTypeDescriptionalloyNeutralBalanced, versatileechoMaleWarm, conversationalfableNeutralExpressive, storytellingonyxMaleDeep, authoritativenovaFemaleFriendly, upbeatshimmerFemaleClear, professional"
      },
      {
        "title": "Basic Usage",
        "body": "from openai import OpenAI\nimport os\n\nclient = OpenAI(api_key=os.getenv('OPENAI_API_KEY'))\n\nresponse = client.audio.speech.create(\n    model=\"tts-1\",      # or \"tts-1-hd\" for higher quality\n    voice=\"onyx\",       # choose from: alloy, echo, fable, onyx, nova, shimmer\n    input=\"Your text here\",\n    speed=1.0           # 0.25 to 4.0 (optional)\n)\n\nwith open(\"output.mp3\", \"wb\") as f:\n    for chunk in response.iter_bytes():\n        f.write(chunk)"
      },
      {
        "title": "Command Line",
        "body": "# Basic\npython -c \"\nfrom openai import OpenAI\nclient = OpenAI()\nresponse = client.audio.speech.create(model='tts-1', voice='onyx', input='Hello world')\nopen('output.mp3', 'wb').write(response.content)\n\""
      },
      {
        "title": "Long Text (Auto-chunking)",
        "body": "from openai import OpenAI\nfrom pydub import AudioSegment\nimport tempfile\nimport os\nimport re\n\nclient = OpenAI()\nMAX_CHARS = 4096\n\ndef split_text(text):\n    if len(text) <= MAX_CHARS:\n        return [text]\n\n    chunks = []\n    sentences = re.split(r'(?<=[.!?])\\s+', text)\n    current = ''\n\n    for sentence in sentences:\n        if len(current) + len(sentence) + 1 <= MAX_CHARS:\n            current += (' ' if current else '') + sentence\n        else:\n            if current:\n                chunks.append(current)\n            current = sentence\n\n    if current:\n        chunks.append(current)\n\n    return chunks\n\ndef generate_tts(text, output_path, voice='onyx', model='tts-1'):\n    chunks = split_text(text)\n\n    if len(chunks) == 1:\n        response = client.audio.speech.create(model=model, voice=voice, input=text)\n        with open(output_path, 'wb') as f:\n            f.write(response.content)\n    else:\n        segments = []\n        for chunk in chunks:\n            response = client.audio.speech.create(model=model, voice=voice, input=chunk)\n            with tempfile.NamedTemporaryFile(suffix='.mp3', delete=False) as tmp:\n                tmp.write(response.content)\n                segments.append(AudioSegment.from_mp3(tmp.name))\n                os.unlink(tmp.name)\n\n        combined = segments[0]\n        for seg in segments[1:]:\n            combined += seg\n        combined.export(output_path, format='mp3')\n\n    return output_path\n\n# Usage\ngenerate_tts(\"Your long text here...\", \"output.mp3\", voice=\"nova\")"
      },
      {
        "title": "Models",
        "body": "ModelQualitySpeedCosttts-1StandardFast$0.015/1K charstts-1-hdHigh DefinitionSlower$0.030/1K chars"
      },
      {
        "title": "Output Formats",
        "body": "Supported formats: mp3 (default), opus, aac, flac\n\nresponse = client.audio.speech.create(\n    model=\"tts-1\",\n    voice=\"onyx\",\n    input=\"Hello\",\n    response_format=\"opus\"  # or mp3, aac, flac\n)"
      },
      {
        "title": "Error Handling",
        "body": "from openai import OpenAI, APIError, RateLimitError\nimport time\n\nclient = OpenAI()\n\ndef generate_with_retry(text, voice='onyx', max_retries=3):\n    for attempt in range(max_retries):\n        try:\n            response = client.audio.speech.create(\n                model=\"tts-1\",\n                voice=voice,\n                input=text\n            )\n            return response.content\n        except RateLimitError:\n            if attempt < max_retries - 1:\n                time.sleep(2 ** attempt)  # Exponential backoff\n                continue\n            raise\n        except APIError as e:\n            print(f\"API Error: {e}\")\n            raise\n\n    return None"
      },
      {
        "title": "Convert Article to Podcast",
        "body": "def article_to_podcast(article_text, output_file):\n    intro = \"Welcome to today's article reading.\"\n    outro = \"Thank you for listening.\"\n\n    full_text = f\"{intro}\\n\\n{article_text}\\n\\n{outro}\"\n\n    generate_tts(full_text, output_file, voice='nova', model='tts-1-hd')\n    print(f\"Podcast saved to {output_file}\")"
      },
      {
        "title": "Batch Processing",
        "body": "def batch_tts(texts, output_dir, voice='onyx'):\n    import os\n    os.makedirs(output_dir, exist_ok=True)\n\n    for i, text in enumerate(texts):\n        output_path = os.path.join(output_dir, f\"audio_{i+1}.mp3\")\n        generate_tts(text, output_path, voice=voice)\n        print(f\"Generated: {output_path}\")"
      },
      {
        "title": "Links",
        "body": "OpenAI TTS Documentation\nOpenAI API Reference\nPricing"
      }
    ],
    "body": "OpenAI TTS\n\nText-to-speech conversion using OpenAI's TTS API for generating high-quality, natural-sounding audio from text.\n\nFeatures\n6 different voice options (male/female)\nStandard and HD quality models\nAutomatic text chunking for long content (4096 char limit)\nMultiple output formats (mp3, opus, aac, flac)\nActivation\n\nThis skill activates when the user:\n\nRequests audio/voice output: \"read this to me\", \"convert to audio\", \"generate speech\", \"make this an audio file\"\nUses keywords: \"tts\", \"openai tts\", \"text to speech\", \"voice\", \"audio\", \"podcast\"\nNeeds content spoken for accessibility, multitasking, or podcast creation\nSpecifies voice preferences: \"alloy\", \"echo\", \"fable\", \"onyx\", \"nova\", \"shimmer\"\nAsks to \"narrate\", \"speak\", or \"vocalize\" text\nRequirements\nOPENAI_API_KEY environment variable must be set\nPython 3.8+\nDependencies: openai, pydub (optional, for long text)\nVoices\nVoice\tType\tDescription\nalloy\tNeutral\tBalanced, versatile\necho\tMale\tWarm, conversational\nfable\tNeutral\tExpressive, storytelling\nonyx\tMale\tDeep, authoritative\nnova\tFemale\tFriendly, upbeat\nshimmer\tFemale\tClear, professional\nUsage\nBasic Usage\nfrom openai import OpenAI\nimport os\n\nclient = OpenAI(api_key=os.getenv('OPENAI_API_KEY'))\n\nresponse = client.audio.speech.create(\n    model=\"tts-1\",      # or \"tts-1-hd\" for higher quality\n    voice=\"onyx\",       # choose from: alloy, echo, fable, onyx, nova, shimmer\n    input=\"Your text here\",\n    speed=1.0           # 0.25 to 4.0 (optional)\n)\n\nwith open(\"output.mp3\", \"wb\") as f:\n    for chunk in response.iter_bytes():\n        f.write(chunk)\n\nCommand Line\n# Basic\npython -c \"\nfrom openai import OpenAI\nclient = OpenAI()\nresponse = client.audio.speech.create(model='tts-1', voice='onyx', input='Hello world')\nopen('output.mp3', 'wb').write(response.content)\n\"\n\nLong Text (Auto-chunking)\nfrom openai import OpenAI\nfrom pydub import AudioSegment\nimport tempfile\nimport os\nimport re\n\nclient = OpenAI()\nMAX_CHARS = 4096\n\ndef split_text(text):\n    if len(text) <= MAX_CHARS:\n        return [text]\n\n    chunks = []\n    sentences = re.split(r'(?<=[.!?])\\s+', text)\n    current = ''\n\n    for sentence in sentences:\n        if len(current) + len(sentence) + 1 <= MAX_CHARS:\n            current += (' ' if current else '') + sentence\n        else:\n            if current:\n                chunks.append(current)\n            current = sentence\n\n    if current:\n        chunks.append(current)\n\n    return chunks\n\ndef generate_tts(text, output_path, voice='onyx', model='tts-1'):\n    chunks = split_text(text)\n\n    if len(chunks) == 1:\n        response = client.audio.speech.create(model=model, voice=voice, input=text)\n        with open(output_path, 'wb') as f:\n            f.write(response.content)\n    else:\n        segments = []\n        for chunk in chunks:\n            response = client.audio.speech.create(model=model, voice=voice, input=chunk)\n            with tempfile.NamedTemporaryFile(suffix='.mp3', delete=False) as tmp:\n                tmp.write(response.content)\n                segments.append(AudioSegment.from_mp3(tmp.name))\n                os.unlink(tmp.name)\n\n        combined = segments[0]\n        for seg in segments[1:]:\n            combined += seg\n        combined.export(output_path, format='mp3')\n\n    return output_path\n\n# Usage\ngenerate_tts(\"Your long text here...\", \"output.mp3\", voice=\"nova\")\n\nModels\nModel\tQuality\tSpeed\tCost\ntts-1\tStandard\tFast\t$0.015/1K chars\ntts-1-hd\tHigh Definition\tSlower\t$0.030/1K chars\nOutput Formats\n\nSupported formats: mp3 (default), opus, aac, flac\n\nresponse = client.audio.speech.create(\n    model=\"tts-1\",\n    voice=\"onyx\",\n    input=\"Hello\",\n    response_format=\"opus\"  # or mp3, aac, flac\n)\n\nError Handling\nfrom openai import OpenAI, APIError, RateLimitError\nimport time\n\nclient = OpenAI()\n\ndef generate_with_retry(text, voice='onyx', max_retries=3):\n    for attempt in range(max_retries):\n        try:\n            response = client.audio.speech.create(\n                model=\"tts-1\",\n                voice=voice,\n                input=text\n            )\n            return response.content\n        except RateLimitError:\n            if attempt < max_retries - 1:\n                time.sleep(2 ** attempt)  # Exponential backoff\n                continue\n            raise\n        except APIError as e:\n            print(f\"API Error: {e}\")\n            raise\n\n    return None\n\nExamples\nConvert Article to Podcast\ndef article_to_podcast(article_text, output_file):\n    intro = \"Welcome to today's article reading.\"\n    outro = \"Thank you for listening.\"\n\n    full_text = f\"{intro}\\n\\n{article_text}\\n\\n{outro}\"\n\n    generate_tts(full_text, output_file, voice='nova', model='tts-1-hd')\n    print(f\"Podcast saved to {output_file}\")\n\nBatch Processing\ndef batch_tts(texts, output_dir, voice='onyx'):\n    import os\n    os.makedirs(output_dir, exist_ok=True)\n\n    for i, text in enumerate(texts):\n        output_path = os.path.join(output_dir, f\"audio_{i+1}.mp3\")\n        generate_tts(text, output_path, voice=voice)\n        print(f\"Generated: {output_path}\")\n\nLinks\nOpenAI TTS Documentation\nOpenAI API Reference\nPricing"
  },
  "trust": {
    "sourceLabel": "tencent",
    "provenanceUrl": "https://clawhub.ai/merend/openai-tts-python",
    "publisherUrl": "https://clawhub.ai/merend/openai-tts-python",
    "owner": "merend",
    "version": "1.0.1",
    "license": null,
    "verificationStatus": "Indexed source record"
  },
  "links": {
    "detailUrl": "https://openagent3.xyz/skills/openai-tts-python",
    "downloadUrl": "https://openagent3.xyz/downloads/openai-tts-python",
    "agentUrl": "https://openagent3.xyz/skills/openai-tts-python/agent",
    "manifestUrl": "https://openagent3.xyz/skills/openai-tts-python/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/openai-tts-python/agent.md"
  }
}