Skip to content

Restrict model parameters

Use the Parameters panel in the dashboard’s model access settings to control how employees use a model. You can:

  • Block a parameter value, such as 480p resolution.
  • Cap a numeric parameter, such as video duration at 5 seconds.
  • Set daily or monthly spending limits in rubles and generation counts for a specific value, such as no more than five generations at 720p per day.

Rules at the employee, team, and organization levels apply together. A generation must satisfy all of them.

In the business dashboard, open the model’s access settings and select Parameters. In by and values, use only options listed in that panel. A model may support additional generation options that cannot be restricted here.

The rules object replaces all rules for one model at the selected level. To clear them, explicitly send rules: null. An empty object {} or a rule that imposes no restriction is invalid.

Rules object

ParameterTypeDescription
bystringModel parameter used as the key for rows in values, usually resolution. Required when values is present.
anyobjectThe line "Any Value" applies to all model generation: max, denyValues, count
valuesobjectKey value lines: Key value (e.g. "480p") value — deny, max, denyValues, spend, count

Rule line (any or values[value])

ParameterTypeDescription
denybooleanOnly in values. Set deny to true to disallow that parameter value. Omit all other fields from the same entry.
maxobjectUpper bound for a numeric parameter. For example, {"duration":5} sets a maximum of 5.
denyValuesobjectDisallowed values for other selectable parameters, for example {"sound":[true]}. Use values to disallow a value for the primary parameter.
spendobjectOnly inside values. Spending limit for this parameter value. Set { daily?, monthly? } in whole rubles. Use model limits for a budget across all parameter values.
countobjectGeneration count limit: { daily?, monthly? }. Use integers up to 1,000,000,000. Use 0 for no limit.

You can restrict user-selected parameters that affect price, such as quality, duration, and sound. Each model supports its own set of parameters and values. An unknown parameter, an unsupported value, a cap below the minimum, or a rule that blocks every value returns invalid for that item. The API explains the error in message and identifies the parameter, value, and allowed options in details. To block the entire model, use model access.

{
"by": "resolution",
"any": { "max": { "duration": 5 }, "count": { "daily": 20 } },
"values": {
"480p": { "deny": true },
"720p": { "spend": { "monthly": 3000 }, "count": { "daily": 5 } }
}
}

Example above: No longer than 5 seconds and no more than 20 per day; 480p prohibited; in 720p - no more 3000 per month, and 5 generations per day.

Only API keys whose creator is an owner or admin can change these rules. With a manager key, individual employee or team items return forbidden, and organization-level requests return HTTP 403. A personal account key or a key whose creator has the member role receives HTTP 403 for the entire request. Key creators cannot change the rules for themselves or for an employee with a higher role.

POSThttps://gptunnel.ru/api/v1/access/setParamRules

Send up to 25 { login, model, rules } entries in items. The same employee can appear with different models. If a login and model pair repeats, only its first entry is applied. Entries are processed independently.

Request headers

ParameterTypeDescription
Authorization*stringAPI key

Request parameters

ParameterTypeDescription
items*object[]Array of 1 to 25 entries, each containing { login, model, rules }.
items[].login*stringEmployee login in the organization (case-insensitive)
items[].model*stringModel ID from GET /v1/models
items[].rules*object | nullModel rules (format above) null - remove limitations on the parameters of this model for a staff member

The response counts successes in updated and failures in failed. Each failedLogins entry includes the login, model, reason, and explanation. For invalid, it also includes details.

Error reasons

ParameterTypeDescription
not_foundstringNo employee in the organization has this login
forbiddenstringThe API key was created by a manager, or the target is the key creator or an employee with a higher role than the key creator.
model_not_foundstringThe model with such id is not available or has not been released — see unknownModels
invalidstringThe rules do not fit the model parameters - see message and details
errorstringUnforeseen error in processing element -- repeat request

Reasons for incompatibility with the model (details)

ParameterTypeDescription
UNKNOWN_PARAMcodeThis model does not support a restriction on the requested parameter. param is the submitted parameter, and allowed lists the parameters you can restrict. expectedBy appears when values are not set for the primary parameter
UNKNOWN_VALUEcodeThe parameter does not have that value. param, value, allowed is the permissible values
ALL_VALUES_DENIEDcodeAll parameter values are prohibited, which is a model ban
MAX_BELOW_MINcodeThe ceiling is below the lowest parameter value
WRONG_RULE_KINDcodeThe use field gives the expected rule kind: max for a numeric parameter, denyValues for a choice, or values for the main parameter.

