Interact with Blaxel by API or CLI using access tokens.
bl login
command.
You will then be redirected to the Blaxel console to finish logging in. Sign in using your Blaxel account if you arenβt already.
Once this is done, return to your terminal: the login will be finalized and you will then be able to run CLI commands.
/oauth/token
endpoint.
curl --request POST \
--url https://api.blaxel.ai/v0/oauth/token \
--header 'Authorization: Basic base64(CLIENT_ID:CLIENT_SECRET)' \
--header 'Content-Type: application/json' \
--data '{
"grant_type":"client_credentials"
}'
curl --request POST \
--url https://api.blaxel.ai/v0/oauth/token \
--header 'Content-Type: application/json' \
--data '{
"grant_type":"client_credentials",
"client_id": CLIENT_ID,
"client_secret": CLIENT_SECRET
}'
Authorization
or X-Blaxel-Authorization
, as such:
curl 'https://api.blaxel.ai/v0/models' \
-H 'Accept: application/json, text/plain, */*' \
-H 'X-Blaxel-Authorization: Bearer YOUR_TOKEN'
https://api.blaxel.ai/v0/.well-known/openid-configuration
Authorization
or X-Blaxel-Authorization
.
Alternatively, you can retrieve a token using the SDK:
import { settings } from Β΄blaxel/coreβ
await settings.authenticate() // Refreshes the token only if needed
console.log(settings.token)
Authorization
or X-Blaxel-Authorization
in any call to the Blaxel APIs. For example, to list models:
curl 'https://api.blaxel.ai/v0/models' \
-H 'Accept: application/json, text/plain, */*' \
-H 'Authorization: Bearer YOUR-API-KEY'
export BL_API_KEY=YOUR-API-KEY
bl login YOUR-WORKSPACE
Was this page helpful?