Access Control with Organizations and Projects
Overview
Basic Concepts
LLMariner provides access control with two concepts: Organizations
and Projects
. The basic concept follows OpenAI API.
You can define one or more than one organization. In each organization, you can define one or more than one project. For example, you can create an organization for each team in your company, and each team can create individual projects based on their needs.
A project controls the visibility of resources such as models, fine-tuning jobs. For example, a model that is generated by a fine-tuned job in project P
is only visible from project members in P
.
A project is also associated with a Kubernetes namespace. Fine-tuning jobs for project P
run in the Kubernetes namespace associated with P
(and quota management is applied).
Roles
Each user has an organization role
and a project role
, and these roles control resources that a user can access and actions that a user can take.
An organization role is either owner
or reader
. A project role is either owner
or member
. If you want to allow a user to use LLMariner without any organization/project management privilege, you can grant the organization role reader
and the project role member
. If you want to allow a user to manage the project, you can grant the project role owner
.
Here is an diagram shows an example role assignment.
The following summarizes how these role implements the access control:
- A user can access resources in project
P
in organizationO
if the user is amember
ofP
,owner
ofP
, orowner
ofO
. - A user can manage project
P
(e.g., add a new member) in organizationO
if the user is anowner
ofP
orowner
ofO
. - A user can manage organization
O
(e.g., add a new member) if the user is anowner
ofO
. - A user can create a new organization if the user is an
owner
of the initial organization that is created by default.
Please note that a user who has the reader
organization role cannot access resources in the organization unless the user is added to a project in the organization.
Creating Organizations and Projects
You can use CLI llma
to create a new organization and a project.
Creating a new Organization
You can run the following command to create a new organization.
llma admin organizations create <organization title>
Note
You can also typellm auth orgs
instead of llm auth organizations
.You can confirm that the new organization is created by running:
llma admin organizations list
Then you can add a user member to the organization.
llma admin organizations add-member <organization title> --email <email-address of the member> --role <role>
The role can be either owner
or reader
.
You can confirm organization members by running:
llma admin organizations list-members <organization title>
Creating a new Project
You can take a similar flow to create a new project. To create a new project, run:
llma admin projects create --title <project title> --organization-title <organization title>
To confirm the project is created, run:
llma admin projects list
Then you can add a user member to the project.
llma admin projects add-member <project title> --email <email-address of the member> --role <role>
The role can be either owner
or member
.
You can confirm project members by running:
llma admin projects list-members --title <project title> --organization-title <organization title>
If you want to manage a project in a different organization, you can pass --organization-title <title>
in each command. Otherwise, the organization in the current context is used. You can also change the current context by running:
llma context set
Choosing an Organization and a Project
You can use llma context set
to set the current context.
llma context set
Then the selected context is applied to CLI commands (e.g., llma models list
).
When you create a new API key, the key will be associated with the project in the current context. Suppose that a user runs the following commands:
llma context set # Choose project my-project
llma auth api-keys create my-key
The newly created API key is associated with project my-project
.