The following document explains how to authenticate with NVIDIA Run:ai APIs.
NVIDIA Run:ai APIs are accessed using bearer tokens. A token can be obtained by creating an Application through the NVIDIA Run:ai user interface.
An application contains a client ID and a client secret. With the client credentials you can obtain a token and use it within subsequent API calls.
To create applications for your organization, see Applications.
Use the client credentials created to get a temporary token to access NVIDIA Run:ai as follows.
Example Command to Get an API TokenReplace <runai_url>
below with:
For SaaS installations, use <tenant-name>.run.ai
For self-hosted use the NVIDIA Run:ai user interface URL.
curl -X POST \
'https://<runai_url>/api/v1/token' \
--header 'Accept: */*' \
--header 'Content-Type: application/json' \
--data-raw '{
"grantType":"client_credentials",
"clientId":"<CLIENT ID>",
"clientSecret" : "<CLIENT SECRET>"
}'
import requests
import json
reqUrl = "https://<runai_url>/api/v1/token"
headersList = {
"Accept": "*/*",
"Content-Type": "application/json"
}
payload = json.dumps({
"grantType":"client_credentials",
"clientId":"<CLIENT ID>",
"clientSecret" : "<CLIENT SECRET>"
})
response = requests.request("POST", reqUrl, data=payload, headers=headersList)
print(response.text)
package main
import (
"bytes"
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
)
func main() {
url := "https://<runai_url>/api/v1/token"
payload := map[string]string{
"grantType": "client_credentials",
"clientId": "<CLIENT ID>",
"clientSecret": "<CLIENT SECRET>",
}
jsonPayload, err := json.Marshal(payload)
if err != nil {
panic(err)
}
req, err := http.NewRequest("POST", url, bytes.NewBuffer(jsonPayload))
if err != nil {
panic(err)
}
req.Header.Set("Accept", "*/*")
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
panic(err)
}
fmt.Println(string(body))
}
The API response will look as follows:
{
"accessToken": "<TOKEN>",
}
To call NVIDIA Run:ai REST APIs, the application must pass the retrieved accessToken
as a Bearer token in the Authorization header of your HTTP request.
For more comprehensive code examples demonstrating how to authenticate and interact with the NVIDIA Run:ai API, visit the official NVIDIA Run:ai API Examples repository on GitHub.
This repository contains ready-to-use code samples in multiple programming languages, including:
These examples cover common authentication flows, API requests, and best practices for securely accessing the NVIDIA Run:ai platform. You can use them as a reference or starting point for your own integrations.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4