Create an assistant
Authenticate requests with your API key.
Request
Section titled “Request”https://gptunnel.ru/v1/assistant/createCreates an assistant owned by the user whose API key you supply. The same settings are available in the web interface.
Only title and modelId are required. Other fields have defaults.
Request headers
| Parameter | Type | Description |
|---|---|---|
Authorization* | string | API key |
Request body
| Parameter | Type | Description |
|---|---|---|
title* | string | Display name, up to 16 characters. |
modelId* | string | Text model ID from /v1/models. The API key must have access to the model. |
mention | string | Assistant code used in its page URL and as assistantCode in chat. Use 3–16 letters, digits, hyphens, or underscores. The API generates a code if you omit this field. |
subtitle | string | Subheading, up to 32 characters |
description | string | Catalog description, up to 4096 characters. |
picture | string | Avatar URL, up to 255 characters. |
instruction | string | System instruction (prompt) |
temperature | number | Generation temperature from 0 to 1. Defaults to 0.5. |
sqlStore | boolean | Give the assistant its own empty SQLite database. This experimental feature requires a model that supports function calling. Defaults to false. |
access | object | Privacy and catalog settings. See the access table below. |
database | object | null | RAG knowledge base settings. See the database table below. |
mcp | Array<object> | MCP server settings. Supply at most one entry. |
apiFunctions | Array<object> | External API functions. Supply at most 25 entries. |
access
| Parameter | Type | Description |
|---|---|---|
access.isPrivate | boolean | Set to true to hide the assistant from the catalog. Defaults to false. |
access.isFree | boolean | Whether installation is free. Paid installation is not supported. The only allowed value is true, which is the default. |
access.installPrice | number | Installation price in rubles. The only supported value is 0, the default. |
access.hideSettings | boolean | Set to true to hide the settings and system instructions from other users. Defaults to false. |
access.orgTeamId | string | null | Team ID within access.orgId. You must have permission to add the assistant to that team. |
access.orgId | string | null | Organization ID for an organization assistant. Only the organization associated with the API key is accepted. Personal keys ignore this field. Defaults to null for a personal assistant. |
database
| Parameter | Type | Description |
|---|---|---|
database.id* | string | Knowledge base ID from /v1/database/list. The knowledge base must belong to the key owner |
database.requestFrequency | string | When to query the database: everytime for every request, auto when the model decides, or first for the first message only. |
database.chunks | number | Number of retrieved chunks to include in the model context. |
mcp[]
| Parameter | Type | Description |
|---|---|---|
mcp[].server* | string | MCP server URL, up to 1024 characters. |
mcp[].clientId | string | null | OAuth client id |
mcp[].clientSecret | string | null | OAuth client secret |
mcp[].accessToken | string | null | Access token to use if authorization is already complete. |
mcp[].scope | string | null | OAuth scope |
mcp[].toolDisabled | string | null | Comma-separated names of MCP server tools to disable. |
apiFunctions[]
| Parameter | Type | Description |
|---|---|---|
apiFunctions[].name* | string | Function name shown to the model. Use up to 64 Latin letters, digits, underscores (_), or hyphens (-). Each name must be unique within the assistant. |
apiFunctions[].type* | string | HTTP method: get or post |
apiFunctions[].endpoint* | string | Absolute http(s) URL of the public endpoint to call. Use {param} placeholders in the path or query only. The host must be fixed. |
apiFunctions[].description | string | Instructions telling the model when to call the function. |
apiFunctions[].headers | Array<object> | Request headers as { key, value } pairs. |
apiFunctions[].parameters | Array<object> | Parameter definitions: { name, type, description, required, value }. Supported type values: string, number, boolean. |
Example request
Section titled “Example request”This example creates a private assistant. Save the returned id to update or delete the assistant. Use its mention to start a chat.
Store the API key in the GPTUNNEL_API_KEY environment variable.
import jsonimport osfrom urllib.request import Request, urlopen
body = { "title": "Помощник", "modelId": "gpt-6-luna", "instruction": "Отвечай кратко.", "access": { "isPrivate": True }}request = Request( 'https://gptunnel.ru/v1/assistant/create', headers={ 'Authorization': os.environ['GPTUNNEL_API_KEY'], 'Content-Type': 'application/json', }, data=json.dumps(body).encode('utf-8'),)with urlopen(request, timeout=60) as response: print(json.load(response))curl --request POST \ --url 'https://gptunnel.ru/v1/assistant/create' \ --header "Authorization: ${GPTUNNEL_API_KEY:?Set GPTUNNEL_API_KEY}" \ --header 'Content-Type: application/json' \ --data '{ "title": "Помощник", "modelId": "gpt-6-luna", "instruction": "Отвечай кратко.", "access": { "isPrivate": true }}'const response = await fetch('https://gptunnel.ru/v1/assistant/create', { method: 'POST', headers: { Authorization: process.env.GPTUNNEL_API_KEY, 'Content-Type': 'application/json', }, body: JSON.stringify({ "title": "Помощник", "modelId": "gpt-6-luna", "instruction": "Отвечай кратко.", "access": { "isPrivate": true } }),})if (!response.ok) throw new Error(await response.text())console.log(await response.json())Minimum request
Section titled “Minimum request”A request containing only title and modelId creates a public assistant. Set access.isPrivate: true to keep it out of the catalog. If you omit mention, the API generates the assistant code and returns it in the response.
Example response
Section titled “Example response”The following excerpt shows an example assistant ID and code.
The response omits the MCP credentials clientSecret and accessToken.
{ "object": "assistant", "id": "68c9b2d1e4b0a2d3c4f5e6b8", "mention": "example-assistant", "title": "Помощник", "modelId": "gpt-6-luna", "access": { "isPrivate": true, "orgId": null, "orgTeamId": null }}{ "error": { "message": "title: String must contain at most 16 character(s)", "type": "invalid_request_error", "param": null, "code": null }}{ "error": { "message": "Mention 'tax-helper' is already taken", "type": "invalid_request_error", "param": null, "code": "mention_taken" }}{ "error": { "message": "Model 'example-missing-model' not found or is not a text model", "type": "invalid_model_error", "param": null, "code": "model_not_found" }}