Skip to content

Create an assistant

Authenticate requests with your API key.

POSThttps://gptunnel.ru/v1/assistant/create

Creates 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

ParameterTypeDescription
Authorization*stringAPI key

Request body

ParameterTypeDescription
title*stringDisplay name, up to 16 characters.
modelId*stringText model ID from /v1/models. The API key must have access to the model.
mentionstringAssistant 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.
subtitlestringSubheading, up to 32 characters
descriptionstringCatalog description, up to 4096 characters.
picturestringAvatar URL, up to 255 characters.
instructionstringSystem instruction (prompt)
temperaturenumberGeneration temperature from 0 to 1. Defaults to 0.5.
sqlStorebooleanGive the assistant its own empty SQLite database. This experimental feature requires a model that supports function calling. Defaults to false.
accessobjectPrivacy and catalog settings. See the access table below.
databaseobject | nullRAG knowledge base settings. See the database table below.
mcpArray<object>MCP server settings. Supply at most one entry.
apiFunctionsArray<object>External API functions. Supply at most 25 entries.

access

ParameterTypeDescription
access.isPrivatebooleanSet to true to hide the assistant from the catalog. Defaults to false.
access.isFreebooleanWhether installation is free. Paid installation is not supported. The only allowed value is true, which is the default.
access.installPricenumberInstallation price in rubles. The only supported value is 0, the default.
access.hideSettingsbooleanSet to true to hide the settings and system instructions from other users. Defaults to false.
access.orgTeamIdstring | nullTeam ID within access.orgId. You must have permission to add the assistant to that team.
access.orgIdstring | nullOrganization 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

ParameterTypeDescription
database.id*stringKnowledge base ID from /v1/database/list. The knowledge base must belong to the key owner
database.requestFrequencystringWhen to query the database: everytime for every request, auto when the model decides, or first for the first message only.
database.chunksnumberNumber of retrieved chunks to include in the model context.

mcp[]

ParameterTypeDescription
mcp[].server*stringMCP server URL, up to 1024 characters.
mcp[].clientIdstring | nullOAuth client id
mcp[].clientSecretstring | nullOAuth client secret
mcp[].accessTokenstring | nullAccess token to use if authorization is already complete.
mcp[].scopestring | nullOAuth scope
mcp[].toolDisabledstring | nullComma-separated names of MCP server tools to disable.

apiFunctions[]

ParameterTypeDescription
apiFunctions[].name*stringFunction 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*stringHTTP method: get or post
apiFunctions[].endpoint*stringAbsolute http(s) URL of the public endpoint to call. Use {param} placeholders in the path or query only. The host must be fixed.
apiFunctions[].descriptionstringInstructions telling the model when to call the function.
apiFunctions[].headersArray<object>Request headers as { key, value } pairs.
apiFunctions[].parametersArray<object>Parameter definitions: { name, type, description, required, value }. Supported type values: string, number, boolean.

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 json
import os
from 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))

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.

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
}
}