Learn how to create application tokens for AI Training.
Requirements
- a working
ovhai
CLI (learn more here)
Instructions
Token creation help
If you need any help while creating a new token, run ovhai token create --help
:
Create an app token
The creation of application tokens is pretty straightforward; you need to define what roles to assign to the token and its scope.
There are two roles available:
-
read
: A token with this role will allow access to the services exposed by the job on thejob_url
. -
operator
: A token with this role will allow interaction with AI Training API and CLI.
The tokens can be scoped to apply only to jobs matching a specific label. Upon creating a token simply provide a name=value
pair and when running a new job add the label to the job to be accessible ovhai job run -l name=value
. If you create a new job using an app token the label-selector
is automatically added to the created job so that it falls within the token scope.
Let us create a new operator
token scoped to model=base
and named basetoken
:
Use the app token
If your token has a role read
and you wish to access the job_url
or if it is an operator
token and you wish to use the AI Training API, simply add the following header to your HTTP requests:
You can also use the operator
token directly with the ovhai
CLI. For all commands, simply add the flag --app-token
to override the default authentication method. Running a simple Hello World
with the app token :
Token lifecycle
Application tokens do not have an expiration date. We need an additional mechanism to revoke those tokens and remove access to unwanted applications.
There are two ways to revoke a token.
token delete
You can delete any token using its ID. List the tokens and find the ID
associated with your token. Then simply run:
token renew
You may wish to revoke a token while keeping its name and label-selector
, a typical use case is if your token leaked or is compromised in any way. Rather than deleting and recreating the token, you can renew it. Simply run:
Go further
For more information and tutorials, please see our other AI & Machine Learning support guides or explore the guides for other OVHcloud products and services.
If you need training or technical assistance to implement our solutions, contact your sales representative or click on this link to get a quote and ask our Professional Services experts for a custom analysis of your project.