Set GPTUNNEL_API_KEY and replace the placeholders with values for your organization.

import json
import os
from urllib.request import Request, urlopen
key = os.environ.get("GPTUNNEL_API_KEY")
if not key:
raise SystemExit("Set GPTUNNEL_API_KEY")
body = {
"items": [
{
"login": "ivanov@company.com",
"model": "seedance-2-5",
"rules": {
"by": "resolution",
"any": {
"max": {
"duration": 5
}
},
"values": {
"480p": {
"deny": True
}
}
}
},
{
"login": "petrov@company.com",
"model": "seedance-2-5",
"rules": {
"by": "resolution",
"values": {
"8K": {
"deny": True
}
}
}
}
]
}
request = Request(
"https://gptunnel.ru/api/v1/access/setParamRules",
method="POST",
headers={
"Authorization": key,
"Content-Type": "application/json",
},
data=json.dumps(body).encode("utf-8"),
)
with urlopen(request, timeout=30) as response:
print(json.load(response))
{
"code": 0,
"updated": 1,
"failed": 1,
"failedLogins": [
{
"login": "petrov@company.com",
"model": "seedance-2-5",
"reason": "invalid",
"message": "Value \"8K\" is not available for parameter \"resolution\" of model \"seedance-2-5\". Allowed values: \"480p\", \"720p\".",
"details": {
"code": "UNKNOWN_VALUE",
"param": "resolution",
"value": "8K",
"allowed": ["480p", "720p"]
}
}
]
}

These structural errors reject the entire request with HTTP 400.

Input Correction
Unknown keys, or deny or spend inside any Use only fields supported for that row
values without by or by without values Pass both fields together
deny combined with other restrictions in the same row Keep either the ban or the individual restrictions
Negative or fractional limits Use non-negative whole numbers
Empty rules, values or line of rules Set at least one limit or send rules: null to clear the existing rule
A row without deny: true or a positive limit, such as { "deny": false } or { "count": { "daily": 0 } } Specify an effective restriction
POSThttps://gptunnel.ru/api/v1/access/setTeamParamRules

Send up to 25 { teamId, model, rules } entries in items. The response contains updated, failed, and failedTeams. Each failure identifies the teamId, model, and reason. Reasons match the employee endpoint, except that not_found means the team is outside the organization.

import json
import os
from urllib.request import Request, urlopen
key = os.environ.get("GPTUNNEL_API_KEY")
if not key:
raise SystemExit("Set GPTUNNEL_API_KEY")
body = {
"items": [
{
"teamId": "664f0a1b2c3d4e5f60718293",
"model": "seedance-2-5",
"rules": {
"any": {
"max": {
"duration": 10
}
}
}
}
]
}
request = Request(
"https://gptunnel.ru/api/v1/access/setTeamParamRules",
method="POST",
headers={
"Authorization": key,
"Content-Type": "application/json",
},
data=json.dumps(body).encode("utf-8"),
)
with urlopen(request, timeout=30) as response:
print(json.load(response))
POSThttps://gptunnel.ru/api/v1/access/setOrgParamRules

Send up to 25 { model, rules } entries in items. If a model appears more than once, only the first entry is used. The response includes updated, failed, and failedModels. Each failure names the model and gives a reason: model_not_found, invalid, or error. A manager’s key receives HTTP 403.

import json
import os
from urllib.request import Request, urlopen
key = os.environ.get("GPTUNNEL_API_KEY")
if not key:
raise SystemExit("Set GPTUNNEL_API_KEY")
body = {
"items": [
{
"model": "seedance-2-5",
"rules": {
"by": "resolution",
"values": {
"720p": {
"deny": True
}
}
}
}
]
}
request = Request(
"https://gptunnel.ru/api/v1/access/setOrgParamRules",
method="POST",
headers={
"Authorization": key,
"Content-Type": "application/json",
},
data=json.dumps(body).encode("utf-8"),
)
with urlopen(request, timeout=30) as response:
print(json.load(response))
{
"code": 0,
"updated": 1,
"failed": 0,
"failedModels": []
}

Read the current rules in the model’s paramRules field returned by the access settings methods.