pipecat-deapi 0.1.0__tar.gz
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.
- pipecat_deapi-0.1.0/.gitignore +9 -0
- pipecat_deapi-0.1.0/CHANGELOG.md +10 -0
- pipecat_deapi-0.1.0/LICENSE +24 -0
- pipecat_deapi-0.1.0/PKG-INFO +175 -0
- pipecat_deapi-0.1.0/README.md +148 -0
- pipecat_deapi-0.1.0/demo/record_demo.py +338 -0
- pipecat_deapi-0.1.0/demo/render_video.py +216 -0
- pipecat_deapi-0.1.0/examples/voice_agent.py +129 -0
- pipecat_deapi-0.1.0/pyproject.toml +47 -0
- pipecat_deapi-0.1.0/src/pipecat_deapi/__init__.py +21 -0
- pipecat_deapi-0.1.0/src/pipecat_deapi/llm.py +100 -0
- pipecat_deapi-0.1.0/src/pipecat_deapi/stt.py +174 -0
- pipecat_deapi-0.1.0/src/pipecat_deapi/tts.py +199 -0
- pipecat_deapi-0.1.0/tests/hello.wav +0 -0
- pipecat_deapi-0.1.0/tests/test_services.py +148 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.1.0
|
|
4
|
+
|
|
5
|
+
- `DeAPILLMService`: deAPI chat models through the OpenAI-compatible API, with a
|
|
6
|
+
`reasoning_effort` setting that defaults to `"none"`.
|
|
7
|
+
- `DeAPISTTService`: speech-to-text on deAPI's synchronous transcription endpoint
|
|
8
|
+
(`FluidSpeechPro`), one transcript per speech segment, automatic language detection.
|
|
9
|
+
- `DeAPITTSService`: text-to-speech on deAPI's speech endpoint (`Kokoro` by default), with
|
|
10
|
+
`speed`, `instructions` and `language` settings.
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
BSD 2-Clause License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026, deAPI Inc.
|
|
4
|
+
|
|
5
|
+
Redistribution and use in source and binary forms, with or without
|
|
6
|
+
modification, are permitted provided that the following conditions are met:
|
|
7
|
+
|
|
8
|
+
1. Redistributions of source code must retain the above copyright notice, this
|
|
9
|
+
list of conditions and the following disclaimer.
|
|
10
|
+
|
|
11
|
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
12
|
+
this list of conditions and the following disclaimer in the documentation
|
|
13
|
+
and/or other materials provided with the distribution.
|
|
14
|
+
|
|
15
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
16
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
17
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
18
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
19
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
20
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
21
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
22
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
23
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
24
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: pipecat-deapi
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: deAPI services for Pipecat: LLM, speech-to-text and text-to-speech
|
|
5
|
+
Project-URL: Homepage, https://deapi.ai
|
|
6
|
+
Project-URL: Documentation, https://docs.deapi.ai
|
|
7
|
+
Project-URL: Source, https://github.com/deapi-ai/pipecat-deapi
|
|
8
|
+
Author-email: "deAPI Inc." <support@deapi.ai>
|
|
9
|
+
License-Expression: BSD-2-Clause
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Keywords: ai,deapi,llm,pipecat,speech-to-text,text-to-speech,voice
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Topic :: Multimedia :: Sound/Audio :: Speech
|
|
16
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
17
|
+
Requires-Python: >=3.11
|
|
18
|
+
Requires-Dist: aiohttp<4,>=3.9
|
|
19
|
+
Requires-Dist: pipecat-ai<2,>=1.0.0
|
|
20
|
+
Requires-Dist: soundfile>=0.13
|
|
21
|
+
Provides-Extra: dev
|
|
22
|
+
Requires-Dist: build; extra == 'dev'
|
|
23
|
+
Requires-Dist: pytest-asyncio>=0.23; extra == 'dev'
|
|
24
|
+
Requires-Dist: pytest>=8; extra == 'dev'
|
|
25
|
+
Requires-Dist: ruff>=0.6; extra == 'dev'
|
|
26
|
+
Description-Content-Type: text/markdown
|
|
27
|
+
|
|
28
|
+
# pipecat-deapi
|
|
29
|
+
|
|
30
|
+
[deAPI](https://deapi.ai) services for [Pipecat](https://github.com/pipecat-ai/pipecat):
|
|
31
|
+
|
|
32
|
+
- **`DeAPILLMService`**: chat models served through deAPI's OpenAI-compatible API, with
|
|
33
|
+
streaming and tool calling.
|
|
34
|
+
- **`DeAPISTTService`**: speech-to-text on deAPI's synchronous transcription endpoint. The
|
|
35
|
+
transcript comes back in the same response, with automatic language detection.
|
|
36
|
+
- **`DeAPITTSService`**: text-to-speech with deAPI's voices (Kokoro and others).
|
|
37
|
+
|
|
38
|
+

|
|
39
|
+
|
|
40
|
+
The clip above is a real-time recording of the pipeline in [`demo/`](https://github.com/deapi-ai/pipecat-deapi/tree/main/demo): a scripted user
|
|
41
|
+
asks a question, the agent calls a function and answers, then gets interrupted mid-story.
|
|
42
|
+
The full video with sound is [`demo/demo.mp4`](https://github.com/deapi-ai/pipecat-deapi/blob/main/demo/demo.mp4).
|
|
43
|
+
|
|
44
|
+
This integration is maintained by deAPI Inc., the company that runs the deAPI service.
|
|
45
|
+
|
|
46
|
+
## Installation
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
pip install pipecat-deapi
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
or `uv add pipecat-deapi`.
|
|
53
|
+
|
|
54
|
+
You also need a deAPI API key. Create one in the
|
|
55
|
+
[deAPI panel](https://app.deapi.ai/settings/api-keys) and set it as `DEAPI_API_KEY`.
|
|
56
|
+
|
|
57
|
+
## Usage
|
|
58
|
+
|
|
59
|
+
All three services take the same key and drop into a Pipecat pipeline like any other service:
|
|
60
|
+
|
|
61
|
+
```python
|
|
62
|
+
import os
|
|
63
|
+
|
|
64
|
+
from pipecat.pipeline.pipeline import Pipeline
|
|
65
|
+
from pipecat_deapi import DeAPILLMService, DeAPISTTService, DeAPITTSService
|
|
66
|
+
|
|
67
|
+
stt = DeAPISTTService(api_key=os.environ["DEAPI_API_KEY"])
|
|
68
|
+
|
|
69
|
+
llm = DeAPILLMService(
|
|
70
|
+
api_key=os.environ["DEAPI_API_KEY"],
|
|
71
|
+
settings=DeAPILLMService.Settings(
|
|
72
|
+
model="qwen3.8-flash",
|
|
73
|
+
system_instruction="You are a helpful assistant in a voice conversation.",
|
|
74
|
+
),
|
|
75
|
+
)
|
|
76
|
+
|
|
77
|
+
tts = DeAPITTSService(
|
|
78
|
+
api_key=os.environ["DEAPI_API_KEY"],
|
|
79
|
+
settings=DeAPITTSService.Settings(voice="af_nova"),
|
|
80
|
+
)
|
|
81
|
+
|
|
82
|
+
pipeline = Pipeline(
|
|
83
|
+
[
|
|
84
|
+
transport.input(),
|
|
85
|
+
stt,
|
|
86
|
+
user_aggregator,
|
|
87
|
+
llm,
|
|
88
|
+
tts,
|
|
89
|
+
transport.output(),
|
|
90
|
+
assistant_aggregator,
|
|
91
|
+
]
|
|
92
|
+
)
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### LLM
|
|
96
|
+
|
|
97
|
+
| Setting | Default | Notes |
|
|
98
|
+
| - | - | - |
|
|
99
|
+
| `model` | `qwen3.8-flash` | Any chat model from `GET https://oai.deapi.ai/v1/models` |
|
|
100
|
+
| `reasoning_effort` | `"none"` | `none`, `minimal`, `low`, `medium`, `high`, `xhigh`, `max`, or `None` for the model's own default |
|
|
101
|
+
|
|
102
|
+
deAPI's chat models reason before they answer, and that pass runs before the first spoken
|
|
103
|
+
token. The service therefore turns reasoning off by default. Raise `reasoning_effort` when the
|
|
104
|
+
task needs working out:
|
|
105
|
+
|
|
106
|
+
```python
|
|
107
|
+
llm = DeAPILLMService(
|
|
108
|
+
api_key=os.environ["DEAPI_API_KEY"],
|
|
109
|
+
settings=DeAPILLMService.Settings(model="qwen3.8-max", reasoning_effort="low"),
|
|
110
|
+
)
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
Not every model accepts every value. `glm-5.3` takes only `low`, `high` and `max`, so set one
|
|
114
|
+
of those when you use it; `gpt-6-luna` does not take `minimal`. The API rejects an unsupported
|
|
115
|
+
value with the list of values the model supports. All other `OpenAILLMService` settings
|
|
116
|
+
(`temperature`, `max_tokens`, tools, and so on) work unchanged.
|
|
117
|
+
|
|
118
|
+
### Speech-to-text
|
|
119
|
+
|
|
120
|
+
`DeAPISTTService` is a segmented service: the pipeline's VAD marks where the user stops
|
|
121
|
+
speaking, the segment is uploaded, and one `TranscriptionFrame` is pushed with the transcript.
|
|
122
|
+
It needs a VAD analyzer in the pipeline, as in the example.
|
|
123
|
+
|
|
124
|
+
- Model: `FluidSpeechPro` (the default and, today, the only synchronous model).
|
|
125
|
+
- The clip length limit is the API's: a longer segment is refused with the API's message,
|
|
126
|
+
which states the current limit, and comes back as an `ErrorFrame`.
|
|
127
|
+
- The language is detected automatically and reported on the frame.
|
|
128
|
+
- One final transcript is pushed per segment.
|
|
129
|
+
- Billing is per second of audio; a segment with no speech returns nothing.
|
|
130
|
+
|
|
131
|
+
### Text-to-speech
|
|
132
|
+
|
|
133
|
+
| Setting | Default | Notes |
|
|
134
|
+
| - | - | - |
|
|
135
|
+
| `model` | `Kokoro` | Also `Chatterbox`, `Qwen3_TTS_12Hz_1_7B_CustomVoice`, `Qwen3_TTS_12Hz_1_7B_VoiceDesign` |
|
|
136
|
+
| `voice` | `af_nova` | Voices belong to the model. On `Kokoro` the prefix picks the language (`af_`/`am_` US English, `bf_`/`bm_` British English, `ef_`/`em_` Spanish, and more); the OpenAI voice names work too |
|
|
137
|
+
| `speed` | model default | Speed multiplier; the accepted range depends on the model, and the API rejects a value outside it |
|
|
138
|
+
| `instructions` | not set | A description of the voice, for the voice-design model only |
|
|
139
|
+
| `language` | from the voice | Set it to override the language chosen from the voice |
|
|
140
|
+
|
|
141
|
+
Each sentence is synthesized as one complete audio file and played as soon as it arrives.
|
|
142
|
+
|
|
143
|
+
## Running the example
|
|
144
|
+
|
|
145
|
+
[`examples/voice_agent.py`](https://github.com/deapi-ai/pipecat-deapi/blob/main/examples/voice_agent.py) is a complete voice agent on deAPI alone:
|
|
146
|
+
speech-to-text, an LLM with a function call, and the voice.
|
|
147
|
+
|
|
148
|
+
```bash
|
|
149
|
+
pip install pipecat-deapi "pipecat-ai[silero,webrtc,runner]" python-dotenv
|
|
150
|
+
export DEAPI_API_KEY=sk-dp-...
|
|
151
|
+
python examples/voice_agent.py
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
Then open `http://localhost:7860` and talk to the agent.
|
|
155
|
+
|
|
156
|
+
## Compatibility
|
|
157
|
+
|
|
158
|
+
Tested with Pipecat v1.17.0 on Python 3.12. Requires `pipecat-ai` 1.x.
|
|
159
|
+
|
|
160
|
+
## Development
|
|
161
|
+
|
|
162
|
+
```bash
|
|
163
|
+
pip install -e ".[dev]"
|
|
164
|
+
pytest
|
|
165
|
+
ruff check . && ruff format --check .
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
`DEAPI_API_KEY` in the environment also runs the live tests; without it they are skipped.
|
|
169
|
+
|
|
170
|
+
To record the demo again: `python demo/record_demo.py`, then `python demo/render_video.py`
|
|
171
|
+
(needs ffmpeg). It runs the real pipeline with a scripted user and costs a few cents.
|
|
172
|
+
|
|
173
|
+
## License
|
|
174
|
+
|
|
175
|
+
BSD 2-Clause. See [LICENSE](https://github.com/deapi-ai/pipecat-deapi/blob/main/LICENSE).
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
# pipecat-deapi
|
|
2
|
+
|
|
3
|
+
[deAPI](https://deapi.ai) services for [Pipecat](https://github.com/pipecat-ai/pipecat):
|
|
4
|
+
|
|
5
|
+
- **`DeAPILLMService`**: chat models served through deAPI's OpenAI-compatible API, with
|
|
6
|
+
streaming and tool calling.
|
|
7
|
+
- **`DeAPISTTService`**: speech-to-text on deAPI's synchronous transcription endpoint. The
|
|
8
|
+
transcript comes back in the same response, with automatic language detection.
|
|
9
|
+
- **`DeAPITTSService`**: text-to-speech with deAPI's voices (Kokoro and others).
|
|
10
|
+
|
|
11
|
+

|
|
12
|
+
|
|
13
|
+
The clip above is a real-time recording of the pipeline in [`demo/`](https://github.com/deapi-ai/pipecat-deapi/tree/main/demo): a scripted user
|
|
14
|
+
asks a question, the agent calls a function and answers, then gets interrupted mid-story.
|
|
15
|
+
The full video with sound is [`demo/demo.mp4`](https://github.com/deapi-ai/pipecat-deapi/blob/main/demo/demo.mp4).
|
|
16
|
+
|
|
17
|
+
This integration is maintained by deAPI Inc., the company that runs the deAPI service.
|
|
18
|
+
|
|
19
|
+
## Installation
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
pip install pipecat-deapi
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
or `uv add pipecat-deapi`.
|
|
26
|
+
|
|
27
|
+
You also need a deAPI API key. Create one in the
|
|
28
|
+
[deAPI panel](https://app.deapi.ai/settings/api-keys) and set it as `DEAPI_API_KEY`.
|
|
29
|
+
|
|
30
|
+
## Usage
|
|
31
|
+
|
|
32
|
+
All three services take the same key and drop into a Pipecat pipeline like any other service:
|
|
33
|
+
|
|
34
|
+
```python
|
|
35
|
+
import os
|
|
36
|
+
|
|
37
|
+
from pipecat.pipeline.pipeline import Pipeline
|
|
38
|
+
from pipecat_deapi import DeAPILLMService, DeAPISTTService, DeAPITTSService
|
|
39
|
+
|
|
40
|
+
stt = DeAPISTTService(api_key=os.environ["DEAPI_API_KEY"])
|
|
41
|
+
|
|
42
|
+
llm = DeAPILLMService(
|
|
43
|
+
api_key=os.environ["DEAPI_API_KEY"],
|
|
44
|
+
settings=DeAPILLMService.Settings(
|
|
45
|
+
model="qwen3.8-flash",
|
|
46
|
+
system_instruction="You are a helpful assistant in a voice conversation.",
|
|
47
|
+
),
|
|
48
|
+
)
|
|
49
|
+
|
|
50
|
+
tts = DeAPITTSService(
|
|
51
|
+
api_key=os.environ["DEAPI_API_KEY"],
|
|
52
|
+
settings=DeAPITTSService.Settings(voice="af_nova"),
|
|
53
|
+
)
|
|
54
|
+
|
|
55
|
+
pipeline = Pipeline(
|
|
56
|
+
[
|
|
57
|
+
transport.input(),
|
|
58
|
+
stt,
|
|
59
|
+
user_aggregator,
|
|
60
|
+
llm,
|
|
61
|
+
tts,
|
|
62
|
+
transport.output(),
|
|
63
|
+
assistant_aggregator,
|
|
64
|
+
]
|
|
65
|
+
)
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### LLM
|
|
69
|
+
|
|
70
|
+
| Setting | Default | Notes |
|
|
71
|
+
| - | - | - |
|
|
72
|
+
| `model` | `qwen3.8-flash` | Any chat model from `GET https://oai.deapi.ai/v1/models` |
|
|
73
|
+
| `reasoning_effort` | `"none"` | `none`, `minimal`, `low`, `medium`, `high`, `xhigh`, `max`, or `None` for the model's own default |
|
|
74
|
+
|
|
75
|
+
deAPI's chat models reason before they answer, and that pass runs before the first spoken
|
|
76
|
+
token. The service therefore turns reasoning off by default. Raise `reasoning_effort` when the
|
|
77
|
+
task needs working out:
|
|
78
|
+
|
|
79
|
+
```python
|
|
80
|
+
llm = DeAPILLMService(
|
|
81
|
+
api_key=os.environ["DEAPI_API_KEY"],
|
|
82
|
+
settings=DeAPILLMService.Settings(model="qwen3.8-max", reasoning_effort="low"),
|
|
83
|
+
)
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Not every model accepts every value. `glm-5.3` takes only `low`, `high` and `max`, so set one
|
|
87
|
+
of those when you use it; `gpt-6-luna` does not take `minimal`. The API rejects an unsupported
|
|
88
|
+
value with the list of values the model supports. All other `OpenAILLMService` settings
|
|
89
|
+
(`temperature`, `max_tokens`, tools, and so on) work unchanged.
|
|
90
|
+
|
|
91
|
+
### Speech-to-text
|
|
92
|
+
|
|
93
|
+
`DeAPISTTService` is a segmented service: the pipeline's VAD marks where the user stops
|
|
94
|
+
speaking, the segment is uploaded, and one `TranscriptionFrame` is pushed with the transcript.
|
|
95
|
+
It needs a VAD analyzer in the pipeline, as in the example.
|
|
96
|
+
|
|
97
|
+
- Model: `FluidSpeechPro` (the default and, today, the only synchronous model).
|
|
98
|
+
- The clip length limit is the API's: a longer segment is refused with the API's message,
|
|
99
|
+
which states the current limit, and comes back as an `ErrorFrame`.
|
|
100
|
+
- The language is detected automatically and reported on the frame.
|
|
101
|
+
- One final transcript is pushed per segment.
|
|
102
|
+
- Billing is per second of audio; a segment with no speech returns nothing.
|
|
103
|
+
|
|
104
|
+
### Text-to-speech
|
|
105
|
+
|
|
106
|
+
| Setting | Default | Notes |
|
|
107
|
+
| - | - | - |
|
|
108
|
+
| `model` | `Kokoro` | Also `Chatterbox`, `Qwen3_TTS_12Hz_1_7B_CustomVoice`, `Qwen3_TTS_12Hz_1_7B_VoiceDesign` |
|
|
109
|
+
| `voice` | `af_nova` | Voices belong to the model. On `Kokoro` the prefix picks the language (`af_`/`am_` US English, `bf_`/`bm_` British English, `ef_`/`em_` Spanish, and more); the OpenAI voice names work too |
|
|
110
|
+
| `speed` | model default | Speed multiplier; the accepted range depends on the model, and the API rejects a value outside it |
|
|
111
|
+
| `instructions` | not set | A description of the voice, for the voice-design model only |
|
|
112
|
+
| `language` | from the voice | Set it to override the language chosen from the voice |
|
|
113
|
+
|
|
114
|
+
Each sentence is synthesized as one complete audio file and played as soon as it arrives.
|
|
115
|
+
|
|
116
|
+
## Running the example
|
|
117
|
+
|
|
118
|
+
[`examples/voice_agent.py`](https://github.com/deapi-ai/pipecat-deapi/blob/main/examples/voice_agent.py) is a complete voice agent on deAPI alone:
|
|
119
|
+
speech-to-text, an LLM with a function call, and the voice.
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
pip install pipecat-deapi "pipecat-ai[silero,webrtc,runner]" python-dotenv
|
|
123
|
+
export DEAPI_API_KEY=sk-dp-...
|
|
124
|
+
python examples/voice_agent.py
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
Then open `http://localhost:7860` and talk to the agent.
|
|
128
|
+
|
|
129
|
+
## Compatibility
|
|
130
|
+
|
|
131
|
+
Tested with Pipecat v1.17.0 on Python 3.12. Requires `pipecat-ai` 1.x.
|
|
132
|
+
|
|
133
|
+
## Development
|
|
134
|
+
|
|
135
|
+
```bash
|
|
136
|
+
pip install -e ".[dev]"
|
|
137
|
+
pytest
|
|
138
|
+
ruff check . && ruff format --check .
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
`DEAPI_API_KEY` in the environment also runs the live tests; without it they are skipped.
|
|
142
|
+
|
|
143
|
+
To record the demo again: `python demo/record_demo.py`, then `python demo/render_video.py`
|
|
144
|
+
(needs ffmpeg). It runs the real pipeline with a scripted user and costs a few cents.
|
|
145
|
+
|
|
146
|
+
## License
|
|
147
|
+
|
|
148
|
+
BSD 2-Clause. See [LICENSE](https://github.com/deapi-ai/pipecat-deapi/blob/main/LICENSE).
|