For AI agents: the complete documentation index is available at https://docs.us.ovhcloud.com/en/llms.txt, the full documentation bundle is available at https://docs.us.ovhcloud.com/en/llms-full.txt, and this page is available as Markdown at https://docs.us.ovhcloud.com/en/public-cloud/ai-machine-learning/ai-deploy-tokens.md.
  • English

AI Deploy - Accessing your app with tokens

View as Markdown

Learn about the creation of application tokens for AI Deploy.

This is particularly useful when you want to make your app accessible to others without sharing your username and password. Moreover, using tokens facilitates the integration of your app with other services or scripts, such as those using curl, allowing for a more automated and flexible interaction with your AI Deploy application.

In this tutorial, we will create and assign tokens to a basic AI Deploy app, running the infrastructureascode/hello-world Docker image.

Info

 

Requirements

 

Instructions

By default, the following two labels are automatically added to each AI Deploy application:

  • ovh/id whose value is the ID of the AI Deploy app
  • ovh/type whose value is app, the type of AI resource
Info

These labels are prefixed by ovh/, meaning these are reserved by the platform. These labels will be automatically overwritten by the platform if you attempt to redefine them during submission. They won't be displayed in the manager UI.

In addition to these default labels, you can create new ones to further customize and secure your application access.

 

Adding labels to an App

Tokens are scoped based on labels added to your AI Deploy app. To scope a token, you must add a label to your AI Deploy app. This can be done either during the app creation process or after the app is deployed. You can add multiple labels by repeating the following process.

 

Adding a label during app creation

To add a label when creating an AI Deploy app, access the Advanced Configuration step in the app creation process. This section allows you to specify a custom Docker command, the mounted volumes, and the app labels.

From this last sub-section, you can add a key-value pair. The key is the label identifier (e.g., group), while the value is the corresponding value assigned to this key (e.g., A). In this tutorial, we use the example group=A as the label of the AI Deploy app:

AI order advanced configuration

Once created, all the labels of an AI Deploy app are listed on the app details, in the Labels panel:

Manager AI dashboard

 

Adding a label to an existing app

If your app is already deployed, you can still add or update labels at any time using the Control Panel (UI) or the ovhai CLI.

Via the OVHcloud Control Panel
Via the ovhai CLI

Navigate to the AI Deploy section where all your apps are listed. Click the name of your app to open its details page. Locate the Labels section. Enter the key-value pair and click + to add the label to your app.

After saving, the added label will be visible in the Labels section of the app details.

Manager AI dashboard general information

 

Generating tokens

From the AI Dashboard page, you access the tokens management page by clicking the Tokens tab. To add a new token, click + Create a token.

Manager AI dashboard tab

Two types of roles can be assigned to a token:

  • AI Platform - Reader: allows only querying the app
  • AI Platform - Operator: allows querying and full lifecycle management (start/stop/delete)

 

Read token

Let us create a token for the AI Deploy apps matching the label group=A with read-only access in the US-EAST-VA cluster. To create an AI Deploy app token, we need to specify four parameters:

  • Token name: used for token identification, management only.

  • Label selector: determines which apps the token applies to (e.g., group=A).

  • Role: choose from:

    • AI Reader: read-only
    • AI Operator: read & manage
  • Region: e.g., Virginia

Fill out the form and click Generate.

Manager AI dashboard create token - step 2

After completing the form, click Generate to confirm the token creation.

Warning

NOTE: You will then receive the value of your new token, which you must carefully save, as its value is only displayed once. If you lose the token value, you will need to regenerate it.

This newly generated token provides read access over all resources tagged with the label group=A, including the ones submitted after the creation of the token.

If you prefer working from the command line, you can generate the same token using the ovhai CLI:

ovhai token create reader-token --role read --label-selector group=A

 

Operator token

An operator token grants read access along with management access for the matching apps. This means that you can manage the AI Deploy app lifecycle (start/stop/delete) using either the CLI (more info here) or the AI Training API by providing this token.

Manager AI dashboard create token - step 3

The equivalent CLI command is:

ovhai token create operator-token --role operator --label-selector group=A

You can also scope a token to a specific app using the ovh/id label and the app’s ID as its value. This label is added automatically by default, as explained above, and because it is reserved, it will uniquely match only one app.

 

Using a token to query an AI Deploy app

With the token we generated in the previous step, we will now query the app. For this demonstration, we deployed a simple Hello World app that always responds Hello, World!.

You can get the access URL of your app in the details of the AI Deploy app above the Tags.

 

Browser

When accessing the AI Deploy app via its URL in your browser, you will reach a Login page:

PaaS AI access - step 7

To use the token to access this app, you can click on Login with token. Fill in your token in the dedicated field and click Connect.

You now land on the exposed AI Deploy app service:

PaaS AI access - step 8

 

Code integration

You can also directly CURL the AI Deploy app using the token as an Authorization header:

export TOKEN=<your-token>
curl "https://<your-app-id>.app.<your-app-region>.ai.cloud.ovh.us" -H "Authorization: Bearer $TOKEN"

> Hello, World!

 

Token lifecycle

Once a token is created, you can either regenerate the token or delete it.

 

Regenerating a token

When creating a token, the actual token string is only displayed once upon creation. It is not possible to retrieve the actual token afterward, so make sure to save it when creating a new one.

If you lost the token or if it leaked and you need to invalidate the token, you can generate it again. This causes the existing token to expire.

From the list of tokens, click on the more options ... button and select Regenerate:

Manager AI dashboard tab more options

 

Deleting a token

If you simply need to invalidate the token, you can delete it using the same action menu to regenerate a token. This will invalidate the existing token.

From the list of tokens, click on the more options ... button and select Delete.

 

Go further

Browse all the AI & Machine Learning guides.

Browse the rest of the OVHcloud US documentation for guides on our other products and services.

Learn more about AI & Machine Learning on the OVHcloud US website.

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.