Skip to main content

Uses Character AI for synthesis.

Project description

TulgaTTS

TulgaTTS - A library for synthesizing text-to-speech (TTS) with various popular voices in Kazakhstan.

Installation

# Via pip (in the future)

pip install tulgatts

# For audio playback (optional):

pip install -e .[audio]

Getting Started

  1. Obtain your token:

    • ⚠️ DO NOT SHARE YOUR TOKEN! It is required to send requests from your account.

    • Open link https://character.ai/chat/2WPyJRflV_4nTx6_-tuNrhkiiqhDyOsn9O25BR1sDO8

    • Open Developer Tools in your browser (usually F12).

    • Go to the Network tab.

    • Refresh the page or send a message to any character.

    • In the list of network requests, click on any request (for example, to /settings).

    How to find the Authorization Token

    • Go to the Headers section.

    • Find the Authorization header. It will look like:

      
      Authorization: Token <your_token_here>
      
      
    • Copy only the token part (after Token ).

    • Set the CHARACTER_AI_TOKEN environment variable or create a .env file in the project root and add CHARACTER_AI_TOKEN=your_copied_token.

  2. Use the library.

Usage Examples

You can use the library in several ways. For simple scripts, use the synchronous method; for async applications, use the async/await method.

1. The simplest usage

from tulgatts import TulgaTTS



# Create a client (default voice – Tokaev)

client = TulgaTTS(api_token="CHARACTER_AI_TOKEN", voice="Tokaev")



# 1. Speak with the default voice and save to file

client.say("This is an example created with this class")

2. Synchronous usage

import os

from tulgatts import TulgaTTS

from dotenv import load_dotenv



# Load token from .env

load_dotenv()

api_token = os.getenv("CHARACTER_AI_TOKEN")



def sync_say_usage():

    if not api_token:

        print("❌ No token!")

        return



    try:

        tts_client = TulgaTTS(api_token=api_token, voice='Tokaev')

        print(f"✅ Client ready with voice '{tts_client.voice}'.")



        tts_client.say("Synchronous example.", output_file="sync_example.mp3")

        print("🎧 File ready: sync_example.mp3")



    except Exception as e:

        print(f"⚠️ Error occurred: {e}")



if __name__ == "__main__":

    print("2. Synchronous example...")

    sync_say_usage()

    print("-" * 20)

3. Asynchronous usage

import os, asyncio

from tulgatts import TulgaTTS

from dotenv import load_dotenv



# Load token from .env

load_dotenv()

api_token = os.getenv("CHARACTER_AI_TOKEN")



async def advanced_async_say():

    if not api_token: return print("No token!")

    

    try:

        tts_client = TulgaTTS(api_token=api_token)

        print(f"Client ready with voice '{tts_client.voice}'.")

        await tts_client.say_async("Third example, part one.", voice="Tokaev", output_file="advanced_async1.mp3", play_audio=True)

    except Exception as e: print(f"Error: {e}")



if __name__ == "__main__":

    print("\n3. More advanced async example...")

    asyncio.run(advanced_async_say())

    print("All examples completed.")

Available Voices

The library comes with the following pre-configured voices:

  • Nursultan Nazarbaev

  • Tokaev

  • Pavel Durov

  • Nurlan Saburov

  • Putin

  • Skriptonit

  • Elon Musk

  • Albert E

  • Yandex Alica

  • J.A.R.V.I.S

  • Tony Stark

Note: Sometimes TulgaTTS may not synthesize your expected text. This issue is being worked on.

Special thanks to PyCharacterAI for enabling TTS with Character AI voices.

Authors

  • David Suragan (TulgaTTS)

  • Gemini AI

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tulgatts-0.1.3.tar.gz (9.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tulgatts-0.1.3-py3-none-any.whl (8.4 kB view details)

Uploaded Python 3

File details

Details for the file tulgatts-0.1.3.tar.gz.

File metadata

  • Download URL: tulgatts-0.1.3.tar.gz
  • Upload date:
  • Size: 9.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.4

File hashes

Hashes for tulgatts-0.1.3.tar.gz
Algorithm Hash digest
SHA256 2c17a9b933db081e020a3734fe4d27d9032a8b3a503f9e544e069a07a5976a25
MD5 1dbc2e91aa4c26c74902fd67d1d4b3ca
BLAKE2b-256 48ee5b52059f7fe5c06ebf35732736f475c24527907bcccb98019be3923a4c32

See more details on using hashes here.

File details

Details for the file tulgatts-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: tulgatts-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 8.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.4

File hashes

Hashes for tulgatts-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 a1221dc5e8be76806cb17609a2120947a22c46b1d1852505b8457a26bb571f06
MD5 3feb77ce5d9f0b3cafb3022570896944
BLAKE2b-256 db7cfef31c7baae620049d30c45cde062ee39f8899c88815011dbe9c2dbc7e2c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page