Skip to main content

Tinkoff Python VoiceKit API Library

Downloads Maintainability Build

Usage

Install from PyPi

pip install tinkoff-voicekit-ai

Common

Before using you must have API_KEY and SECRET_KEY. You can get the keys by leaving a request on our website.

Documentation

Type schema

Examples of using VoiceKit client:

Call documentation for public methods

from tinkoff_voicekit_ai import ClientSTT

API_KEY = "my_api_key"
SECRET_KEY = "my_secret_key"

client = ClientSTT(API_KEY, SECRET_KEY)

client.something_method.__doc__

Methods initialize using config (Python dict) which satisfies one of the next json schema.

Recogniton (STT)

Example of using STT
  • recognize
from tinkoff_voicekit_ai import ClientSTT

API_KEY = "my_api_key"
SECRET_KEY = "my_secret_key"

client = ClientSTT(API_KEY, SECRET_KEY)

audio_config = {
    "encoding": "LINEAR16",
    "sample_rate_hertz": 8000,
    "num_channels": 1
}

# recognise method call
response = client.recognize("path/to/audio/file", audio_config)
print(response)
  • streaming recognize
from tinkoff_voicekit_ai import ClientSTT

API_KEY = "my_api_key"
SECRET_KEY = "my_secret_key"

client = ClientSTT(API_KEY, SECRET_KEY)

audio_config = {
    "encoding": "LINEAR16",
    "sample_rate_hertz": 8000,
    "num_channels": 1
}
stream_config = {"config": audio_config}

# recognise stream method call
with open("path/to/audio/file", "rb") as source:
    responses = client.streaming_recognize(source, stream_config)
    for response in responses:
        print(response)
  • long running recognize with uploader
from tinkoff_voicekit_ai import ClientSTT

API_KEY = "my_api_key"
SECRET_KEY = "my_secret_key"

client = ClientSTT(API_KEY, SECRET_KEY)

audio_config = {
    "encoding": "LINEAR16",
    "sample_rate_hertz": 8000,
    "num_channels": 1
}

request = {
    "config": audio_config,
    "group": "group_name"
}

file_path = "path/to/file"
audio_name_for_storage = "pretty name"

# this method automatically upload audio to long running storage and return uri
print(client.longrunning_recognize_with_uploader(file_path, request, audio_name_for_storage))

Example of Voice Activity Detection configuration

vad = {}
vad["min_speech_duration"] = min_speech_duration
vad["max_speech_duration"] = max_speech_duration
vad["silence_duration_threshold"] = silence_duration_threshold
vad["silence_prob_threshold"] = silence_prob_threshold
vad["aggressiveness"] = aggressiveness

my_config = {}
my_config["vad"] = vad

Synthesize (TTS)

Example of input file:

Я жду вашего ответа. Вы готовы сделать перевод?
# Давайте уточним получателя. Как его зовут?

commented lines # will not be synthesis

Example of using TTS
  • default
from tinkoff_voicekit_ai import ClientTTS

API_KEY = "api_key"
SECRET_KEY = "secret_key"

client = ClientTTS(API_KEY, SECRET_KEY)
audio_config = {
    "audio_encoding": "LINEAR16",
    "sample_rate_hertz": 48000
}


# use it if you want work with proto results
# audio file
rows_responses = client.streaming_synthesize("path/to/file/with/text", audio_config)
# text
rows_responses = client.streaming_synthesize("Мой красивый текст", audio_config)

# use it if you want get audio file results
# audio file
client.synthesize_to_audio_wav("path/to/file/with/text", audio_config, "output/dir")
# text
client.synthesize_to_audio_wav("Мой красивый текст", audio_config, "output/dir")
# ssml. There are only tag <speak>
client.synthesize_to_audio_wav("<speak>Мой красивый текст</speak>", audio_config, "output/dir", ssml=True)
  • change voice
from tinkoff_voicekit_ai import ClientTTS

API_KEY = "api_key"
SECRET_KEY = "secret_key"

client = ClientTTS(API_KEY, SECRET_KEY)
config = {
        "audio_encoding": "RAW_OPUS",
        "sample_rate_hertz": 48000,
        "voice": {"name": "alyona"}
    }
client.synthesize_to_audio_wav("Приве! Меня зовут Алена.", config)

Example of using Operations

  • get operation by id
from tinkoff_voicekit_ai import ClientOperations
API_KEY = "my_api_key"
SECRET_KEY = "my_secret_key"

operations = ClientOperations(API_KEY, SECRET_KEY)

running_operation_id = "42"

print(operations.get_operation({"id": running_operation_id}))
  • cancel operation by id
from tinkoff_voicekit_ai import ClientOperations
API_KEY = "my_api_key"
SECRET_KEY = "my_secret_key"

operations = ClientOperations(API_KEY, SECRET_KEY)
operation_filter = {"exact_id": "31"}

# return empty dict on success
print(operations.cancel_operation(operation_filter))

Example of using Uploader

from tinkoff_voicekit_ai import Uploader
API_KEY = "my_api_key"
SECRET_KEY = "my_secret_key"

uploader = Uploader(API_KEY, SECRET_KEY)
path = "path/to/file"

print(uploader.upload(path, "object_name"))

Metadata

Release files for tinkoff-voicekit-ai 0.3.3.post1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tinkoff-voicekit-ai 0.3.3.post1
File Size Uploaded Provenance Actions
tinkoff_voicekit_ai-0.3.3.post1.tar.gz 1.2 MB Without provenance Details for tinkoff_voicekit_ai-0.3.3.post1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for tinkoff-voicekit-ai 0.3.3.post1
File Interpreter ABI Platform Actions
tinkoff_voicekit_ai-0.3.3.post1-py3-none-any.whl Python 3 none any Details for tinkoff_voicekit_ai-0.3.3.post1-py3-none-any.whl

Total release size: 2.4 MB

Release files / tinkoff_voicekit_ai-0.3.3.post1.tar.gz

Download URL tinkoff_voicekit_ai-0.3.3.post1.tar.gz
Size 1.2 MB
Tags Source
SHA-256 checksum
How to use checksums
ce16e75cc7dfa217f0624cff303bb1486df1046b4bdbf06cfd7d3a7f2c483724
BLAKE2b-256 checksum
How to use checksums
b59b1c4ebd2f590264ff849b93ce12029c0fd0cd1d834ed5ac90191e191a4df9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.4

Release files / tinkoff_voicekit_ai-0.3.3.post1-py3-none-any.whl

Download URL tinkoff_voicekit_ai-0.3.3.post1-py3-none-any.whl
Size 1.2 MB
Tags Python 3
SHA-256 checksum
How to use checksums
caab8947ee3de8f4f9da5a510834fedc2783e17b033bc0621404587434527162
BLAKE2b-256 checksum
How to use checksums
92336108d7e1bb3042b2c122989de99d132e97dfec5521bdd0d8eee1d6dc3e2f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.4

Security for tinkoff-voicekit-ai 0.3.3.post1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.3.3.post1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page