runapi-gemini-tts 0.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,24 @@
1
+ """Gemini TTS client for RunAPI."""
2
+
3
+ from runapi.core import (
4
+ AuthenticationError,
5
+ InsufficientCreditsError,
6
+ NotFoundError,
7
+ RateLimitError,
8
+ TaskFailedError,
9
+ TaskTimeoutError,
10
+ ValidationError,
11
+ )
12
+
13
+ from .client import GeminiTtsClient
14
+
15
+ __all__ = [
16
+ "GeminiTtsClient",
17
+ "AuthenticationError",
18
+ "RateLimitError",
19
+ "InsufficientCreditsError",
20
+ "NotFoundError",
21
+ "ValidationError",
22
+ "TaskFailedError",
23
+ "TaskTimeoutError",
24
+ ]
@@ -0,0 +1,19 @@
1
+ """Gemini TTS client."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import Any, Optional
6
+
7
+ from runapi.core import ClientOptions, HttpClient, resolve_api_key
8
+
9
+ from .resources.text_to_speech import TextToSpeech
10
+
11
+
12
+ class GeminiTtsClient:
13
+ """Client for multi-speaker Gemini TTS generation."""
14
+
15
+ def __init__(self, api_key: Optional[str] = None, **options: Any) -> None:
16
+ resolved_api_key = resolve_api_key(api_key)
17
+ client_options = ClientOptions(api_key=resolved_api_key, **options)
18
+ http = client_options.http_client or HttpClient(client_options)
19
+ self.text_to_speech = TextToSpeech(http)
@@ -0,0 +1,37 @@
1
+ CONTRACT = {
2
+ "text-to-speech": {
3
+ "models": ["gemini-2.5-pro-tts", "gemini-3.1-flash-tts"],
4
+ "fields_by_model": {
5
+ "gemini-2.5-pro-tts": {
6
+ "dialogue_turns": {
7
+ "required": True
8
+ },
9
+ "model": {
10
+ "required": True
11
+ },
12
+ "speakers": {
13
+ "required": True
14
+ },
15
+ "temperature": {
16
+ "min": 0,
17
+ "max": 2
18
+ }
19
+ },
20
+ "gemini-3.1-flash-tts": {
21
+ "dialogue_turns": {
22
+ "required": True
23
+ },
24
+ "model": {
25
+ "required": True
26
+ },
27
+ "speakers": {
28
+ "required": True
29
+ },
30
+ "temperature": {
31
+ "min": 0,
32
+ "max": 2
33
+ }
34
+ }
35
+ }
36
+ }
37
+ }
@@ -0,0 +1 @@
1
+
@@ -0,0 +1,5 @@
1
+ """Gemini TTS resources."""
2
+
3
+ from .text_to_speech import TextToSpeech
4
+
5
+ __all__ = ["TextToSpeech"]
@@ -0,0 +1,30 @@
1
+ """Gemini TTS text-to-speech resource."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import Any, Optional
6
+
7
+ from runapi.core import Resource, RequestOptions
8
+
9
+ from ..contract_gen import CONTRACT
10
+ from ..types import AudioTaskResponse, CompletedAudioTaskResponse
11
+
12
+
13
+ class TextToSpeech(Resource):
14
+ """Generate multi-speaker speech from ordered dialogue turns."""
15
+
16
+ ENDPOINT = "/api/v1/gemini_tts/text_to_speech"
17
+ RESPONSE_CLASS = AudioTaskResponse
18
+ COMPLETED_RESPONSE_CLASS = CompletedAudioTaskResponse
19
+
20
+ def run(self, options: Optional[RequestOptions] = None, **params: Any) -> Any:
21
+ task = self.create(options=options, **params)
22
+ return self._poll_until_complete(lambda: self.get(task.id, options=options))
23
+
24
+ def create(self, options: Optional[RequestOptions] = None, **params: Any) -> Any:
25
+ compacted = self._compact_params(params)
26
+ self._validate_contract(CONTRACT["text-to-speech"], compacted)
27
+ return self._request("post", self.ENDPOINT, body=compacted, options=options)
28
+
29
+ def get(self, id: str, options: Optional[RequestOptions] = None) -> Any:
30
+ return self._request("get", f"{self.ENDPOINT}/{id}", options=options)
@@ -0,0 +1,18 @@
1
+ """Gemini TTS response models."""
2
+
3
+ from runapi.core import BaseModel, TaskResponse, optional, required
4
+
5
+
6
+ class Audio(BaseModel):
7
+ url = required(str)
8
+
9
+
10
+ class AudioTaskResponse(TaskResponse):
11
+ id = required(str)
12
+ status = optional(str, enum=lambda: TaskResponse.Status.ALL)
13
+ audios = optional([lambda: Audio])
14
+ error = optional(str)
15
+
16
+
17
+ class CompletedAudioTaskResponse(AudioTaskResponse):
18
+ audios = required([lambda: Audio])
@@ -0,0 +1,37 @@
1
+ Metadata-Version: 2.4
2
+ Name: runapi-gemini-tts
3
+ Version: 0.1.0
4
+ Summary: RunAPI Gemini TTS SDK for multi-speaker speech generation in JavaScript, Python, Ruby, Go, Java, and PHP
5
+ Project-URL: Homepage, https://runapi.ai/models/gemini-tts
6
+ Project-URL: Documentation, https://runapi.ai/docs#sdk-gemini-tts
7
+ Project-URL: Source, https://github.com/runapi-ai/gemini-tts-sdk
8
+ Project-URL: Issues, https://github.com/runapi-ai/gemini-tts-sdk/issues
9
+ Project-URL: Changelog, https://github.com/runapi-ai/gemini-tts-sdk/blob/main/CHANGELOG.md
10
+ Project-URL: Release Notes, https://github.com/runapi-ai/gemini-tts-sdk/releases/tag/python%2Fv0.1.0
11
+ Author-email: RunAPI <contact@runapi.ai>
12
+ License-Expression: Apache-2.0
13
+ Keywords: api,audio,gemini,gemini-tts,golang,google,gradle,java,maven,python,ruby,runapi,runapi-ai,sdk,speech,text-to-speech,typescript
14
+ Requires-Python: >=3.9
15
+ Requires-Dist: runapi-core>=0.2.0
16
+ Description-Content-Type: text/markdown
17
+
18
+ # Gemini TTS Python SDK for RunAPI
19
+
20
+ Install `runapi-gemini-tts` for keyword-based multi-speaker speech requests and normalized task responses.
21
+
22
+ ```bash
23
+ pip install runapi-gemini-tts
24
+ ```
25
+
26
+ ```python
27
+ from runapi.gemini_tts import GeminiTtsClient
28
+
29
+ client = GeminiTtsClient()
30
+ result = client.text_to_speech.run(
31
+ model="gemini-2.5-pro-tts",
32
+ speakers=[{"speaker_id": "Speaker 1", "voice_name": "Fenrir", "accent": "British (RP)", "style": "Deadpan", "pace": "Natural"}],
33
+ dialogue_turns=[{"speaker_id": "Speaker 1", "text": "Welcome."}],
34
+ )
35
+ ```
36
+
37
+ See the [model page](https://runapi.ai/models/gemini-tts) and [API reference](https://runapi.ai/docs#gemini-tts). Licensed under Apache-2.0.
@@ -0,0 +1,10 @@
1
+ runapi/gemini_tts/__init__.py,sha256=UdIgpEmtTFiweJRJ02gexliD9feJlmekt6_LqW85Duo,470
2
+ runapi/gemini_tts/client.py,sha256=T513Uij_xBY8Uw7kTJ1es1RbSn7x8xNpcU0gkr6aifk,627
3
+ runapi/gemini_tts/contract_gen.py,sha256=bRt0Mm005d4wGHA1ma-NiHQG9pbZfMZqG0grvgFFgMs,995
4
+ runapi/gemini_tts/py.typed,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
5
+ runapi/gemini_tts/types.py,sha256=nTrIzoPmCfZ9jGT-AaNaRUyI-G85KCW4eqSGAqqahKI,441
6
+ runapi/gemini_tts/resources/__init__.py,sha256=eFjJmnfjqYswRAGaMqTlkffXmEcxk2oGhHHgAFC0JCU,98
7
+ runapi/gemini_tts/resources/text_to_speech.py,sha256=esJdsIbtXIVSYCGyzjyWH6JoWEKHr6z5JzFkI4KHRPk,1186
8
+ runapi_gemini_tts-0.1.0.dist-info/METADATA,sha256=y9cIYhcPLgca_byZZEI9Z24k3oF_TRJbl6ASh_yAbu4,1625
9
+ runapi_gemini_tts-0.1.0.dist-info/WHEEL,sha256=lCkmxWfQsSc9CfIClYeavTdQeEX2toPqufh9gI35EQA,87
10
+ runapi_gemini_tts-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.31.0
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any