# Assistants API

Source: [Assistants API](<https://docs.gptunnel.ru/en/api/assistants/about/>)

<a id="_top"></a>
<a id="что-такое-assistant-api"></a>
 <a id="what-are-api-assistants"></a>
 
<a id="what-is-the-assistants-api"></a>
## What is the Assistants API?

Use the Assistants API to configure a GPTunneL assistant and exchange messages with it from your application.

<a id="benefits"></a>
## Benefits

- Send a message to an assistant in one API request.
- Configure its behavior in the web interface. Saved settings apply to subsequent requests.
- Reuse a `chatId` and set `maxContext` to include earlier messages in a conversation.
- Choose from Claude, GPT, and other models.
- Connect a RAG knowledge base or an external API.

 <a id="working-principle"></a>
 
<a id="how-it-works"></a>
## How it works

Send authenticated POST requests with a JSON body.

![The interaction scheme](<https://docs.gptunnel.ru/assets/Screenshot%202024-08-22%20at%2010.29.21%20%281%29.png>)

 <a id="fast-start"></a>
 
<a id="quick-start"></a>
## Quick start

1. Get an [API key](<https://docs.gptunnel.ru/en/#get-an-api-key>).
2. Create an assistant — from the dashboard (see the [blog guide](<https://www.gptunnel.ru/ru/blog/ai-assistant-how-to>)) or by calling [`assistant/create`](<https://docs.gptunnel.ru/en/api/assistants/create/>).
3. Save the `mention` returned when you create the assistant. Pass it as `assistantCode` to [chat with the assistant](<https://docs.gptunnel.ru/en/api/assistants/chat/>).
4. To continue a conversation, reuse the same `chatId` and set `maxContext`.

<a id="methods"></a>
## Methods

- [Chat with an assistant](<https://docs.gptunnel.ru/en/api/assistants/chat/>) to send a message and receive a response.
- [Create an assistant](<https://docs.gptunnel.ru/en/api/assistants/create/>) with your chosen settings.
- [Update an assistant](<https://docs.gptunnel.ru/en/api/assistants/update/>) to change its settings.
- [Delete an assistant](<https://docs.gptunnel.ru/en/api/assistants/delete/>).
- [List your assistants](<https://docs.gptunnel.ru/en/api/assistants/list/>), including private assistants.
- [Search the catalog](<https://docs.gptunnel.ru/en/api/assistants/search/>) for public assistants.

<a id="faq"></a>
## FAQ

**How do you change the assistant model?**

Change the model in the web interface or call [`assistant/update`](<https://docs.gptunnel.ru/en/api/assistants/update/>). Subsequent requests use the new model.

**How do I change the assistant’s behavior?**

Set the instructions, temperature, and other options in the web interface or pass them to [`assistant/create`](<https://docs.gptunnel.ru/en/api/assistants/create/>) or [`assistant/update`](<https://docs.gptunnel.ru/en/api/assistants/update/>).

**Can you use your own data?**

Yes. Add the relevant information to the assistant’s instructions or its RAG knowledge base.

**Is it possible to send images?**

Yes. Pass the image URLs in `images`.

**How do I keep conversation history?**

Reuse the same `chatId` throughout the conversation and set `maxContext` to a value from 1 to 20. With `maxContext: 0`, the model receives only the current turn.

---

Integration issues in Telegram: [t.me/gptunnel\_ru](<https://t.me/gptunnel_ru>) or **@ScriptHeads**
