1
0
mirror of https://github.com/Bayselonarrend/OpenIntegrations.git synced 2025-11-25 22:12:29 +02:00
Files
OpenIntegrations/docs/en/md/OpenAI/Audio-processing/Generate-speech.mdx
Vitaly the Alpaca (bot) 687a2dd281 Main build (Jenkins)
2025-06-08 20:09:09 +03:00

59 lines
2.1 KiB
Plaintext
Vendored

---
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 |
Returns: Map Of KeyAndValue - Processing result
<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"
URL = "https://api.athenaeum.digital:1122/";
Token = "sk-or-vv-c5884ebe9f13fb143194bb07ecb...";
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);
```