Skip to content

API Key Management

GPUStack supports authentication using API keys. Each GPUStack user can generate and manage their own API keys.

Create API Key

  1. Navigate to the API Keys page.
  2. Click the New API Key button.
  3. Fill in the Name, Description, and select the Expiration of the API key.
  4. Click the Save button.
  5. 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

  1. Navigate to the API Keys page.
  2. Find the API key you want to delete.
  3. Click the Delete button in the Operations column.
  4. 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
  }'