Roles and Access Control for API Keys
API keys can be used not only for authentication, but also to manage access to system resources and apply restrictions on such access.
Refer to Platform to learn more about API Keys.
This is done via assigning of roles to API keys. Roles must be associated with specific system resources such as models, applications, addons and assistants.
To create and configure access control for API keys:
-
Add restrictions:
Roles used by API keys must be declared in the
roles
section. In the following example, we assign thebasic
role forprojectKey1
API key. It grants access to thechat-gpt-35-turbo
model with some restrictions://Example extract from aidial.config.json
"keys": {
"proxyKey1": { //API key
"project": "Project1",
"role": "basic" // the name of the role
}
},
"roles": {
"basic": { // the name of the role
"limits": {
"chat-gpt-35-turbo": {
"minute": "100000", //number of tokens per minute
"day": "10000000", //number of tokens per day
"week": "10000000", //number of tokens per week
"month": "10000000", //number of tokens per month
}
}
}
}In settings, you can get familiar with the description of the configuration parameters. Refer to configuration file to view the full example.