---
sidebar_position: 2
description: Create assistant 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';

# Create assistant
 Creates an assistant based on the model and instruction



`Function CreateAssistant(Val URL, Val Token, Val Model, Val Name = "", Val Instruction = "", Val AdditionalParameters = "", Val AdditionalHeaders = "") Export`

  | Parameter | CLI option | Type | Required | Description |
  |-|-|-|-|-|
  | URL | --url | String | &#x2714; | OpenAI server URL |
  | Token | --token | String | &#x2714; | OpenAI authorization token |
  | Model | --model | String | &#x2714; | Models name |
  | Name | --name | String | &#x2716; | Assistant name |
  | Instruction | --inst | String | &#x2716; | System instruction for the assistant |
  | AdditionalParameters | --options | Structure Of KeyAndValue | &#x2716; | Additional request parameters, if necessary |
  | AdditionalHeaders | --headers | Map Of KeyAndValue | &#x2716; | Additional request headers, if necessary |

  
  Returns:  Map Of KeyAndValue - Processing result

:::tip
Method at API documentation: [Create assistant](https://platform.openai.com/docs/api-reference/assistants/createAssistant)
:::
<br/>


```bsl title="1C:Enterprise/OneScript code example"
    URL   = "https://hut.openintegrations.dev/localai/";
    Token = "12We...";

    Instruction = "You are a personal math tutor. When asked a question, write and run Python code to answer the question.";
    Model       = "smolvlm-256m-instruct";
    Name        = "Math tutor";

    Result = OPI_OpenAI.CreateAssistant(URL, Token, Model, Name, Instruction);
```
 

 <Tabs>
  
    <TabItem value="bash" label="Bash" default>
        ```bash
            oint openai CreateAssistant \
             --url "https://hut.openintegrations.dev/localai/" \
             --token "***" \
             --model "smolvlm-256m-instruct" \
             --name "Math tutor" \
             --inst "You are a personal math tutor. When asked a question, write and run Python code to answer the question."
        ```
    </TabItem>
  
    <TabItem value="bat" label="CMD/Bat" default>
        ```batch
            oint openai CreateAssistant ^
             --url "https://hut.openintegrations.dev/localai/" ^
             --token "***" ^
             --model "smolvlm-256m-instruct" ^
             --name "Math tutor" ^
             --inst "You are a personal math tutor. When asked a question, write and run Python code to answer the question."
        ```
    </TabItem>
</Tabs>


```json title="Result"
{
 "id": "asst_11",
 "object": "assistant",
 "created": 1757982420,
 "model": "smolvlm-256m-instruct",
 "name": "Math tutor",
 "instructions": "You are a personal math tutor. When asked a question, write and run Python code to answer the question."
}
```
