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/Requests-processing/Get-images.mdx
Vitaly the Alpaca (bot) 47fa4e92bb Main build (Jenkins)
2025-06-27 11:47:43 +03:00

86 lines
3.3 KiB
Plaintext
Vendored

---
sidebar_position: 2
description: Get images 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';
# Get images
Generates images based on the specified description
`Function GetImages(Val URL, Val Token, Val Model, Val Description, 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 |
| Description | --descr | Structure Of KeyAndValue | ✔ | Generation parameters. See GetImageDescriptionStructure |
| AdditionalHeaders | --headers | Map Of KeyAndValue | ✖ | Additional request headers, if necessary |
Returns: Map Of KeyAndValue - Processing result
<br/>
:::tip
Method at API documentation: [Create image](https://platform.openai.com/docs/api-reference/images/create)
:::
<br/>
```bsl title="1C:Enterprise/OneScript code example"
URL = FunctionParameters["OpenAI_URL2"];
Token = FunctionParameters["OpenAI_Token2"];
Model = "dall-e-3";
Description = OPI_OpenAI.GetImageDescriptionStructure("Yellow alpaca", 1, , "1024x1024");
Result = OPI_OpenAI.GetImages(URL, Token, Model, Description);
```
<Tabs>
<TabItem value="bash" label="Bash" default>
```bash
# JSON data can also be passed as a path to a .json file
oint openai GetImages \
--url "https://bothub.chat/api/v2/openai/" \
--token "***" \
--model "dall-e-3" \
--descr "{'prompt':'Yellow alpaca','n':1,'size':'1024x1024'}"
```
</TabItem>
<TabItem value="bat" label="CMD/Bat" default>
```batch
:: JSON data can also be passed as a path to a .json file
oint openai GetImages ^
--url "https://bothub.chat/api/v2/openai/" ^
--token "***" ^
--model "dall-e-3" ^
--descr "{'prompt':'Yellow alpaca','n':1,'size':'1024x1024'}"
```
</TabItem>
</Tabs>
```json title="Result"
{
"created": 1750098846,
"data": [
{
"revised_prompt": "A charming yellow-colored alpaca standing freely in a pasture. The alpaca is adorned with a lush, thick yellow coat that appears to be sun-kissed. It has impressive, moderately curved ears, and expressive eyes that reveal a gentle and docile nature. The scene is idyllic, representing rural tranquility, with the alpaca being the center of attention.",
"url": "https://oaidalleapiprodscus.blob.core.windows.net/private/org-Dy8ARyqBtu507OGoMBxfUU0S/user-n4L5wc2dF1fH9APAG2dE3Rw9/img-StR6prDRbPDFcwREXKuTv5wU.png?st=2025-06-16T17%3A34%3A06Z&se=2025-06-16T19%3A34%3A06Z&sp=r&sv=2024-08-04&sr=b&rscd=inline&rsct=image/png&skoid=475fd488-6c59-44a5-9aa9-31c4db451bea&sktid=a48cca56-e6da-484e-a814-9c849652bcb3&skt=2025-06-16T07%3A23%3A15Z&ske=2025-06-17T07%3A23%3A15Z&sks=b&skv=2024-08-04&sig=61%2B3ssgypoSq6e9cEYAq1EI8WuxfypYrI1u3EvkzeBc%3D"
}
]
}
```