2025-06-08 20:09:09 +03:00
---
sidebar_position: 1
description: Generate speech and other functions to work with OpenAI in the Open Integration Package, a free open-source integration library for 1C:Enterprise 8, OneScript and CLI
keywords: [1C, 1С, 1С:Enterprise, 1С:Enterprise 8.3, API, Integration, Services, Exchange, OneScript, CLI, OpenAI]
---
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
# Generate speech
Generates audio with the specified text for speech synthesis
`Function GenerateSpeech(Val URL, Val Token, Val Model, Val Text, Val Voice = "alloy", Val AdditionalParameters = "", Val AdditionalHeaders = "") Export`
| Parameter | CLI option | Type | Required | Description |
|-|-|-|-|-|
| URL | --url | String | ✔ | OpenAI server URL |
| Token | --token | String | ✔ | OpenAI authorization token |
| Model | --model | String | ✔ | Models name |
| Text | --input | String | ✔ | Text for speech synthesis |
| Voice | --voice | String | ✖ | Voice type: alloy, ash, ballad, coral, echo, etc.. |
| AdditionalParameters | --options | Structure Of KeyAndValue | ✖ | Additional request parameters, if necessary |
| AdditionalHeaders | --headers | Map Of KeyAndValue | ✖ | Additional request headers, if necessary |
2025-06-19 11:08:31 +03:00
Returns: BinaryData - Processing result
2025-06-08 20:09:09 +03:00
<br/>
:::tip
Method at API documentation: [Create speech](https://platform.openai.com/docs/api-reference/audio/createSpeech)
Available voices may vary depending on the selected model
The audio file format of the response can be changed by adding `response_format` in additional parameters. Available formats: mp3 (default), opus, aac, flac, wav, pcm
:::
<br/>
```bsl title="1C:Enterprise/OneScript code example"
2025-06-29 14:35:33 +03:00
URL = "https://hut.openintegrations.dev/localai/";
Token = "12We...";
2025-06-08 20:09:09 +03:00
Text = "Attack ships on fire off the shoulder of Orion bright as magnesium";
Model = "tts-1";
AdditionalParameters = New Structure("response_format", "wav");
Result = OPI_OpenAI.GenerateSpeech(URL, Token, Model, Text, , AdditionalParameters);
```
2025-06-18 21:53:54 +03:00
<Tabs>
<TabItem value="bash" label="Bash" default>
```bash
# JSON data can also be passed as a path to a .json file
oint openai GenerateSpeech \
2025-07-04 23:24:42 +03:00
--url "https://hut.openintegrations.dev/localai/" \
2025-06-18 21:53:54 +03:00
--token "***" \
--model "tts-1" \
--input "Attack ships on fire off the shoulder of Orion bright as magnesium" \
--options "{'response_format':'wav'}"
```
</TabItem>
<TabItem value="bat" label="CMD/Bat" default>
```batch
:: JSON data can also be passed as a path to a .json file
oint openai GenerateSpeech ^
2025-07-04 23:24:42 +03:00
--url "https://hut.openintegrations.dev/localai/" ^
2025-06-18 21:53:54 +03:00
--token "***" ^
--model "tts-1" ^
--input "Attack ships on fire off the shoulder of Orion bright as magnesium" ^
--options "{'response_format':'wav'}"
```
</TabItem>
</Tabs>
2025-06-08 20:09:09 +03:00
2025-06-17 16:20:59 +03:00
```json title="Result"
2025-09-12 20:23:31 +03:00
NOT JSON: 52 49 46 46 24 53 02 00 57 41 56 45 66 6D 74 20 10 00 00 00 01 00 01 00 80 3E 00 00 00 7D 00 00 02 00 10 00 64 61 74 61 00 53 02 00 FE FF 05 00 04 00 00 00 00 00 04 00 07 00 04 00 01 00 00 00…
2025-06-17 16:20:59 +03:00
```