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
480presolution. - 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
720pper 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.
Format of rules
Section titled “Format of rules”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
| Parameter | Type | Description |
|---|---|---|
by | string | Model parameter used as the key for rows in values, usually resolution. Required when values is present. |
any | object | The line "Any Value" applies to all model generation: max, denyValues, count |
values | object | Key value lines: Key value (e.g. "480p") value — deny, max, denyValues, spend, count |
Rule line (any or values[value])
| Parameter | Type | Description |
|---|---|---|
deny | boolean | Only in values. Set deny to true to disallow that parameter value. Omit all other fields from the same entry. |
max | object | Upper bound for a numeric parameter. For example, {"duration":5} sets a maximum of 5. |
denyValues | object | Disallowed values for other selectable parameters, for example {"sound":[true]}. Use values to disallow a value for the primary parameter. |
spend | object | Only inside values. Spending limit for this parameter value. Set { daily?, monthly? } in whole rubles. Use model limits for a budget across all parameter values. |
count | object | Generation 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.
Who can make changes
Section titled “Who can make changes”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.
Staff members
Section titled “Staff members”https://gptunnel.ru/api/v1/access/setParamRulesSend 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
| Parameter | Type | Description |
|---|---|---|
Authorization* | string | API key |
Request parameters
| Parameter | Type | Description |
|---|---|---|
items* | object[] | Array of 1 to 25 entries, each containing { login, model, rules }. |
items[].login* | string | Employee login in the organization (case-insensitive) |
items[].model* | string | Model ID from GET /v1/models |
items[].rules* | object | null | Model 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
| Parameter | Type | Description |
|---|---|---|
not_found | string | No employee in the organization has this login |
forbidden | string | The 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_found | string | The model with such id is not available or has not been released — see unknownModels |
invalid | string | The rules do not fit the model parameters - see message and details |
error | string | Unforeseen error in processing element -- repeat request |
Reasons for incompatibility with the model (details)
| Parameter | Type | Description |
|---|---|---|
UNKNOWN_PARAM | code | This 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_VALUE | code | The parameter does not have that value. param, value, allowed is the permissible values |
ALL_VALUES_DENIED | code | All parameter values are prohibited, which is a model ban |
MAX_BELOW_MIN | code | The ceiling is below the lowest parameter value |
WRONG_RULE_KIND | code | The use field gives the expected rule kind: max for a numeric parameter, denyValues for a choice, or values for the main parameter. |
Example request
Section titled “Example request”Set GPTUNNEL_API_KEY and replace the placeholders with values for your organization.
import jsonimport osfrom 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))curl --request POST \ --url 'https://gptunnel.ru/api/v1/access/setParamRules' \ --header "Authorization: ${GPTUNNEL_API_KEY:?Set GPTUNNEL_API_KEY}" \ --header 'Content-Type: application/json' \ --data '{ "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 } } } } ]}'const key = process.env.GPTUNNEL_API_KEYif (!key) throw new Error("Set GPTUNNEL_API_KEY")
const 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 } } } } ]}const response = await fetch("https://gptunnel.ru/api/v1/access/setParamRules", { method: "POST", headers: { Authorization: key, "Content-Type": "application/json", }, body: JSON.stringify(body),})if (!response.ok) throw new Error(await response.text())console.log(await response.json())Example response
Section titled “Example 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"] } } ]}{ "code": 3, "message": "Invalid input, check schema issues.", "details": [ { "code": "unrecognized_keys", "keys": ["deny"], "path": ["items", 0, "rules", "any"], "message": "Unrecognized key(s) in object: 'deny'" } ]}{ "code": 7, "message": "Not allowed to perform this action for the organization."}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 |
https://gptunnel.ru/api/v1/access/setTeamParamRulesSend 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 jsonimport osfrom 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))curl --request POST \ --url 'https://gptunnel.ru/api/v1/access/setTeamParamRules' \ --header "Authorization: ${GPTUNNEL_API_KEY:?Set GPTUNNEL_API_KEY}" \ --header 'Content-Type: application/json' \ --data '{ "items": [ { "teamId": "664f0a1b2c3d4e5f60718293", "model": "seedance-2-5", "rules": { "any": { "max": { "duration": 10 } } } } ]}'const key = process.env.GPTUNNEL_API_KEYif (!key) throw new Error("Set GPTUNNEL_API_KEY")
const body = { "items": [ { "teamId": "664f0a1b2c3d4e5f60718293", "model": "seedance-2-5", "rules": { "any": { "max": { "duration": 10 } } } } ]}const response = await fetch("https://gptunnel.ru/api/v1/access/setTeamParamRules", { method: "POST", headers: { Authorization: key, "Content-Type": "application/json", }, body: JSON.stringify(body),})if (!response.ok) throw new Error(await response.text())console.log(await response.json())Organizations
Section titled “Organizations”https://gptunnel.ru/api/v1/access/setOrgParamRulesSend 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 jsonimport osfrom 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))curl --request POST \ --url 'https://gptunnel.ru/api/v1/access/setOrgParamRules' \ --header "Authorization: ${GPTUNNEL_API_KEY:?Set GPTUNNEL_API_KEY}" \ --header 'Content-Type: application/json' \ --data '{ "items": [ { "model": "seedance-2-5", "rules": { "by": "resolution", "values": { "720p": { "deny": true } } } } ]}'const key = process.env.GPTUNNEL_API_KEYif (!key) throw new Error("Set GPTUNNEL_API_KEY")
const body = { "items": [ { "model": "seedance-2-5", "rules": { "by": "resolution", "values": { "720p": { "deny": true } } } } ]}const response = await fetch("https://gptunnel.ru/api/v1/access/setOrgParamRules", { method: "POST", headers: { Authorization: key, "Content-Type": "application/json", }, body: JSON.stringify(body),})if (!response.ok) throw new Error(await response.text())console.log(await response.json()){ "code": 0, "updated": 1, "failed": 0, "failedModels": []}Read the current rules in the model’s paramRules field returned by the access settings methods.