runapi-fish-audio 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,20 @@
1
+ """Fish Audio client for RunAPI."""
2
+
3
+ from runapi.core import (
4
+ AuthenticationError,
5
+ InsufficientCreditsError,
6
+ NotFoundError,
7
+ RateLimitError,
8
+ ValidationError,
9
+ )
10
+
11
+ from .client import FishAudioClient
12
+
13
+ __all__ = [
14
+ "FishAudioClient",
15
+ "AuthenticationError",
16
+ "RateLimitError",
17
+ "InsufficientCreditsError",
18
+ "NotFoundError",
19
+ "ValidationError",
20
+ ]
@@ -0,0 +1,19 @@
1
+ """Fish Audio 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 FishAudioClient:
13
+ """Fish Audio speech generation client."""
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,17 @@
1
+ CONTRACT = {
2
+ "text-to-speech": {
3
+ "models": ["s1", "s2-pro"],
4
+ "fields_by_model": {
5
+ "s1": {
6
+ "text": {
7
+ "required": True
8
+ }
9
+ },
10
+ "s2-pro": {
11
+ "text": {
12
+ "required": True
13
+ }
14
+ }
15
+ }
16
+ }
17
+ }
@@ -0,0 +1 @@
1
+
@@ -0,0 +1,3 @@
1
+ from .text_to_speech import TextToSpeech
2
+
3
+ __all__ = ["TextToSpeech"]
@@ -0,0 +1,22 @@
1
+ """Fish Audio text-to-speech resource."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import Any, Optional
6
+
7
+ from runapi.core import RequestOptions, Resource
8
+
9
+ from ..contract_gen import CONTRACT
10
+ from ..types import TextToSpeechResponse
11
+
12
+
13
+ class TextToSpeech(Resource):
14
+ """Generate a RunAPI-managed MP3 from text."""
15
+
16
+ ENDPOINT = "/api/v1/fish_audio/text_to_speech"
17
+ RESPONSE_CLASS = TextToSpeechResponse
18
+
19
+ def run(self, options: Optional[RequestOptions] = None, **params: Any) -> Any:
20
+ compacted = self._compact_params(params)
21
+ self._validate_contract(CONTRACT["text-to-speech"], compacted)
22
+ return self._request("post", self.ENDPOINT, body=compacted, options=options)
@@ -0,0 +1,21 @@
1
+ """Fish Audio response models."""
2
+
3
+ from runapi.core import BaseModel, optional, required
4
+
5
+
6
+ class Audio(BaseModel):
7
+ """A RunAPI-managed MP3 audio result."""
8
+
9
+ url = required(str)
10
+ format = required(str)
11
+ mime_type = required(str)
12
+ size_bytes = required(int)
13
+
14
+
15
+ class TextToSpeechResponse(BaseModel):
16
+ """Completed synchronous text-to-speech response."""
17
+
18
+ id = required(str)
19
+ status = required(str)
20
+ audios = required([lambda: Audio])
21
+ error = optional(str)
@@ -0,0 +1,24 @@
1
+ Metadata-Version: 2.4
2
+ Name: runapi-fish-audio
3
+ Version: 0.1.0
4
+ Summary: RunAPI Fish Audio SDK for speech generation in JavaScript, Python, Ruby, Go, Java, and PHP
5
+ Project-URL: Homepage, https://runapi.ai/models/fish-audio
6
+ Project-URL: Documentation, https://runapi.ai/docs#sdk-fish-audio
7
+ Project-URL: Source, https://github.com/runapi-ai/fish-audio-sdk
8
+ Project-URL: Issues, https://github.com/runapi-ai/fish-audio-sdk/issues
9
+ Project-URL: Changelog, https://github.com/runapi-ai/fish-audio-sdk/blob/main/CHANGELOG.md
10
+ Project-URL: Release Notes, https://github.com/runapi-ai/fish-audio-sdk/releases/tag/python%2Fv0.1.0
11
+ Author-email: RunAPI <contact@runapi.ai>
12
+ License-Expression: Apache-2.0
13
+ Keywords: api,audio,fish-audio,golang,java,maven,python,ruby,runapi,runapi-ai,sdk,speech,tts,typescript
14
+ Requires-Python: >=3.9
15
+ Requires-Dist: runapi-core>=0.2.0
16
+ Description-Content-Type: text/markdown
17
+
18
+ # Fish Audio Python SDK for RunAPI
19
+
20
+ Install `runapi-fish-audio`, create `FishAudioClient`, and call `client.text_to_speech.run(model="s1", text="Hello")`.
21
+
22
+ Model details and pricing: https://runapi.ai/models/fish-audio
23
+
24
+ Licensed under the Apache License, Version 2.0.
@@ -0,0 +1,10 @@
1
+ runapi/fish_audio/__init__.py,sha256=-1wu8gKfwPFUWnvN-HqIhha62WapuAVLGsKy9OqSGbA,380
2
+ runapi/fish_audio/client.py,sha256=X3zmdnzSAuPJWG1rVHD5ps2tqfSsNZRHezAPlULCqGE,616
3
+ runapi/fish_audio/contract_gen.py,sha256=T1AGcs-h9DcwuRkSCPaAUOwNwNXxagkVUHJxmThiFJY,355
4
+ runapi/fish_audio/py.typed,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
5
+ runapi/fish_audio/types.py,sha256=7GIs7C2doiVOW3xIPqLaexTDAmmZs72xcE-R0h_86Mo,487
6
+ runapi/fish_audio/resources/__init__.py,sha256=bczVtxXHUSgrmrGiJJSLXkndCOgIL6h4yj7-BcZm5DU,69
7
+ runapi/fish_audio/resources/text_to_speech.py,sha256=9KbDnpXHlL3qwY0hl-ZqKR0gIf3XP1xvkyHI08pXOd8,706
8
+ runapi_fish_audio-0.1.0.dist-info/METADATA,sha256=qbopJG23iA7bXfwB8VSikdj8fXmxTRQgR-JaQc1qwLk,1157
9
+ runapi_fish_audio-0.1.0.dist-info/WHEEL,sha256=lCkmxWfQsSc9CfIClYeavTdQeEX2toPqufh9gI35EQA,87
10
+ runapi_fish_audio-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