API Key Management
GPUStack supports authentication using API keys. Each GPUStack user can generate and manage their own API keys.
Create API Key
- Navigate to the
API Keys
page. - Click the
New API Key
button. - Fill in the
Name
,Description
, and select theExpiration
of the API key. - Click the
Save
button. - Copy and store the key somewhere safe, then click the
Done
button.
Note
Please note that you can only see the generated API key once upon creation.
Delete API Key
- Navigate to the
API Keys
page. - Find the API key you want to delete.
- Click the
Delete
button in theOperations
column. - Confirm the deletion.
Use API Key
GPUStack supports using the API key as a bearer token. The following is an example using curl:
export GPUSTACK_API_KEY=myapikey
curl http://myserver/v1-openai/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $GPUSTACK_API_KEY" \
-d '{
"model": "llama3",
"messages": [
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Hello!"
}
],
"stream": true
}'